Modified:
trunk/driver/utility.c
Log:
Fixed issue with SQLTables for bug #20208
Modified: trunk/driver/utility.c
===================================================================
--- trunk/driver/utility.c 2007-03-02 23:14:38 UTC (rev 229)
+++ trunk/driver/utility.c 2007-03-06 13:22:46 UTC (rev 230)
@@ -550,35 +550,50 @@
return SQL_CHAR;
case FIELD_TYPE_VAR_STRING:
-
- if(field->table && field->org_table &&
field->table[0] && field->org_table[0])
+ /*
+ If we have both the table name and the original table name, we
+ can trust the length information in the field. Unless there
+ isn't any, then we assume a length of 255 characters.
+ */
+ 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)
- {
- if (buff) strmov(buff,"varbinary");
- return SQL_VARBINARY;
- }
- if ( buff ) strmov(buff,"varchar");
- return SQL_VARCHAR;
+ *transfer_length= *precision= *display_size= field->length ?
+ (stmt->dbc->mysql.charset ?
+ field->length / stmt->dbc->mysql.charset->mbmaxlen :
+ field->length) : 255;
}
- else
+ /*
+ Otherwise, if it is not already set, we set it to
+ the size of a MEDIUMTEXT/BLOB.
+ */
+ else if (field->org_table && !field->org_table[0])
{
- *transfer_length= *precision= *display_size= 16777216L;
- if (field_is_binary)
- {
- if (buff) strmov(buff,"varbinary");
- return SQL_LONGVARBINARY;
- }
+ *transfer_length= *precision= *display_size= 16777216L;
+ if (field_is_binary)
+ {
+ if (buff)
+ strmov(buff,"blob");
+ return SQL_LONGVARBINARY;
+ }
- if ( buff ) strmov(buff,"varchar");
- return SQL_LONGVARCHAR;
+ if (buff)
+ strmov(buff,"text");
+ return SQL_LONGVARCHAR;
}
+ if (field_is_binary)
+ {
+ if (buff)
+ strmov(buff,"varbinary");
+ return SQL_VARBINARY;
+ }
+
+ 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: r230 - trunk/driver | bdegtyariov | 6 Mar |