tags 398411 + patch
thanks

On Mon, Nov 13, 2006 at 08:10:20PM +0100, Andreas Tscharner wrote:
> > g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I../../src -I../../lib 
> > -I/usr/include/postgresql -g -O2 -c ../odbc/OdbcConnection.cpp -MT 
> > OdbcConnection.lo -MD -MP -MF .deps/OdbcConnection.TPlo  -fPIC -DPIC -o 
> > .libs/OdbcConnection.o
> > ../odbc/OdbcConnection.cpp: In member function 'virtual CSqlRecordsetPtr 
> > COdbcConnection::Execute(const char*, ...)':
> > ../odbc/OdbcConnection.cpp:134: error: cannot convert 'int*' to 'SQLLEN*' 
> > for argument '10' to 'SQLRETURN SQLBindParameter(void*, SQLUSMALLINT, 
> > SQLSMALLINT, SQLSMALLINT, SQLSMALLINT, SQLULEN, SQLSMALLINT, void*, SQLLEN, 
> > SQLLEN*)'
> 
> Could you please try if an explicit cast
> 
> ret =
> SQLBindParameter(hStmt,i->first+1,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR,0,0,NULL,0,(SQLLEN*)&m_sqli[i->first]);
> 
> works. Unfortunately I have no 64bit system...

I guess it depends on what you mean with "works".  It will make it
build, but it'll cause problem at runtime.

You have is:
std::map<int,SQLINTEGER> m_sqli
and:
typedef long SQLLEN;
typedef int SQLINTEGER;

and sizeof(long) != sizeof(int)

What looks like a better thing to do is change the SQLINTEGER to an
SQLLEN, if that's what it contains.

The attached patch makes it build for me.



Kurt

--- cvsnt-2.5.03.2382/cvsapi/odbc/OdbcConnection.cpp    2006-02-07 
16:39:33.000000000 +0100
+++ cvsnt-2.5.03.2382+64/cvsapi/odbc/OdbcConnection.cpp 2006-11-13 
20:51:51.000000000 +0100
@@ -260,7 +260,7 @@
        } 
 
        long id;
-       SQLINTEGER len;
+       SQLLEN len;
 
        m_lasterror=SQLBindCol(hStmt,1,SQL_C_LONG,&id,sizeof(id),&len);
        if(!SQL_SUCCEEDED(m_lasterror))
--- cvsnt-2.5.03.2382/cvsapi/odbc/OdbcConnection.h      2006-02-07 
16:39:33.000000000 +0100
+++ cvsnt-2.5.03.2382+64/cvsapi/odbc/OdbcConnection.h   2006-11-13 
20:50:03.000000000 +0100
@@ -67,7 +67,7 @@
        cvs::string m_lasterrorString;
        cvs::string m_lastrsError;
        std::map<int,CSqlVariant> m_bindVars;
-       std::map<int,SQLINTEGER> m_sqli;
+       std::map<int,SQLLEN> m_sqli;
        std::map<int,valStruct> m_sqlv;
 };
 
--- cvsnt-2.5.03.2382/cvsapi/odbc/OdbcRecordset.h       2005-07-26 
23:16:09.000000000 +0200
+++ cvsnt-2.5.03.2382+64/cvsapi/odbc/OdbcRecordset.h    2006-11-13 
20:59:29.000000000 +0100
@@ -48,10 +48,10 @@
        HSTMT hStmt;
        cvs::string name;
        SQLSMALLINT type,ctype;
-       SQLUINTEGER size;
+       SQLULEN size;
        SQLSMALLINT decimal;
        SQLSMALLINT null;
-       SQLINTEGER fldlen,datalen;
+       SQLLEN fldlen,datalen;
        void *data;
        SQLSMALLINT field;
        cvs::wstring tmpwstr;

Reply via email to