| 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: | E7F85A1B5FF8D44C8A1AF6885BC9A0E41A7499@ratbert.vale-housing.co.uk | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| 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
returned. 
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.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Mark Dexter | 2004-07-27 22:25:55 | Updatable Cursors, CTID, and Views | 
| Previous Message | Dave Page | 2004-07-27 15:57:57 | Re: problem with CVS version |