BLOB inserts are preatty much same as LONG, needs to be binded, using
either bind_param() or as an argument in execute. Use prepare and
execute rather then do() in this case. When retrieving the BLOB you
must set you LongReadLen => 2000000 but substitute the 2000000 with the
length of you image, if not known you can estimate the longest possible
and use that. Also set LongTruncOk in case the image is larger, but it
will corrupt the image file if it is truncated. You would use CGI.pm
module to retrieve the data from directory in chunks and then insert in
db, same you would use to display the data with the right Content-type
http header to display the image after retrival. If you DBD::Oracle was
compiled using OCI 8 then you can freely set you LongReadLen to the
images size or higher, but if it was compiled with OCI 7 then the
longest LongReadLen will be 65535, so you must use blobread or read_blob
to fetch in chunks. A good example of this is in your DBD::Oracle
package in the file README.longs
Ilya Sterin
-----Original Message-----
From: surfer girl
To: [EMAIL PROTECTED]
Sent: 01/25/2001 12:14 AM
Subject: BLOB: CGI->DBI->Oracle
Hi all,
I have gone through numerous list archives, tons of docs, a zillion
websites it seems, and I have yet to find a simple example of the
following: uploading and inserting a binary file (such as an image) into
the BLOB field of an Oracle database (v.8) using Perl DBI and CGI.pm.
Then selecting it and displaying it once it's in there!
In other words, I've got an image file I want to upload through a
browser and insert into the database.
The part which is particularly confusing to me is the BLOB insert...much
of the documentation found discusses the old LONGS format, which current
Oracle documentation discourages use of because BLOBs/CLOBs are
apparently better!
Inserting/Selecting a CLOB seems easy enough (seemed to work just the
same as a regular field)...but I'm not sure about a binary file.
Particularly, I've seen a lot on bind/param blah blah, file handles,
buffers, etc., and I guess I am looking for the Idiot's Guide to Binary
File Handling in Perl, DBI and CGI.
A simple explanation with *clear* example would be greatly appreciated.
I know I must not be the only one...guessing from confused posts here in
the past.
At this point I am starting to wonder if it's not just easier to put the
images into regular files and have the database point to a filename...
Thanks in advance,
Your Humble DBI Idiot
_____________________________________________________________
Get It Gear --> http://www.getitgear.com
------------------------------------------------------------------------
------
DBI HOME PAGE AND ARCHIVES:
http://www.symbolstone.org/technology/perl/DBI/
To unsubscribe from this list, please visit:
http://www.isc.org/dbi-lists.html
If you are without web access, or if you are having trouble with the web
page,
please send mail to [EMAIL PROTECTED] with the subject line of:
'unsubscribe'.
------------------------------------------------------------------------
------