Fixed MSSQL interface

git-svn-id: svn://ultimatepp.org/upp/trunk@1093 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2009-04-22 12:26:18 +00:00
parent a8ab1c0aae
commit 50ca785bdc
5 changed files with 32 additions and 6 deletions

View file

@ -7,6 +7,15 @@ namespace Upp {
String MsSqlTextType(int width);
typedef ODBCSession MSSQLSession;
inline
bool MSSQLPerformScript(const String& text, StatementExecutor& executor,
Gate2<int, int> progress_canceled = false)
{
return ODBCPerformScript(text, executor, progress_canceled);
}
};
#endif

View file

@ -1,3 +1,8 @@
description "MSSQL interface\377";
uses
ODBC;
file
MSSQL.h,
MSSQLSchema.h,

View file

@ -1,3 +1,4 @@
#ifndef _MSSQL_icpp_init_stub
#define _MSSQL_icpp_init_stub
#include "ODBC/init"
#endif

View file

@ -276,11 +276,20 @@ void ODBCConnection::SetParam(int i, const Value& r)
{
Param& p = param.At(i);
if(IsNumber(r)) {
double x = r;
p.ctype = SQL_C_DOUBLE;
p.sqltype = SQL_DOUBLE;
p.data = String((char *)&x, sizeof(x));
p.li = sizeof(x);
if(r.Is<int64>()) {
int64 x = r;
p.ctype = SQL_C_SBIGINT;
p.sqltype = SQL_BIGINT;
p.data = String((char *)&x, sizeof(x));
p.li = sizeof(x);
}
else {
double x = r;
p.ctype = SQL_C_DOUBLE;
p.sqltype = SQL_DOUBLE;
p.data = String((char *)&x, sizeof(x));
p.li = sizeof(x);
}
}
if(IsString(r)) {
p.ctype = SQL_C_CHAR;
@ -427,7 +436,7 @@ bool ODBCConnection::Fetch0()
v = dbl;
break;
case INT64_V:
if(!IsOk(SQLGetData(session->hstmt, i + 1, SQL_C_SBIGINT, &n64, sizeof(dbl), &li)))
if(!IsOk(SQLGetData(session->hstmt, i + 1, SQL_C_SBIGINT, &n64, sizeof(n64), &li)))
break;
if(li != SQL_NULL_DATA)
v = n64;

View file

@ -1,3 +1,5 @@
description "Generic ODBC interface\377";
uses
Sql;