Some corrections on psqlodbc driver

From: Franco Violi <fvioli(at)metodo(dot)net>
To: pgsql-odbc(at)postgresql(dot)org
Subject: Some corrections on psqlodbc driver
Date: 2003-08-30 07:39:46
Message-ID: 200308300939.46923.fvioli@metodo.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

I subscribed the gborg site 2 days ago. The reason was that we are
openoffice users under linux and we have some problems that make
postgres unusable on openoffice/linux. The issue 17455 and 17500 on
openoffice.org points to the problem. I debug the latest version of the
driver and corrected some ( i think) bugs.

One problem was that openoffice send to the driver escape istructions in
uppercase and the driver was testing just lowercase.

Another problem was that on snprintf You cannot use the same buffer
as source and destination, because in this way the result is a null string.

Here are the modification I made on convert.c. I am not sure that on Windows
the strcasecmp system call exist. By the way:

2785d2784
< char tmpbuf[1024]; // temporary snprintf destination
2838c2837
< if (strcasecmp(key, "d") == 0)
---
> if (strcmp(key, "d") == 0)
2842,2843c2841,2842
< prtlen = snprintf(tmpbuf, sizeof(buf), "%s::date ", buf);
< CVT_APPEND_DATA(qb, tmpbuf, prtlen);
---
> prtlen = snprintf(buf, sizeof(buf), "%s::date ", buf);
> CVT_APPEND_DATA(qb, buf, prtlen);
2845c2844
< else if (strcasecmp(key, "t") == 0)
---
> else if (strcmp(key, "t") == 0)
2849,2850c2848,2849
< prtlen = snprintf(tmpbuf, sizeof(buf), "%s::time", buf);
< CVT_APPEND_DATA(qb, tmpbuf, prtlen);
---
> prtlen = snprintf(buf, sizeof(buf), "%s::time", buf);
> CVT_APPEND_DATA(qb, buf, prtlen);
2852c2851
< else if (strcasecmp(key, "ts") == 0)
---
> else if (strcmp(key, "ts") == 0)
2857c2856
< prtlen = snprintf(tmpbuf, sizeof(buf), "%s::datetime", buf);
---
> prtlen = snprintf(buf, sizeof(buf), "%s::datetime", buf);
2859,2860c2858,2859
< prtlen = snprintf(tmpbuf, sizeof(buf), "%s::timestamp", buf);
< CVT_APPEND_DATA(qb, tmpbuf, prtlen);
---
> prtlen = snprintf(buf, sizeof(buf), "%s::timestamp", buf);
> CVT_APPEND_DATA(qb, buf, prtlen);
2862c2861
< else if (strcasecmp(key, "oj") == 0) /* {oj syntax support for 7.1 *
servers */
---
> else if (strcmp(key, "oj") == 0) /* {oj syntax support for 7.1 * servers */
2867c2866
< else if (strcasecmp(key, "fn") == 0)
---
> else if (strcmp(key, "fn") == 0)

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Simeó Reig (Informes Incofisa) 2003-08-30 18:24:44 Re: Some corrections on psqlodbc driver
Previous Message Doug McNaught 2003-08-29 19:08:56 Re: ODBC Connection Pooling (Windows 2000 MDAC 2.7 patched, pgodbc-7.02.00.05)