DBI, BLOBS, MySQL

Peter Corlett abuse at cabal.org.uk
Thu Jan 8 23:11:32 GMT 2009


On 8 Jan 2009, at 23:02, Christopher Jones wrote:
> I'm having issues inserting files into a BLOB field in MySQL, using  
> something similar to this;
[...]
> The problem is that files bigger than 64K are being truncated on  
> their insert into the database (i.e. the maximum BLOB length in the  
> database is 64K). The global max_allowed_packet variable is set to  
> 16776192, so that doesn't seem to be the culprit, and I don't know  
> of any other limitations in MySQL that would limit the size of the  
> insert.

That's correct. BLOBs are binary TEXT fields, and both have a limit of  
64kB. You want a MEDIUMBLOB or LONGBLOB instead, which have 16MB and  
4TB limits respectively.

(Ah, the rusty razor blade that is MySQL claims another victim.)




More information about the london.pm mailing list