Reputation: 1957
I'm struggling several hours on this issue.
I have a long string. The value is base64_encoded json data. When I'm doing var_dump or saving the string to MySQL it gets cut off. But it saves correctly to file.
This is the output saved to file. (correct) http://pastebin.com/Brr9a271
This is the data saved to MySQL blob field. (cutted). Same appears when I do var_dump http://pastebin.com/u1xNAnUb
What am I missing? Can this be a PHP bug?
Upvotes: 2
Views: 3661
Reputation: 4017
For storing a base64 encoded data change your datatype in the MYSQL table to LONGTEXT.
Have a look !!!
TINYTEXT - 255 bytes
TEXT - 65535 bytes
MEDIUMTEXT - 16,777,215 bytes (2^24 - 1)
LONGTEXT - 4G bytes (2^32 – 1)
TINYBLOB - 255 bytes
BLOB - 65535 bytes
MEDIUMBLOB - 16,777,215 bytes (2^24 - 1)
LONGBLOB - 4G bytes (2^32 – 1)
Upvotes: 0
Reputation: 3549
Your file has about 86KiB, but a BLOB column with a maximum length of 65,535.
Use MEDIUMBLOB.
From the documentation :
Type | Maximum length -----------+------------------------------------- TINYBLOB | 255 (2 8−1) bytes BLOB | 65,535 (216−1) bytes = 64 KiB MEDIUMBLOB | 16,777,215 (224−1) bytes = 16 MiB LONGBLOB | 4,294,967,295 (232−1) bytes = 4 GiB
Upvotes: 3
Reputation: 18550
Your using char (or var char) juding by the length (size: 64.00 KB )
http://dev.mysql.com/doc/refman/5.0/en/char.html
try using text or blob
http://dev.mysql.com/doc/refman/5.0/en/blob.html
Upvotes: 0