Click to See Complete Forum and Search --> : MySQL LONGTEXT shows as BLOB


PeejAvery
May 30th, 2006, 10:30 PM
Does anyone know why my MySQL shows a field that I have set to LONGTEXT as a BLOB? Check out the screenshots to understand. Notice the message field.

ovidiucucu
June 3rd, 2006, 05:57 AM
First note that BLOB and TEXT MySQl types are quite similar.
See The BLOB and TEXT Types (http://dev.mysql.com/doc/refman/4.1/en/blob.html).

However if you are concerned why an UI MySQL client (you didn't specify which one) reports "BLOB" instead "TEXT", what to do else better than ask the manufacurer?

ovidiucucu
June 3rd, 2006, 06:11 AM
...and one advice.
If the "message" field is intended for a text message as its name suggested, use VARCHAR type instead.
Just note the VARCHAR lenght limit:

255 - before MySQL version 5.0.3
65,535 - MySQL version 5.0.3 and newer

See The CHAR and VARCHAR Types (http://dev.mysql.com/doc/refman/5.0/en/char.html)

PeejAvery
June 3rd, 2006, 04:54 PM
No. I need a LONGTEXT. The message will end up being a character limit of 2000.

ovidiucucu
June 4th, 2006, 07:49 AM
Well, then install MySQL version 5.0.3 or newer and you'll have a limit of about 65535 for VARCHAR, much more than enough.

Or, keep the LONGTEXT type and do not care anymore about that "bad reporting" of that UI client. Although, my first proposal can avoid further headaches of BLOB fields (I already said, TEXT is quite similar with BLOB in MySQL). Use BLOBs only for really large amount of data like for example images.

PeejAvery
June 4th, 2006, 05:30 PM
Well, my app is going to be on a webserver that I have no control over what version of MySQL it runs.

Basically, it is just an annoyance because I would like to see the text rather than "Blob - 99bytes."

Oh well, life goes on.

PeejAvery
June 4th, 2006, 11:01 PM
I upgraded to the lastest version of PHPMyAdmin and that changed it. Perhaps there was just a glitch in the older version I was running.