[Tutor] Mysql BLOB strangeness?

Adam Cripps kabads at gmail.com
Sun Mar 19 09:20:09 CET 2006


On 3/18/06, Brian Gustin <brian at daviesinc.com> wrote:
> Oh. just found the original question.. :)
>
> OK perhaps this would be more helpful if you were to manually query
> mysql on command line and paste the results it outputs here.
>
> what I am betting is your method to get the data out of teh query is
> doing exactly what you tell it to.. :)
>
> but this hinges on the answer to "what is the original row of data
> returned by commandline mysql query"
>
> keep in mind Mysql returns a result set as an array (a list or
> dictionary, when it is associative, if you will)
>
> what your code is doing is taking the row (array) and appending it to an
> additional list..
>
> and where you print the whole, you are basically printing out the
> multi-dimensional array, and I am betting the *last element* returned
> non-null in the mysql query is the content field.. :)
>
> but again, it depends on what the actual content is..
>
> run these two in mysql command line:
>
> mysql> show create table report;
> mysql> select * from report limit 1;
>
> and let me know the results.. :)
>
> I doubt that blob vs. text has anything to do with this issue :)
>
> Bri!

Thanks again Bri, for both your responses.

As requested -

mysql> show create table report:
| report | CREATE TABLE `report` (
  `id` int(11) NOT NULL auto_increment,
  `title` varchar(255) default NULL,
  `content` blob,
  `author` int(10) default NULL,
  `published` varchar(10) default 'n',
  `rejected` char(1) default NULL,
  PRIMARY KEY  (`id`)
) TYPE=MyISAM |

mysql> select * from report limit 1;
+----+-------+-----------------+--------+-----------+----------+
| id | title | content         | author | published | rejected |
+----+-------+-----------------+--------+-----------+----------+
|  1 | Test  | This is a test  |      0 | n         | NULL     |
+----+-------+-----------------+--------+-----------+----------+
1 row in set (0.02 sec)
(shame this doesn't monospace in Gmail)


You are right to bet that the last non-null field (part of the array)
is the content field (select id, title, content from report)
Adam
--
http://www.monkeez.org
PGP key: 0x7111B833


More information about the Tutor mailing list