Corrupted images after attempting to store PNG images as BLOBs in MySQL?

Keith Hughitt keith.hughitt at gmail.com
Wed Aug 13 16:54:52 CEST 2008


Thanks Fredrik.

That certainly explains things :) I also appreciate the suggestion on
coding guidelines: I'm
still becoming familiar with python. Originally we were not using the
database to store images,
but we started testing out storing images there as well as meta-data.
We may end up switching back
though for efficiency. For now though I think I will try mediumblob to
at least see if I can fix
the problem as things are.

Thanks and take care!
Keith

On Aug 13, 10:46 am, Fredrik Lundh <fred... at pythonware.com> wrote:
> Fredrik Lundh wrote:
> > Silently truncating or otherwise mangling columns is a standard MySQL
> > feature.  What does the table definition look like?
>
> Oh, you did write BLOB in the subject.  BLOB columns hold 64k (minus 2
> bytes for housekeeping), and excess data is discarded, by default:
>
> "If strict SQL mode is not enabled and you assign a value to a BLOB or
> TEXT column that exceeds the column's maximum length, the value is
> truncated to fit and a warning is generated."
>
> http://dev.mysql.com/doc/refman/5.0/en/blob.html
>
> Are you sure you *need* to use MySQL ;-)
>
> </F>




More information about the Python-list mailing list