psqlodbc patches to unsiged short wchar definition on linux platform
am 12.04.2006 10:45:46 von Karol SzkudlarekHello!
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 =3D 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 =3D WCLEN * wcslen((SQLWCHAR *) buffer);
+ used =3D WCLEN * mywcslen((SQLWCHAR *) buffer);
buf =3D allocbuf =3D ucs2_to_utf8((SQLWCHAR *)=20
buffer, used / WCLEN, (UInt4 *) &used, FALSE);
used *=3D 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
--=20
Karol Szkudlarek
Badawczo - Rozwojowa Spó³dzielnia Pracy Mikroprocesorowych System=F3w
Automatyki "Mikronika"
ul. Wykopy 2/4
60-001 POZNA=D1
tel. +48 61 6655600
fax +48 61 6655602
e-mail karol@mikronika.com.pl
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings