List:Commits« Previous MessageNext Message »
From:bdegtyariov Date:December 27 2007 7:36pm
Subject:Connector/ODBC 3.51 commit: r964 - in trunk: . driver test
View as plain text  
Modified:
   trunk/ChangeLog
   trunk/driver/info.c
   trunk/test/my_cursor.c
   trunk/test/my_info.c
   trunk/test/my_unixodbc.c
   trunk/test/odbctap.h
Log:
SQLGetInfo() returns the "null" string as database name if no database was selected.
Added mydriver variable.

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-12-27 13:19:28 UTC (rev 963)
+++ trunk/ChangeLog	2007-12-27 19:36:57 UTC (rev 964)
@@ -10,7 +10,9 @@
   * Fixed thread synchronization bug in SQLAllocStmt()/SQLFreeStmt()
     functions. (Bug #32857)
   * Fixed SQLExtendedFetch() ignoring SQL_ROWSET_SIZE attribute if Don't cache
-    result option is set. (Bug #324020)
+    result option is set. (Bug #32420)
+  * SQLGetInfo() returns the "null" string as database name if no database
+    was selected. (Bug #3780)
 
 ----
 

Modified: trunk/driver/info.c
===================================================================
--- trunk/driver/info.c	2007-12-27 13:19:28 UTC (rev 963)
+++ trunk/driver/info.c	2007-12-27 19:36:57 UTC (rev 964)
@@ -367,6 +367,11 @@
     /* break; will never reach */
 
   case SQL_DATABASE_NAME:
+    if (reget_current_catalog(dbc))
+        return set_dbc_error(dbc, "HY000",
+                             "SQLGetInfo() failed to return current catalog.",
+                             0);
+
     MYINFO_SET_STR(rgbInfoValue, cbInfoValueMax, pcbInfoValue, dbc->database);
     /* break; will never reach */
 

Modified: trunk/test/my_cursor.c
===================================================================
--- trunk/test/my_cursor.c	2007-12-27 13:19:28 UTC (rev 963)
+++ trunk/test/my_cursor.c	2007-12-27 19:36:57 UTC (rev 964)
@@ -2613,9 +2613,9 @@
   SQLUINTEGER row_count;
 
   /* Don't cache result option in the connection string */
-  sprintf(conn, "DRIVER={MySQL ODBC 3.51 Driver};USER=%s;PASSWORD=%s;"
+  sprintf(conn, "DRIVER=%s;USER=%s;PASSWORD=%s;"
                 "DATABASE=%s;SERVER=%s;OPTION=1048576",
-          myuid, mypwd, mydb, myserver);
+          mydriver, myuid, mypwd, mydb, myserver);
 
   if (mysock != NULL)
   {
@@ -2706,9 +2706,9 @@
      Result cache is enabled. Need to check that cached results are not
      broken
   */
-  sprintf(conn,"DRIVER={MySQL ODBC 3.51 Driver};USER=%s;PASSWORD=%s;"
+  sprintf(conn,"DRIVER=%s;USER=%s;PASSWORD=%s;"
                "DATABASE=%s;SERVER=%s",
-          myuid, mypwd, mydb, myserver);
+          mydriver, myuid, mypwd, mydb, myserver);
 
   if (mysock != NULL)
   {

Modified: trunk/test/my_info.c
===================================================================
--- trunk/test/my_info.c	2007-12-27 13:19:28 UTC (rev 963)
+++ trunk/test/my_info.c	2007-12-27 19:36:57 UTC (rev 964)
@@ -211,6 +211,55 @@
 }
 
 
+/*
+   Bug 3780, reading or setting ADODB.Connection.DefaultDatabase 
+   is not supported
+*/
+DECLARE_TEST(t_bug3780)
+{
+  HDBC hdbc1;
+  HSTMT hstmt1;
+  SQLCHAR   conn[256], conn_out[256];
+  SQLSMALLINT conn_out_len;
+  SQLCHAR   rgbValue[MAX_NAME_LEN];
+  SQLSMALLINT pcbInfo;
+
+  /* The connection string must not include DATABASE. */
+  sprintf((char *)conn, "DRIVER=%s;SERVER=localhost;" \
+                        "UID=%s;PASSWORD=%s", mydriver, myuid, mypwd);
+  if (mysock != NULL)
+  {
+    strcat((char *)conn, ";SOCKET=");
+    strcat((char *)conn, (char *)mysock);
+  }
+
+  ok_env(henv, SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc1));
+
+  ok_con(hdbc1, SQLDriverConnect(hdbc1, NULL, conn, sizeof(conn), conn_out,
+                                 sizeof(conn_out), &conn_out_len,
+                                 SQL_DRIVER_NOPROMPT));
+  ok_con(hdbc1, SQLAllocStmt(hdbc1, &hstmt1));
+
+  ok_con(hdbc1, SQLGetInfo(hdbc1, SQL_DATABASE_NAME, rgbValue, 
+                           MAX_NAME_LEN, &pcbInfo));
+
+  is_num(pcbInfo, 4);
+  is_str(rgbValue, "null", pcbInfo);
+
+  ok_con(hdbc1, SQLGetConnectAttr(hdbc1, SQL_ATTR_CURRENT_CATALOG,
+                                  rgbValue, MAX_NAME_LEN, &pcbInfo));
+
+  is_num(pcbInfo, 4);
+  is_str(rgbValue, "null", pcbInfo);
+
+  ok_stmt(hstmt1, SQLFreeStmt(hstmt1, SQL_DROP));
+  ok_con(hdbc1, SQLDisconnect(hdbc1));
+  ok_con(hdbc1, SQLFreeHandle(SQL_HANDLE_DBC, hdbc1));
+
+  return OK;
+}
+
+
 BEGIN_TESTS
   ADD_TEST(sqlgetinfo)
   ADD_TEST(t_gettypeinfo)
@@ -220,6 +269,7 @@
   ADD_TEST(t_bug28657)
   ADD_TEST(t_bug14639)
   ADD_TEST(t_bug31055)
+  ADD_TEST(t_bug3780)
 END_TESTS
 
 

Modified: trunk/test/my_unixodbc.c
===================================================================
--- trunk/test/my_unixodbc.c	2007-12-27 13:19:28 UTC (rev 963)
+++ trunk/test/my_unixodbc.c	2007-12-27 19:36:57 UTC (rev 964)
@@ -122,9 +122,9 @@
     rc = SQLAllocConnect(henv1,&hdbc1);
     myenv(henv1,rc);
 
-    sprintf(conn_in,"DRIVER={MySQL ODBC 3.51 Driver};USER=%s;PASSWORD=%s;"
+    sprintf(conn_in,"DRIVER=%s;USER=%s;PASSWORD=%s;"
                     "DATABASE=%s;SERVER=%s;OPTION=3;STMT=use mysql",
-            myuid, mypwd, mydb, myserver);
+            mydriver, myuid, mypwd, mydb, myserver);
     if (mysock != NULL)
     {
       strcat(conn_in, ";SOCKET=");

Modified: trunk/test/odbctap.h
===================================================================
--- trunk/test/odbctap.h	2007-12-27 13:19:28 UTC (rev 963)
+++ trunk/test/odbctap.h	2007-12-27 19:36:57 UTC (rev 964)
@@ -67,6 +67,7 @@
 #define MAX_ROW_DATA_LEN 1000
 #define MYSQL_NAME_LEN 64
 
+SQLCHAR *mydriver= (SQLCHAR *)"{MySQL ODBC 3.51 Driver}";
 SQLCHAR *mydsn= (SQLCHAR *)"test";
 SQLCHAR *myuid= (SQLCHAR *)"root";
 SQLCHAR *mypwd= (SQLCHAR *)"";

Thread
Connector/ODBC 3.51 commit: r964 - in trunk: . driver testbdegtyariov27 Dec