App-Repository
view release on metacpan or search on metacpan
lib/App/Repository/DBI.pm view on Meta::CPAN
######################################################################
## File: $Id: DBI.pm 10837 2008-02-26 17:31:14Z spadkins $
######################################################################
use App;
use App::Repository;
package App::Repository::DBI;
$VERSION = (q$Revision: 10837 $ =~ /(\d[\d\.]*)/)[0]; # VERSION numbers generated by svn
@ISA = ( "App::Repository" );
use Data::Dumper;
use strict;
=head1 NAME
App::Repository::DBI - a repository which relies on a DBI interface to a relational database (no caching)
=head1 SYNOPSIS
use App::Repository::DBI;
(see man page for App::Repository for additional methods)
$rep = App::Repository::DBI->new(); # looks for %ENV, then config file
$rep = App::Repository::DBI->new("mysql","mydb","user001","pass001");
$rep = App::Repository::DBI->new("mysql","mydb","user001","pass001","port=3307");
$rep = App::Repository::DBI->new("mysql","mydb","user001","pass001","port=3307","user001");
$ok = $rep->_connect(); # initialize repository (will happen automatically in constructor)
$ok = $rep->_disconnect(); # cleanup repository (will happen automatically in destructor)
$rep->_is_connected(); # returns 1 if connected (ready for use), 0 if not
$errmsg = $rep->error(); # returns the error string for prev op ("" if no error)
$numrows = $rep->numrows(); # returns the number of rows affected by prev op
print $rep->error(), "\n" if (!$rep->_connect());
$value = $rep->get ($table, $key, $col, \%options);
$value = $rep->get ($table, \%params, $col, \%options);
@row = $rep->get ($table, $key, \@cols, \%options);
@row = $rep->get ($table, \%params, \@cols, \%options);
$nrows = $rep->set($table, $key, $col, $value, \%options);
$nrows = $rep->set($table, \%params, $col, $value, \%options);
$row = $rep->get_row ($table, $key, \@cols, \%options);
$row = $rep->get_row ($table, \%params, \@cols, \%options);
$nrows = $rep->set_row($table, $key, \@cols, $row, \%options);
$nrows = $rep->set_row($table, \%params, \@cols, $row, \%options);
$nrows = $rep->set_row($table, undef, \@cols, $row, \%options);
$colvalues = $rep->get_column ($table, \%params, $col, \%options);
$rows = $rep->get_rows ($table, \%params, \@cols, \%options);
$rows = $rep->get_rows ($table, \%params, $col, \%options);
$rows = $rep->get_rows ($table, \@keys, \@cols, \%options);
$nrows = $rep->set_rows($table, \%params, \@cols, $rows, \%options);
$nrows = $rep->set_rows($table, undef, \@cols, $rows, \%options);
$nrows = $rep->set_rows($table, \@keys, \@cols, $rows, \%options);
$values = $rep->get_values ($table, $key, \@cols, \%options);
$values = $rep->get_values ($table, \%params, \@cols, \%options);
$values = $rep->get_values ($table, $key, undef, \%options);
$values = $rep->get_values ($table, \%params, undef, \%options);
$values_list = $rep->get_values_list ($table, $key, \@cols, \%options);
$values_list = $rep->get_values_list ($table, \%params, \@cols, \%options);
$values_list = $rep->get_values_list ($table, $key, undef, \%options);
$values_list = $rep->get_values_list ($table, \%params, undef, \%options);
$nrows = $rep->set_values ($table, $key, \@cols, $values, \%options);
$nrows = $rep->set_values ($table, $key, undef, $values, \%options);
$nrows = $rep->set_values ($table, undef, \@cols, $values, \%options);
$nrows = $rep->set_values ($table, undef, undef, $values, \%options);
$nrows = $rep->set_values ($table, \%params, \@cols, $values, \%options);
$nrows = $rep->set_values ($table, \%params, undef, $values, \%options);
=cut
######################################################################
# ATTRIBUTES
######################################################################
# CONNECTION ATTRIBUTES
( run in 0.463 second using v1.01-cache-2.11-cpan-39bf76dae61 )