I use the LOB data type for storing/retrieving binary files to/from a table - but apparently the size is very small, i.e. ~2Kb as the file is just a one page Xerox metacode file.
The reason I do this because the physical files are archived in daily basis but we still need to have the file quickly on-the-fly for a period of a month - so having the binary in a database is one option. However I believe storing 120Mb of text into a table is bizarre, if I can't say odd :-)
Btw, here is a snippet of the code:
* On inserting
use DBD::Oracle qw(:ora_types);
__PACKAGE__->data_type(cr_data => DBI::SQL_BINARY);
__PACKAGE__->data_type(cr_data => { ora_type => ORA_BLOB,
ora_field => 'column_name' } );
....
* On retrieving:
# Modify DBH LongReadLen for long binary object...
my $dbh = __PACKAGE__->db_Main();
my $current_LongReadLen = $dbh->{LongReadLen};
# need to dynamically set to the length of your record
# it's hardcoded to 512Kb for example...
$dbh->{LongReadLen} = 512 * 1024;
...
Please refer to the Class::DBI wiki as it has a really good explanation on the subject.
Cheers!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.