List:MySQL ODBC« Previous MessageNext Message »
From:Michael Widenius Date:October 21 1999 9:30am
Subject:Re: Problem updating/inserting DATETIME data
View as plain text  
>>>>> "Gary" == Gary Wong <gary.wong@stripped> writes:

Gary> Hi Michael!
Gary> Here's the two SQLPrepare sections before the mysql_real_query section.
Gary> Thanks so much for your help - 

Gary> Gary Wong
Gary> gary.wong@stripped

<cut>

Ok.  The problem is that according to ODBC, dates should be given as 
a string of type {d date} or as a SQL_C_DATE struct.

It seams that in your case the date is given as a normal string.

I shall in the next MyODBC version add a patch for this!

(/my/local/src/myodbc-2.50.27) diff -c /tmp/execute.c .
*** /tmp/execute.c      Thu Oct 21 12:26:33 1999
--- ./execute.c Thu Oct 21 12:29:17 1999
***************
*** 301,306 ****
--- 301,310 ----
    }
    }
    switch (param->SqlType) {
+   case SQL_DATE:
+     if (data[0] == '{')                               /* Of type {d date } */
+       return add_to_buffer(net,to,data,length);
+     /* else threat as a string */
    case SQL_CHAR:
    case SQL_VARCHAR:
    case SQL_LONGVARCHAR:
***************
*** 356,363 ****
      sprintf(buff,"'%02d:%02d:%02d'",time/10000,time/100%100,time%100);
      return add_to_buffer(net,to,buff,10);
    }
-   case SQL_DATE:
-     return add_to_buffer(net,to,data,length); /* May be of type {d date } */
    case SQL_FLOAT:
    case SQL_REAL:
    case SQL_DOUBLE:
--- 360,365 ----


Sorry, but as I am just about to leave for 2 week vacation, this has
to wait until I am back.

Regards,
Monty
Thread
Problem updating/inserting DATETIME dataGary Wong20 Oct
  • Re: Problem updating/inserting DATETIME dataHendrik M.J. Arnoldus20 Oct
  • Re: Problem updating/inserting DATETIME dataGary Wong20 Oct
    • Re: Problem updating/inserting DATETIME dataMichael Widenius20 Oct
  • Problem updating/inserting DATETIME dataMichael Widenius20 Oct
  • Re: Problem updating/inserting DATETIME dataGary Wong21 Oct
    • Re: Problem updating/inserting DATETIME dataMichael Widenius21 Oct
  • Re: Problem updating/inserting DATETIME dataHendrik M.J. Arnoldus21 Oct
  • Re: Problem updating/inserting DATETIME dataGary Wong21 Oct
  • Re: Problem updating/inserting DATETIME dataGary Wong25 Oct
Re: Problem updating/inserting DATETIME dataMichael Widenius23 Oct