Re: blobs
[email protected] (Uri Guttman) 28 Aug 2002 23:40:05 -0400
| Newsgroups | perl.books.workers |
|---|---|
| Message-ID | <[email protected]> |
>>>>> "IT" == Iain Truskett <[email protected]> writes: IT> How does one actually go about inserting and retrieving binary data from IT> a database? IT> { IT> my $sth = $dbh->prepare('insert into covers (isbn,small) values (?,?)'); IT> $sth->execute($isbn, $imagedata); IT> } IT> Because that's not working for me. no, you must convert it first to a string by using storable (freeze method) or some other module. then you can insert it into a long field of type BLOB. when you read it from the DB you do the conversion from text to binary (thaw method) and assign it to your variable. make this image access a cgi/url for the IMG tag and it should work fine. uri -- Uri Guttman ------ [email protected] -------- http://www.stemsystems.com ----- Stem and Perl Development, Systems Architecture, Design and Coding ---- Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org