psqlodbc patches to unsiged short wchar definition on linux platform - Mailing list pgsql-odbc

From Karol Szkudlarek
Subject psqlodbc patches to unsiged short wchar definition on linux platform
Date
Msg-id 443CBE3A.9070401@mikronika.com.pl
Whole thread Raw
Responses Re: psqlodbc patches to unsiged short wchar definition on  (Hiroshi Inoue <inoue@tpf.co.jp>)
List 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@mikronika.com.pl

pgsql-odbc by date:

Previous
From: "Sam Thukral"
Date:
Subject: ADO Ref cursor return
Next
From: "Alan Potter"
Date:
Subject: Re: Promoting the enhanced branch