Mimi Cafe wrote:

Anyone worked on a project where they have stored pictures in MySQL db from
Perl program?  I need to store pictures in MYSQL and my initial thought was
a normal insert statement. Now I did a bit of search and people are making
it completed out there. I have not tried it, but I was thinking of grabbing
my picture and inserting into the table using a normal SQL insert like:

 $dbh->do(qq{insert into mytable (id, pic) values(1,$pic_file_name)});


Any experience on this?

This is not clear: do you want to store the contents, or the (complete?) file name?

The BIGBLOB type is fine for storing contents. These values are stored outside the row data space, so need extra IO, and that is good.
You can process the blob in chunks to limit overhead.

To store the filename, use a VARCHAR(1000) with the proper CHARSET.

--
Ruud

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to