By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,760 Members | 1,585 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,760 IT Pros & Developers. It's quick & easy.

loading blobs

P: n/a
hi,

does anyone have a perl example of loading blobs from either a bin file
or an input stream?

much thanks,
peter

Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
picaza wrote:
does anyone have a perl example of loading blobs from either a bin file
or an input stream?


open(BLOB, "<blobfile.dat");
binmode(BLOB); # if necessary on your platform
my $blobData;
read(BLOB, $blobData, 1000000);
close(BLOB);

my $sth = $dbh->prepare("INSERT INTO myTable (blobField) VALUES (?)");
$sth->execute($blobData);

Error checking, reading blobs longer than 1MB, etc. is left up to you.

Regards,
Bill K.
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.