List:Commits« Previous MessageNext Message »
From:jbalint Date:June 16 2008 8:00am
Subject:Connector/ODBC 3.51 commit: r1119 - in branches/guffert: . driver test
View as plain text  
Modified:
   branches/guffert/ChangeLog
   branches/guffert/driver/execute.c
   branches/guffert/test/my_datetime.c
Log:
SQL_TYPE_TIMESTAMP and SQL_TYPE_TIME parameters were incorrectly included when parameters
were expanded. (Bug #37342)


Modified: branches/guffert/ChangeLog
===================================================================
--- branches/guffert/ChangeLog	2008-06-14 17:04:31 UTC (rev 1118)
+++ branches/guffert/ChangeLog	2008-06-16 06:00:49 UTC (rev 1119)
@@ -7,10 +7,12 @@
     the dialog box instead of SQL_NO_DATA. (Bug #36293)
   * System DSN lookup (using ODBC_BOTH_DSN) fails on Windows XP.
     (Bug #36203)
-  * A SQLProcedures followed by a SQLFreeStmt causes a crash
-    (Bug #36069)
+  * SQLProcedures() followed by SQLFreeStmt() crashes (Bug #36069)
   * ADO adUseServer cursor is lost after updating adLongVarWChar field
     (Bug #26950)
+  * SQL_TYPE_TIMESTAMP and SQL_TYPE_TIME parameters were incorrectly
+    included when parameters were expanded. (Bug #37342)
+
 ----
 
 5.1.4 (15-Apr-2008)

Modified: branches/guffert/driver/execute.c
===================================================================
--- branches/guffert/driver/execute.c	2008-06-14 17:04:31 UTC (rev 1118)
+++ branches/guffert/driver/execute.c	2008-06-16 06:00:49 UTC (rev 1119)
@@ -500,7 +500,7 @@
             if (data[0] == '{')       /* Of type {d date } */
             {
               to= add_to_buffer(net, to, data, length);
-              break;
+              goto out;
             }
             /* else treat as a string */
         case SQL_CHAR:
@@ -524,6 +524,7 @@
                 to= add_to_buffer(net, to, dbc->ansi_charset_info->csname,
                                   strlen(dbc->ansi_charset_info->csname));
               }
+              /* We have only added the introducer, data is added below. */
               break;
             }
         case SQL_TIME:
@@ -544,7 +545,7 @@
                         (int) time%100);
                 to= add_to_buffer(net, to, buff, 10);
             }
-            break;
+            goto out;
         case SQL_FLOAT:
         case SQL_REAL:
         case SQL_DOUBLE:

Modified: branches/guffert/test/my_datetime.c
===================================================================
--- branches/guffert/test/my_datetime.c	2008-06-14 17:04:31 UTC (rev 1118)
+++ branches/guffert/test/my_datetime.c	2008-06-16 06:00:49 UTC (rev 1119)
@@ -897,6 +897,65 @@
 }
 
 
+/**
+ Bug #37342: ODBC TIMESTAMP string format not handled properly by ODBC driver
+*/
+DECLARE_TEST(t_bug37342)
+{
+  SQLCHAR *date= (SQLCHAR *)"{dt '2007-01-13'}";
+  SQLCHAR *time= (SQLCHAR *)"194759";
+  SQLCHAR out[30];
+  TIMESTAMP_STRUCT ts;
+  SQLINTEGER len= SQL_NTS;
+
+  ok_stmt(hstmt, SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR,
+                                  SQL_TIMESTAMP, 0, 0, date, 0, &len));
+
+  ok_sql(hstmt, "SELECT ? AS foo");
+
+  ok_stmt(hstmt, SQLFetch(hstmt));
+
+  is_str(my_fetch_str(hstmt, out, 1), "2007-01-13", 11);
+
+  expect_stmt(hstmt, SQLFetch(hstmt), SQL_NO_DATA);
+
+  ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_CLOSE));
+
+  ok_stmt(hstmt, SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR,
+                                  SQL_TYPE_TIME, 0, 0, time, 0, &len));
+
+  ok_sql(hstmt, "SELECT ? AS foo");
+
+  ok_stmt(hstmt, SQLFetch(hstmt));
+
+  is_str(my_fetch_str(hstmt, out, 1), "19:47:59", 9);
+
+  expect_stmt(hstmt, SQLFetch(hstmt), SQL_NO_DATA);
+
+  ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_CLOSE));
+
+  ok_stmt(hstmt, SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_TIMESTAMP,
+                                  SQL_TYPE_TIME, 0, 0, &ts, sizeof(ts), NULL));
+
+  ts.hour= 19;
+  ts.minute= 47;
+  ts.second= 59;
+  ts.fraction= 4;
+
+  ok_sql(hstmt, "SELECT ? AS foo");
+
+  ok_stmt(hstmt, SQLFetch(hstmt));
+
+  is_str(my_fetch_str(hstmt, out, 1), "19:47:59", 9);
+
+  expect_stmt(hstmt, SQLFetch(hstmt), SQL_NO_DATA);
+
+  ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_CLOSE));
+
+  return OK;
+}
+
+
 BEGIN_TESTS
   ADD_TEST(my_ts)
   ADD_TEST(t_tstotime)
@@ -912,6 +971,7 @@
   ADD_TEST(t_bug14414)
   ADD_TEST(t_bug30939)
   ADD_TEST(t_bug31009)
+  ADD_TEST(t_bug37342)
 END_TESTS
 
 

Thread
Connector/ODBC 3.51 commit: r1119 - in branches/guffert: . driver testjbalint16 Jun