Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Adding a JPEG file to database

by chrestomanci (Priest)
on Feb 21, 2011 at 20:26 UTC ( [id://889488]=note: print w/replies, xml ) Need Help??


in reply to Adding a JPEG file to database

Eliya ++

Good point about binding parameters, and specifying their types.

The other thing that occurs to me is that one call to read is not guaranteed to read the whole file. My understanding is that do to that you have to call read (or sysread) repeatedly until it returns zero. eg:

open(BLOB, $blob_file) ||die "Cannot open the blob file\n"; binmode BLOB; my $bytes = 0; my $offset = 0; my $buf; while( $bytes != 0 ) { $bytes = read(BLOB, $buf, 500000, $offset); die "Error reading $blob_file $!" unless defined $bytes } close BLOB; # $buf now contains all the bytes from $blob_file

See read on perldoc

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://889488]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-23 19:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found