NAME
ORDB::JSAN - An ORLite-based ORM Database API
DESCRIPTION
This module is a demonstration package for what a new SQLite index-based client might look like, or at least the ORM layer part of it.
It is implemented as a pure ORLite::Mirror class with no additional code.
METHODS
dsn
my $string = ORDB::JSAN->dsn;
The dsn
accessor returns the DBI connection string used to connect to the SQLite database as a string.
dbh
my $handle = ORDB::JSAN->dbh;
To reliably prevent potential SQLite deadlocks resulting from multiple connections in a single process, each ORLite package will only ever maintain a single connection to the database.
During a transaction, this will be the same (cached) database handle.
Although in most situations you should not need a direct DBI connection handle, the dbh
method provides a method for getting a direct connection in a way that is compatible with connection management in ORLite.
Please note that these connections should be short-lived, you should never hold onto a connection beyond your immediate scope.
The transaction system in ORLite is specifically designed so that code using the database should never have to know whether or not it is in a transation.
Because of this, you should never call the ->disconnect method on the database handles yourself, as the handle may be that of a currently running transaction.
Further, you should do your own transaction management on a handle provided by the <dbh> method.
In cases where there are extreme needs, and you absolutely have to violate these connection handling rules, you should create your own completely manual DBI->connect call to the database, using the connect string provided by the dsn
method.
The dbh
method returns a DBI::db object, or throws an exception on error.
selectall_arrayref
The selectall_arrayref
method is a direct wrapper around the equivalent DBI method, but applied to the appropriate locally-provided connection or transaction.
It takes the same parameters and has the same return values and error behaviour.
selectall_hashref
The selectall_hashref
method is a direct wrapper around the equivalent DBI method, but applied to the appropriate locally-provided connection or transaction.
It takes the same parameters and has the same return values and error behaviour.
selectcol_arrayref
The selectcol_arrayref
method is a direct wrapper around the equivalent DBI method, but applied to the appropriate locally-provided connection or transaction.
It takes the same parameters and has the same return values and error behaviour.
selectrow_array
The selectrow_array
method is a direct wrapper around the equivalent DBI method, but applied to the appropriate locally-provided connection or transaction.
It takes the same parameters and has the same return values and error behaviour.
selectrow_arrayref
The selectrow_arrayref
method is a direct wrapper around the equivalent DBI method, but applied to the appropriate locally-provided connection or transaction.
It takes the same parameters and has the same return values and error behaviour.
selectrow_hashref
The selectrow_hashref
method is a direct wrapper around the equivalent DBI method, but applied to the appropriate locally-provided connection or transaction.
It takes the same parameters and has the same return values and error behaviour.
prepare
The prepare
method is a direct wrapper around the equivalent DBI method, but applied to the appropriate locally-provided connection or transaction
It takes the same parameters and has the same return values and error behaviour.
In general though, you should try to avoid the use of your own prepared statements if possible, although this is only a recommendation and by no means prohibited.
pragma
# Get the user_version for the schema
my $version = ORDB::JSAN->pragma('user_version');
The pragma
method provides a convenient method for fetching a pragma for a datase. See the SQLite documentation for more details.
SUPPORT
ORDB::JSAN is based on ORLite 1.25.
Documentation created by ORLite::Pod 0.07.
For general support please see the support section of the main project documentation.
COPYRIGHT
Copyright 2009 Adam Kennedy.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.