psqlodbc patches to unsiged short wchar definition on linux platform

From: Karol Szkudlarek <karol(at)mikronika(dot)com(dot)pl>
To: pgsql-odbc(at)postgresql(dot)org
Subject: psqlodbc patches to unsiged short wchar definition on linux platform
Date: 2006-04-12 08:45:46
Message-ID: 443CBE3A.9070401@mikronika.com.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Hello!

I successfully used the driver psqlodbc-08.01.0200 with postgres
database in UTF-8 encoding and with unsigned short wchar definition
after applying the following patches to the driver:

1) config.h

//#define SQL_WCHART_CONVERT

2) convert.h

--- convert.c 2006-01-08 11:09:52.000000000 +0100
+++ convert_my.c 2006-04-07 15:35:56.000000000 +0200
@@ -195,6 +195,14 @@
#endif /* WIN32 */
#endif /* ODBCINT64 */

+size_t mywcslen( SQLWCHAR* buffer )
+{
+ size_t ret = 0;
+ while (*buffer++)
+ ++ret;
+ return ret;
+}
+
/*
* TIMESTAMP <-----> SIMPLE_TIME
* precision support since 7.2.
@@ -2668,7 +2676,7 @@
#ifdef UNICODE_SUPPORT
case SQL_C_WCHAR:
if (SQL_NTS == used)
- used = WCLEN * wcslen((SQLWCHAR *) buffer);
+ used = WCLEN * mywcslen((SQLWCHAR *) buffer);
buf = allocbuf = ucs2_to_utf8((SQLWCHAR *)
buffer, used / WCLEN, (UInt4 *) &used, FALSE);
used *= WCLEN;
break;

My testing configuration:

server and client platform: Linux
psqlodbc configure: ./configure --with-unixodbc --enable-unicode
unixodbc: 2.2.11.

Please consider putting those changes to the driver. Without that driver
doesn't work correctly.

Regards,
Karol Szkudlarek

--
Karol Szkudlarek
Badawczo - Rozwojowa Spółdzielnia Pracy Mikroprocesorowych Systemów
Automatyki "Mikronika"
ul. Wykopy 2/4
60-001 POZNAŃ
tel. +48 61 6655600
fax +48 61 6655602
e-mail karol(at)mikronika(dot)com(dot)pl

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Alan Potter 2006-04-12 18:16:51 Re: Promoting the enhanced branch
Previous Message setyawan 2006-04-12 00:15:55 unsubscribe