List:Commits« Previous MessageNext Message »
From:bdegtyariov Date:November 30 2006 7:12pm
Subject:Connector/ODBC 3.51 commit: r140 - trunk/myodbc3
View as plain text  
Modified:
   trunk/myodbc3/utility.c
Log:
Fixes the length of field when using functions such as COMPRESS()

Modified: trunk/myodbc3/utility.c
===================================================================
--- trunk/myodbc3/utility.c	2006-11-30 16:46:26 UTC (rev 139)
+++ trunk/myodbc3/utility.c	2006-11-30 18:12:02 UTC (rev 140)
@@ -550,20 +550,35 @@
             return SQL_CHAR;
 
         case FIELD_TYPE_VAR_STRING:
-            *transfer_length= *precision= *display_size= field->length ? 
+            
+            if(field->table && field->org_table &&
field->table[0] && field->org_table[0])
+            {
+                *transfer_length= *precision= *display_size= field->length ? 
                 (stmt->dbc->mysql.charset ? 
                 field->length/stmt->dbc->mysql.charset->mbmaxlen:
field->length): 255;
 
-            /* Binary flag is for handling "VARCHAR() BINARY" but is unreliable (see
BUG-4578) - PAH */
-            if (field_is_binary)
+                /* Binary flag is for handling "VARCHAR() BINARY" but is unreliable (see
BUG-4578) - PAH */
+                if (field_is_binary)
+                {
+                    if (buff) strmov(buff,"varbinary");
+                        return SQL_VARBINARY;
+                }
+                if ( buff ) strmov(buff,"varchar");
+                    return SQL_VARCHAR;
+            }
+            else
             {
-              if (buff) strmov(buff,"varbinary");
-              return SQL_VARBINARY;
+                *transfer_length= *precision= *display_size= 16777216L;
+                if (field_is_binary)
+                {
+                    if (buff) strmov(buff,"varbinary");
+                    return SQL_LONGVARBINARY;
+                }
+
+                if ( buff ) strmov(buff,"varchar");
+                    return SQL_LONGVARCHAR;
             }
 
-            if ( buff ) strmov(buff,"varchar");
-            return SQL_VARCHAR;
-
         case FIELD_TYPE_TINY_BLOB:
             if ( buff )
                 strmov(buff,(field_is_binary) ? "tinyblob" : "tinytext");

Thread
Connector/ODBC 3.51 commit: r140 - trunk/myodbc3bdegtyariov30 Nov