DBIx::StORM

Summary
DBIx::StORM
DBIx::StORMA StORM class representing a database connection.
Variables
$VERSION (public static)The version of this package.
$DEBUG (public static)Causes DBIx::StORM to emit debug messages if set to a true value.
Functions
connect (public static)Create a new DBIx::StORM object and open a connection to the database using DBI.
connect_cached (public static)Create a new DBIx::StORM object using connection to the database using DBI.
_wrap_handle (private static)Create a new DBIx::StORM object from an existing DBI handle.
Variables
$drivername
Functions
inflater (public instance)Add an inflater to the inflation chain for this connection.
_inflaters (private instance)Returns all the inflaters registered on this connection.
get (public instance)Fetch a table object using this database connection.
_as_tied_hash (private instance)Fetch a tied hash map of table name to DBIx::StORM::Table objects.
dbi (public instance)Fetch the underlying DBI database handle.
add_hint (public instance)Add a hint to the key parsing system.
_debug (private static/instance)Write a debugging message to STDERR if the debug level is high enough to warrant showing this message.
_sqldriver (private instance)Fetch the database driver used to perform database-specific functions and optimisations for this connection.
TIEHASH (private static)Create a new tied hash of StORM Table objects available on this handle.
FETCH (private instance)Fetch a table object for a particular table in the hash
EXISTS (private instance)Check for the existence of a table on a particular connection.
FIRSTKEY (private instance)Reset the iterator and return the first hash object.
NEXTKEY (private instance)Return the next table from the iterator.
SCALAR (private instance)Return the number of tables available on the connection.

DBIx::StORM

A StORM class representing a database connection.

This is essentially a wrapper for a DBI connection.  This object can be dereferenced as a hash, with the keys of the hash being the table names present in this database and the values being DBIx::StORM::Table objects.

=end NaturalDocs

Summary
Variables
$VERSION (public static)The version of this package.
$DEBUG (public static)Causes DBIx::StORM to emit debug messages if set to a true value.
Functions
connect (public static)Create a new DBIx::StORM object and open a connection to the database using DBI.
connect_cached (public static)Create a new DBIx::StORM object using connection to the database using DBI.
_wrap_handle (private static)Create a new DBIx::StORM object from an existing DBI handle.
Variables
$drivername
Functions
inflater (public instance)Add an inflater to the inflation chain for this connection.
_inflaters (private instance)Returns all the inflaters registered on this connection.
get (public instance)Fetch a table object using this database connection.
_as_tied_hash (private instance)Fetch a tied hash map of table name to DBIx::StORM::Table objects.
dbi (public instance)Fetch the underlying DBI database handle.
add_hint (public instance)Add a hint to the key parsing system.
_debug (private static/instance)Write a debugging message to STDERR if the debug level is high enough to warrant showing this message.
_sqldriver (private instance)Fetch the database driver used to perform database-specific functions and optimisations for this connection.
TIEHASH (private static)Create a new tied hash of StORM Table objects available on this handle.
FETCH (private instance)Fetch a table object for a particular table in the hash
EXISTS (private instance)Check for the existence of a table on a particular connection.
FIRSTKEY (private instance)Reset the iterator and return the first hash object.
NEXTKEY (private instance)Return the next table from the iterator.
SCALAR (private instance)Return the number of tables available on the connection.

Variables

$VERSION (public static)

our $VERSION

The version of this package.

=end NaturalDocs

$DEBUG (public static)

our $DEBUG

Causes DBIx::StORM to emit debug messages if set to a true value.  These are different from warnings which can be enabled/disabled using the warnings pragma.

=end NaturalDocs

Functions

connect (public static)

sub connect

Create a new DBIx::StORM object and open a connection to the database using DBI.  All of the parameters are passed to DBI untouched.

Parameters

String $dsnThe DBI DSN string or a DBI::db object
String $userDatabase username (if $dsn is a string)
String $passwordDatabase password (if $dsn is a string)

Returns

ObjectA new DBIx::StORM object

=end NaturalDocs

connect_cached (public static)

sub connect_cached

Create a new DBIx::StORM object using connection to the database using DBI.  If there is already an open connection to the database requested then it will be reused, otherwise a new connection will be established.  All of the parameters are passed to DBI untouched.

Parameters

String $dsnThe DBI DSN string or a DBI::db object
String $userDatabase username (if $dsn is a string)
String $passwordDatabase password (if $dsn is a string)

Returns

ObjectA new DBIx::StORM object

=end NaturalDocs

_wrap_handle (private static)

sub _wrap_handle

Create a new DBIx::StORM object from an existing DBI handle.

This is used by the constructors connect() and connect_cached() to make a fully-fledged StORM handle.

Parameters

Object $dbiAn instance of DBI::dbh to wrap

Returns

ObjectA new DBIx::StORM object, using $dbi for database access

=end NaturalDocs

Variables

$drivername

my $drivername

Functions

