Re: FW: PostgreSQL ODBC bug

Re: FW: PostgreSQL ODBC bug

am 21.12.2005 17:59:42 von Ludek Finstrle

--FCuugMFkClbJLl1L
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

> > When you try to select the data using this c# program - you should get
> > the same trailing garbage errors we get.
>
> I'm able to reproduce it here. It isn't ANSI related. The error
> occurs only in PostgreSQL Unicode driver.
>
> Stay tuned. I hope I can fix it till end of week.

I fix it before end of week as I promisee :-)
If you need binary DLL please send me a note from which source I may
compile it (CVS, psqlodbc-8.01.0105, 8.01.0102, ...)

For mailing list:
There is problem with SQLGetData from text column which is longer than
X bytes (with Unicode driver). The last part is returned filled up with
random data from memory.

I found the problem and I fix it. I'm not sure if it doesn't break
some other functionality.

Patch attached.

Please review and comment. I appreciate also huge testing and report.

Regards,

Luf

--FCuugMFkClbJLl1L
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="psqlodbc-getdata_unicode.diff"

diff -c psqlodbc.orig\convert.c psqlodbc\convert.c
*** psqlodbc.orig\convert.c Mon Dec 05 20:20:53 2005
--- psqlodbc\convert.c Wed Dec 21 18:32:53 2005
***************
*** 917,923 ****
--- 917,926 ----
/* Add null terminator */
#ifdef UNICODE_SUPPORT
if (fCType == SQL_C_WCHAR)
+ {
memset(rgbValueBindRow + copy_len, 0, WCLEN);
+ wchanged = TRUE;
+ }
else
#endif /* UNICODE_SUPPORT */
rgbValueBindRow[copy_len] = '\0';

--FCuugMFkClbJLl1L
Content-Type: text/plain
Content-Disposition: inline
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

--FCuugMFkClbJLl1L--