List:Commits« Previous MessageNext Message »
From:bdegtyariov Date:February 7 2008 6:54pm
Subject:Connector/ODBC 3.51 commit: r1021 - in trunk: . driver test
View as plain text  
Modified:
   trunk/ChangeLog
   trunk/driver/utility.c
   trunk/test/my_catalog.c
Log:
ADO failed to retrieve the length of LONGBLOB columns. (Bug #12805)

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-02-07 07:04:53 UTC (rev 1020)
+++ trunk/ChangeLog	2008-02-07 18:54:26 UTC (rev 1021)
@@ -5,6 +5,7 @@
   Bugs fixed:
   * Static cursor was unable to be used through ADO when dynamic cursors
     were enabled. (Bug #27351)
+  * ADO failed to retrieve the length of LONGBLOB columns. (Bug #12805)
 
 ----
 

Modified: trunk/driver/utility.c
===================================================================
--- trunk/driver/utility.c	2008-02-07 07:04:53 UTC (rev 1020)
+++ trunk/driver/utility.c	2008-02-07 18:54:26 UTC (rev 1021)
@@ -571,7 +571,7 @@
 
   @return  The column size of the field
 */
-SQLLEN get_column_size(STMT *stmt __attribute__((unused)), MYSQL_FIELD *field,
+SQLLEN get_column_size(STMT *stmt, MYSQL_FIELD *field,
                        my_bool actual)
 {
   CHARSET_INFO *charset= get_charset(field->charsetnr, MYF(0));
@@ -643,7 +643,8 @@
   case MYSQL_TYPE_BLOB:
   case MYSQL_TYPE_GEOMETRY:
     if (field->charsetnr == 63)
-      return length;
+      return (stmt->dbc->flag && FLAG_COLUMN_SIZE_S32) ?
+              (length > INT_MAX32 ? INT_MAX32 : length) : length;
     else
       return length / mbmaxlen;
   }

Modified: trunk/test/my_catalog.c
===================================================================
--- trunk/test/my_catalog.c	2008-02-07 07:04:53 UTC (rev 1020)
+++ trunk/test/my_catalog.c	2008-02-07 18:54:26 UTC (rev 1021)
@@ -1129,6 +1129,55 @@
 }
 
 
+/**
+ Bug #12805: ADO failed to retrieve the length of LONGBLOB columns
+*/
+DECLARE_TEST(t_bug12805)
+{
+  SQLHENV    henv1;
+  SQLHDBC    hdbc1;
+  SQLHSTMT   hstmt1;
+  SQLULEN    length;  
+
+  SET_DSN_OPTION(1 << 27);
+
+  alloc_basic_handles(&henv1, &hdbc1, &hstmt1);
+
+  ok_sql(hstmt1, "DROP TABLE IF EXISTS bug12805");
+  ok_sql(hstmt1, "CREATE TABLE bug12805("\
+                 "id INT PRIMARY KEY auto_increment,"\
+                 "longimagedata LONGBLOB NULL)");
+
+  ok_stmt(hstmt1, SQLColumns(hstmt1, NULL, 0, NULL, 0,
+                             (SQLCHAR *)"bug12805", SQL_NTS,
+                             (SQLCHAR *)"longimagedata", SQL_NTS));
+
+  ok_stmt(hstmt1, SQLFetch(hstmt1));
+  ok_stmt(hstmt1, SQLGetData(hstmt1, 7, SQL_C_ULONG, &length,
+                             sizeof(SQLULEN), NULL));
+  is_num(length, 2147483647);
+  ok_stmt(hstmt1, SQLFreeStmt(hstmt1, SQL_CLOSE));
+
+  ok_con(hdbc1, SQLDisconnect(hdbc1));
+  ok_con(hdbc1, SQLFreeConnect(hdbc1));
+
+  /* Check without the 32-bit signed flag */
+  ok_stmt(hstmt, SQLColumns(hstmt, NULL, 0, NULL, 0,
+                            (SQLCHAR *)"bug12805", SQL_NTS,
+                            (SQLCHAR *)"longimagedata", SQL_NTS));
+
+  ok_stmt(hstmt, SQLFetch(hstmt));
+  ok_stmt(hstmt, SQLGetData(hstmt, 7, SQL_C_ULONG, &length,
+                             sizeof(SQLULEN), NULL));
+  is_num(length, 4294967295);
+
+  ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_CLOSE));
+  ok_sql(hstmt, "DROP TABLE bug12805");
+
+  return OK;
+}
+
+
 BEGIN_TESTS
   ADD_TEST(my_columns_null)
   ADD_TEST(my_drop_table)

Thread
Connector/ODBC 3.51 commit: r1021 - in trunk: . driver testbdegtyariov7 Feb