Skip to Content.
Sympa Menu

freetds - [freetds] ODBC datetime literal issue

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Richard Krehbiel" <richard.krehbiel AT gmail.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] ODBC datetime literal issue
  • Date: Thu, 16 Mar 2006 14:06:31 -0500

I've been porting some Windows code that uses ODBC to Linux (Fedora
core 4, freetds 0.63), and I must congratulate you guys; the freetds &
ODBC combination works remarkably well.

But there is one thing...

We have a number of bits of code that compose datetime literals using
a format like the following:

{ts'2006-03-15 08:10:41.000'}

When I feed this to the freetds odbc driver, it messes up the native
SQL. I tracked it down to src/odbc/native.c. It expects a space
following the "ts", but the first space in our literal is in the
middle of the timestamp string.

I'd like to suggest the following patch (composed against 0.64RC1),
that looks for a non-alphabetic char instead:

--- native.c.old 2006-02-24 16:14:25.000000000 -0500
+++ native.c 2006-03-14 13:57:41.000000000 -0500
@@ -139,8 +139,8 @@
if (!pcall) {
/* assume syntax in the form {type ...} */
- p = strchr(s, ' ');
- if (!p)
- break;
- s = p + 1;
+ while(isalpha(*s))
+ s++;
+ while(TDS_ISSPACE(*s))
+ s++;
} else {
if (*s == '?' && stmt)




Archive powered by MHonArc 2.6.24.

Top of Page