NAME
EntityModel::DB - database management
VERSION
version 0.003
SYNOPSIS
my $db = EntityModel::DB->new;
$db->transaction(sub {
});
DESCRIPTION
Manages database connections and transactions.
new
Create a new EntityModel::DB object.
Does not attempt to connect any database handles, but prepares the context ready for the first request.
dbh
Returns a database handle.
Can only be called within a transaction.
dsn
Data Source string used for connecting to the database.
Currently hardcodes the dbi:Pg: prefix.
transaction
Call code within a transaction.
Note that this does not map exactly onto a single database transaction. Nested transactions are supported, using savepoints, and a transaction may cover several active database handles.
update
Update information
select
Run a select query against the database and return the results as an orderly hash.
select_iterator
Run a select query against the database and return the results as an orderly hash.
active_db
Returns the currently active database handle.
INTERNAL METHODS
_run_query
Run the given query.
_fork_guard
Internal method used to check whether we've forked recently and if so reset the internal state so that we don't try to reuse existing handles.
AUTHOR
Tom Molesworth <cpan@entitymodel.com>
LICENSE
Copyright Tom Molesworth 2008-2011. Licensed under the same terms as Perl itself.