Are you looking for a way to shorten the method to get your result out of the query? Like a way to replace execute, prepare, fetch?
If so, check out CPAN on DBI:
http://search.cpan.org/~timb/DBI-1.615/DBI.pm
Here are some my favorites... For one row of results I usually like to use:
my ($col1, $col2, $col3) = $dbh->selectrow_array($query);
For multiple rows I like the array ref methods. Here is one right from CPAN (http://search.cpan.org/~timb/DBI-1.615/DBI.pm#selectall_arrayref)
my $emps = $dbh->selectall_arrayref( "SELECT ename FROM emp ORDER BY ename", { Slice => {} } );
To then access your result you can use this loop
foreach my $emp ( @$emps ) { print "Employee: $emp->{ename}\n"; }
There is a lot of information on DBI in CPAN.
Dawn
In reply to Re^3: basic dbi question
by wallisds
in thread basic dbi question
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |