Front page | perl.books.workers |
Postings from August 2002
Re: blobs
Thread Previous
|
Thread Next
From:
Uri Guttman
Date:
August 28, 2002 20:40
Subject:
Re: blobs
Message ID:
x7wuqaz622.fsf@mail.sysarch.com
>>>>> "IT" == Iain Truskett <perl@dellah.anu.edu.au> 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 ------ uri@stemsystems.com -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
Thread Previous
|
Thread Next