Skip site navigation (1) Skip section navigation (2)

Re: problem with CVS version

From: "Dave Page" <dpage(at)vale-housing(dot)co(dot)uk>
To: "Antonio Pennino" <a(dot)pennino(at)nocerainformatica(dot)net>
Cc: <pgsql-odbc(at)postgresql(dot)org>
Subject: Re: problem with CVS version
Date: 2004-07-27 21:23:21
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-odbc

> -----Original Message-----
> From: Dave Page 
> Sent: 27 July 2004 21:34
> To: 'Antonio Pennino'
> Subject: RE: [ODBC] problem with CVS version
> The behaviour you see is correct when calling 
> SQLDescribeColW, however, I did just test this using ANSI 
> ODBC Test and it is also returning -9 which is not correct. 
> I'm not convinced this will resolve your problem, but it 
> certainly isn't right. I'll look into it some more...

OK, I've traced this through the code, and as far as I can see it is
just fine. If the connection is made using SQLConnectW,
SQLDriverConnectW or SQLBrowseConnectW, then a unicode flag in the
connection object is set. When a PostgreSQL type is later converted to
an ODBC type (as happens for SQLDescribeCol), that flag is checked. The
following rules apply:

If the column length exceeds max_varchar_size, if the unicode flag is
set, SQL_WLONGVARCHAR is returned, otherwise SQL_LONGVARCHAR is
returned. If the column length does not exceed max_varchar_size, if the
unicode flag is set, SQL_WVARCHAR is returned, otherwise SQL_VARCHAR is

I believe the ANSI ODBC Test program is giving a bit of a red herring.
The SQL trace log shows it calling SQLConnectW:

odbcte32        d10-d14	ENTER SQLDriverConnectW 
		HDBC                003A1510
		HWND                00140560
		WCHAR *             0x1F7A9D2C [      -3] "******\ 0"
		SWORD                       -3 
		WCHAR *             0x1F7A9D2C 
		SWORD                        2 
		SWORD *             0x00000000
		UWORD                        1 <SQL_DRIVER_COMPLETE>

Therefore it's no surprise that the driver thinks it's OK to return
unicode datatypes.

Regards, Dave.


pgsql-odbc by date

Next:From: Mark DexterDate: 2004-07-27 22:25:55
Subject: Updatable Cursors, CTID, and Views
Previous:From: Dave PageDate: 2004-07-27 15:57:57
Subject: Re: problem with CVS version

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group