Will this mechanism for differentiating between TEXT and BLOB work in MySQL 3.23?

On 25-Jun-07, at 9:49 PM, Kevin Waterson wrote:

currently pdo_mysql is unable to discern between a BLOB and a TEXT field
in mysql_statement.c
By using the current if (IS_BLOB(F->flags)), which is now deprecated in
the mysql c api, it will be true for both TEXT and BLOB fields.

By updating a little to the newer api and checking with F->type we get
the same result, however, further checking on the character set number
can distinguish between BINARY and CHAR, VARBINARY and VARCHAR, and BLOB
and TEXT fields.

When using PDOStatement::getColumnMeta() any field with charsetnr of 63
reports as text, rather than blob. Patch follows...

--- old.c       2007-06-26 11:27:57.000000000 +1000
+++ mysql_statement.c   2007-06-26 11:26:47.000000000 +1000
@@ -581,8 +581,12 @@
        if (F->flags & UNIQUE_KEY_FLAG) {
                add_next_index_string(flags, "unique_key", 1);
        }
-       if (IS_BLOB(F->flags)) {
-               add_next_index_string(flags, "blob", 1);
+       if(F->type == MYSQL_TYPE_BLOB)  {
+               if(F->charsetnr == 63) {
+                       add_next_index_string(flags, "blob", 1);
+               } else {
+                       add_next_index_string(flags, "text", 1);
+               }
        }
        str = type_to_name_native(F->type);
        if (str) {




--
"Democracy is two wolves and a lamb voting on what to have for lunch.
Liberty is a well-armed lamb contesting the vote."

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


Ilia Alshanetsky

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to