[unixODBC-dev] API differences sql.h unixODBC vs. MS

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Mon Dec 20 18:07:07 GMT 2004


> 
> Hi all,
> 
> I'm writing an ODBC driver and I'm running into some small differences
> in the SQL function API's as listed in unixODBC's sql.h compared with
> the MS version.
> 
> For example, from MS's SQL.H I have:
> 
> SQLRETURN  SQL_API SQLBindCol(SQLHSTMT StatementHandle,
>                    SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
>                    SQLPOINTER TargetValue, SQLINTEGER BufferLength,
>                    SQLINTEGER *StrLen_or_Ind);
> 
> and unixODBC defines:
> 
> SQLRETURN  SQL_API SQLBindCol(SQLHSTMT StatementHandle,
>                    SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
>                    SQLPOINTER TargetValue, SQLLEN BufferLength,
>                    SQLLEN *StrLen_or_Ind);
> 
> Where two SQLLENs used in unixODBC are SQLINTEGERs in the MS
> version.
> 
> What is the recommended way to resolve these kinds of differences
> when writing a driver?
> 
> This:
> 
> #ifdef WIN32
> #define SQLLEN SQLINTEGER
> #define SQLULEN SQLUINTEGER
> #define SQLROWOFFSET SQLINTEGER
> #endif
> 
> at the top of my driver header seems to get the job done, but doesn't
> feel right.
> 
> Thanks,
> 
> Eric Sharkey

Simply you are using old MS documentation. MS rewrite declaration for
64bit platform introcucing SQLLEN/SQLULEN. In 32bit environments SQLLEN
=== SQLINTEGER so no problem at all.

freddy77




More information about the unixODBC-dev mailing list