inflater (public instance)

sub inflater

Add an inflater to the inflation chain for this connection.  The inflater should be a subclass a DBIx::StORM::Inflater.

Parameters

Object $infThe inflater object

Returns

Nothing

=end NaturalDocs

_inflaters (private instance)

sub _inflaters

Returns all the inflaters registered on this connection.

Parameters

None

Returns

ListList of DBIx::StORM::Inflater objects

=end NaturalDocs

get (public instance)

sub get

Fetch a table object using this database connection.

Parameters

String $table_nameThe name of the table to open
Boolean $skip_verifyWhether to skip checking for table existence

Returns

ObjectA table object of class DBIx::StORM::Table

=end NaturalDocs

_as_tied_hash (private instance)

sub _as_tied_hash

Fetch a tied hash map of table name to DBIx::StORM::Table objects.

Parameters

None

Returns

HashA map of string table names to DBIx::StORM::Table objects.  This is a tied hash of class DBIx::StORM and uses lazy lookup.

=end NaturalDocs

dbi (public instance)

sub dbi

Fetch the underlying DBI database handle.

Parameters

None

Returns

ObjectA scalar database handle of class DBI::db

=end NaturalDocs

add_hint (public instance)

sub add_hint

Add a hint to the key parsing system.

The following hints are supported by all systems

  • primary_key => “tableName->fieldName”
  • foreign_key => { “fromTable->field” => “toTable->field” }

Parameters

String $hint_typea string describing the type of hint
String $hint_valuethe hint itself.  The format depends on the <$hint_type>

Returns

Nothing

=end NaturalDocs

_debug (private static/instance)

sub _debug

Write a debugging message to STDERR if the debug level is high enough to warrant showing this message.

Parameters

Integer $levelan integer showing the level of this message.  A higher number means the message is less likely to be shown
List @messagesThe message string(s) to be written to STDERR

Returns

Nothing

=end NaturalDocs

_sqldriver (private instance)

sub _sqldriver

Fetch the database driver used to perform database-specific functions and optimisations for this connection.  This is used internally for other objects to be able to directly invoke database calls.

Parameters

None

Returns

Objectan instance of DBIx::StORM::SQLDriver

=end NaturalDocs

TIEHASH (private static)

sub TIEHASH

Create a new tied hash of StORM Table objects available on this handle.

Parameters

Object $stormThe DBIx::StORM connection object

Returns

Object$storm, which will be used as the underlying object for the tie.

=end NaturalDocs

FETCH (private instance)

sub FETCH

Fetch a table object for a particular table in the hash

Parameters

String $indexThe name of the table to fetch a table object for

Returns

ObjectTable object of type DBIx::StORM::Table

=end NaturalDocs

EXISTS (private instance)

sub EXISTS

Check for the existence of a table on a particular connection.

Parameters

String $indexThe name of the table to check

Returns

BooleanWhether the table exists

=end NaturalDocs

FIRSTKEY (private instance)

sub FIRSTKEY

Reset the iterator and return the first hash object.

The tables are returned in a random order.

Parameters

None

Returns

Stringthe table name
ObjectTable as a DBIx::StORM::Table (list context only)

=end NaturalDocs

NEXTKEY (private instance)

sub NEXTKEY

Return the next table from the iterator.

The tables are returned in a random order.

Parameters

None

Returns

Stringthe table name
ObjectTable as a DBIx::StORM::Table (list context only)

=end NaturalDocs

SCALAR (private instance)

sub SCALAR

Return the number of tables available on the connection.

Parameters

None

Returns

Integerthe number of tables available

=end NaturalDocs

our $VERSION
The version of this package.
our $DEBUG
Causes DBIx::StORM to emit debug messages if set to a true value.
sub connect
Create a new DBIx::StORM object and open a connection to the database using DBI.
sub connect_cached
Create a new DBIx::StORM object using connection to the database using DBI.
sub _wrap_handle
Create a new DBIx::StORM object from an existing DBI handle.
my $drivername
sub inflater
Add an inflater to the inflation chain for this connection.
sub _inflaters
Returns all the inflaters registered on this connection.
sub get
Fetch a table object using this database connection.
sub _as_tied_hash
Fetch a tied hash map of table name to DBIx::StORM::Table objects.
sub dbi
Fetch the underlying DBI database handle.
sub add_hint
Add a hint to the key parsing system.
sub _debug
Write a debugging message to STDERR if the debug level is high enough to warrant showing this message.
sub _sqldriver
Fetch the database driver used to perform database-specific functions and optimisations for this connection.
sub TIEHASH
Create a new tied hash of StORM Table objects available on this handle.
sub FETCH
Fetch a table object for a particular table in the hash
sub EXISTS
Check for the existence of a table on a particular connection.
sub FIRSTKEY
Reset the iterator and return the first hash object.
sub NEXTKEY
Return the next table from the iterator.
sub SCALAR
Return the number of tables available on the connection.
Close