Skip to Content.
Sympa Menu

freetds - Re: [freetds] types as returned by SQLDescribeCol

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] types as returned by SQLDescribeCol
  • Date: Mon, 28 Jan 2008 08:58:56 +0100

> When building an ODBC application without a DM, do I need to #define
> ODBCVER=0x300 or anything like that? I'm not getting the
> types I expect.
>
> With a table defined as:
>
> create table T ( t int NULL
> , r real NULL
> , s varchar(30) NULL)
>
> calling SQLDescribeCol returns SQL_SUCCESS for column 1 fills the
> DataTypePtr buffer with the value 4 (0x4).
>
> I am calling
>
> SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION,
> (SQLPOINTER) SQL_OV_ODBC3, SQL_IS_UINTEGER))
>
> as soon as the environment handle is allocated.
>
> Based on
> http://msdn2.microsoft.com/en-us/library/ms714556(VS.85).aspx I
> am expecting SQL_C_SLONG. In my sqlext.h I see:
>
> #define SQL_C_SLONG (SQL_C_LONG+SQL_SIGNED_OFFSET)
> #define SQL_SIGNED_OFFSET (-20)
> #define SQL_C_LONG SQL_INTEGER
>
> and in sql.h
>
> #define SQL_INTEGER 4
>
> so it would appear I'm getting SQL_INTEGER instead....
>
> Also, does my application have to handle both, or can it demand 3.0
> behavior?
>
> Many thanks.
>

You are confusing C Data Types with SQL Data Types, see
http://msdn2.microsoft.com/en-us/library/ms710150(VS.85).aspx.
ODBC have 2 types, server types (SQL Data Types) and program types (C
Data Types).
Well... about ODBC 3 I think that ODBC 2 behavior is not that used...
for new programs just write odbc 3 and forget about odbc 2!

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page