You can also use
DBD::AnyData instead of
DBD::CSV and take advantage of DBD::AnyData's
in-memory tables:
use DBI;
#my $dbh = DBI->connect("DBI:CSV:f_dir=.;csv_eol=\n;") or die "Cannot
+connect: " . $DBI::errstr;
#$dbh->{'csv_tables'}->{'bt'} = { 'file' => './X_Con.csv'};
#$dbh->{'csv_tables'}->{'sec'} = { 'file' => './Y_Con.csv'};
#$dbh->{'csv_tables'}->{'stats'} = { 'file' => './Z_Con.csv'};
my $dbh = DBI->connect('dbi:AnyData(RaiseError=>1):');
$dbh->func( 'bt', 'CSV', './X_Con.csv', 'ad_import');
$dbh->func( 'sec', 'CSV', './Y_Con.csv', 'ad_import');
$dbh->func( 'stats', 'CSV', './Z_Con.csv', 'ad_import');
And rest off your code should work unchanged, and will be much faster because it's reading from RAM instead of disk.
note (see the docs) that any changes to those tables have to be explicitly written to disk if you want them saved.
For even better performance (though the above will probably be sufficient for you), see
graff's hash-it-up solution.
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.