mysqli fetch-fields returns blob for text
| From: | Mari Masuda | Date: | Wed, 05 Jan 2011 00:59:01 +0000 |
| Subject: | mysqli fetch-fields returns blob for text | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-310495@lists.php.net to get a copy of this message | ||
Hello,
On http://www.php.net/manual/en/mysqli.constants.php
there are some predefined constants for MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_MEDIUM_BLOB,
MYSQLI_TYPE_LONG_BLOB, and MYSQLI_TYPE_BLOB. Through some experimentation I have found that fields
in my MySQL database that are declared as 'text' in MySQL are categorized by PHP as
'blob' when I compare the above constants to the field's type using http://www.php.net/manual/en/mysqli-result.fetch-fields.php.
In the MySQL documentation http://dev.mysql.com/doc/refman/5.1/en/blob.html
in the second paragraph it states:
---
BLOB values are treated as binary strings (byte strings). They have no character set, and sorting
and comparison are based on the numeric values of the bytes in column values. TEXT values are
treated as nonbinary strings (character strings). They have a character set, and values are sorted
and compared based on the collation of the character set.
---
I was wondering if PHP's interpretation of 'text' as 'blob' could cause me
any trouble down the road and what the workarounds are, if any. Thank you.
Mari