SPOPS::SQLInterface is a Perl module with generic routines for DBI database interaction.
SYNOPSIS
# Make this class a parent of my class
package My::DBIStuff;
use SPOPS::SQLInterface;
@My::DBIStuff::ISA = qw( SPOPS::SQLInterface );
# You should also be able to use it directly, but you
# need to pass in a database object with every request
use SPOPS::SQLInterface;
my $dbc = 'SPOPS::SQLInterface';
my $db = DBI->connect( ... ) || die $DBI::errstr;
my $rows = $dbc->db_select({ select => [ qw/ uid first_name last_name / ],
from => [ 'users' ],
where => 'first_name = ? or last_name = ?',
value => [ 'fozzie', "th' bear" ],
db => $db });
foreach my $row ( @{ $results } ) {
print "User ID $row->[0] is $row->[1] $row->[2]n";
}
You are meant to inherit from this class, although you can use it as a standalone SQL abstraction tool as well, as long as you pass the database handle into every routine you call.
Product's homepage
Requirements:
· Perl