Skip to Content.
Sympa Menu

freetds - Re: [freetds] ODBC datetime literal issue

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] ODBC datetime literal issue
  • Date: Tue, 21 Mar 2006 13:26:20 +0100

>
> 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)

Applied (both 0.64 and HEAD branches).
Patch for 0.64rc1 at http://freetds.sourceforge.net/post64rc1.diff.gz

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page