NAME
Devel::Ladybug::Persistence::Generic - Abstract base for DBI mix-in modules
SYNOPSIS
package Devel::Ladybug::Persistence::NewDBIType;
use strict;
use warnings;
use base qw| Devel::Ladybug::Persistence::Generic |;
# ...
1;
DESCRIPTION
This module will typically be used indirectly.
New DBI types should use this module as a base, and override methods as needed.
PUBLIC CLASS METHODS
$class->columnNames()
Returns a Devel::Ladybug::Array of all column names in the receiving class's table.
This will be the same as the list returned by attributes(), minus any attributes which were asserted as Array or Hash and therefore live in a seperate linked table.
PRIVATE CLASS METHODS
$class->__useForeignKeys()
Returns a true value if the SQL schema should include foreign key constraints where applicable. Default is appropriate for the chosen DBI type.
$class->__datetimeColumnType();
Returns an override column type for ctime/mtime
$class->__beginTransaction();
Begins a new SQL transation.
$class->__rollbackTransaction();
Rolls back the current SQL transaction.
$class->__commitTransaction();
Commits the current SQL transaction.
$class->__beginTransactionStatement();
Returns the SQL used to begin a SQL transaction
$class->__commitTransactionStatement();
Returns the SQL used to commit a SQL transaction
$class->__rollbackTransactionStatement();
Returns the SQL used to rollback a SQL transaction
$class->__schema()
Returns the SQL used to construct the receiving class's table.
$class->__concatNameStatement()
Return the SQL used to look up name concatenated with the other attributes which it is uniquely keyed with.
$class->__statementForColumn($attr, $type, $foreign, $unique)
Returns the chunk of SQL used for this attribute in the CREATE TABLE syntax.
$class->__dropTable()
Drops the receiving class's database table.
use YourApp::Example; YourApp::Example->__dropTable();
$class->__createTable()
Creates the receiving class's database table
use YourApp::Example; YourApp::Example->__createTable();
Returns a string representing the name of the class's current table.
For DBs which support cross-database queries, this returns
databaseName
concatenated withtableName
(eg. "yourdb.yourclass"), otherwise this method just returns the same value astableName
.$class->__selectRowStatement($id)
Returns the SQL used to select a record by id.
$class->__allNamesStatement()
Returns the SQL used to generate a list of all record names
$class->__allIdsStatement()
Returns the SQL used to generate a list of all record ids
$class->__countStatement()
Returns the SQL used to return the number of rows in a table
$class->__doesIdExistStatement($id)
Returns the SQL used to look up the presence of an ID in the current table
$class->__doesNameExistStatement($name)
Returns the SQL used to look up the presence of a name in the current table
$class->__nameForIdStatement($id)
Returns the SQL used to look up the name for a given ID
$class->__idForNameStatement($name)
Returns the SQL used to look up the ID for a given name
$class->__serialType()
Returns the database column type used for auto-incrementing IDs.
$class->__updateColumnNames();
Returns a Devel::Ladybug::Array of the column names to include with UPDATE statements.
$class->__selectColumnNames();
Returns a Devel::Ladybug::Array of the column names to include with SELECT statements.
$class->__insertColumnNames();
Returns a Devel::Ladybug::Array of the column names to include with INSERT statements.
$class->__quoteDatetimeInsert();
Returns the SQL fragment used for unixtime->datetime conversion
$class->__quoteDatetimeSelect();
Returns the SQL fragment used for datetime->unixtime conversion
PRIVATE INSTANCE METHODS
$self->_updateRowStatement()
Returns the SQL used to run an "UPDATE" statement for the receiving object.
$self->_insertRowStatement()
Returns the SQL used to run an "INSERT" statement for the receiving object.
$self->_deleteRowStatement()
Returns the SQL used to run a "DELETE" statement for the receiving object.
SEE ALSO
This file is part of Devel::Ladybug.