ePages 6.10 - DE_EPAGES/Database/API/DBI.pm

Package DE_EPAGES::Database::API::DBI

central database interface, is based on standard perl module DBI. Use DE_EPAGES::Database::API::Connection::GetCurrentDBHandle to get the currrent connected DBI handle.

Functions

addForeignKey
addPrimaryKey
addTableColumn
atIsolationLevel
buildQueryString
cacheKey
createDatabase
createEpagesDatabase
createIndex
createTempTable
currentDateTime
datetimeParser
dbh
disconnect
do
doEscapeChars
driverName
dropAllTables
dropDatabase
dropForeignKey
dropForeignKeyIfExists
dropIndex
dropIndexIfExists
dropPrimaryKey
dropProcedure
dropTable
dropTableColumn
dropTableColumnIfExists
enableTransactionLog
encodeSpaces
escapeChar
escapeFromExtension
execute
existsDatabase
existsForeignKey
existsIndex
existsProcedure
existsTable
existsTableColumn
getAllTableReferences
getParameterString
getSearchCollation
getTableLockingScheme
getTransactions
inTransaction
isTransactionLogEnabled
killConnections
lockTables
logTransaction
modifyTableColumn
modifyTableColumnDropDefault
modifyTableColumnReplaceDefault
modifyTableLockingScheme
new
ping
primaryKeyColumns
processID
quoteBoolean
quoteDateTime
quoteFloat
quoteInteger
quoteParameter
quoteString
reconnect
recreateIndex
replaceLikeWildcards
resetTransactions
setPriority
sortDeleteAllTables
source
storeName
tempTableName
testDateTimeRange
transaction
unquoteDateTime
unquoteResultSet

addForeignKey

Adds a foreign key constaint.

Syntax
$dbi->addForeignKey($Table, $Constraint, $aKeys, $RefTable, $aRefKeys);
Example
$dbi->addForeignKey('product', 'fk_product_object', ['productid'],
    'object' => ['objectid']);
Input
$Table (string)
slave table name
$Constraint (string)
constraint name (optional)
$aKeys (ref.array.string)
list of columns in the slave table
$RefTable (string)
master table name
$aRefKeys (ref.array.string)
list of columns in the master table

addPrimaryKey

Adds constaint (primary key) $constraint to a table $tablename.

Syntax
$dbi->addPrimaryKey($Table, $Constraint, $aColumnNames);
Example
$dbi->addPrimaryKey('product', 'pk_product', ['productid']);
Input
$Table (string)
table name
$Constraint (string)
constraint name (optional)

addTableColumn

Adds a new column to an existing table $table.

Syntax
$dbi->addTableColumn($table, $columndefinition);
Example
$table = 'tablename';
$columndefinition = 'columnname varchar(30) NULL';
Input
$table (string)
table name
$columndefinition (string)
sql definiton of the column

atIsolationLevel

executes the function sub at specified transaction isolation level.

Syntax
$dbi->atIsolationLevel($IsolationLevel, $Sub);
Input
$IsolationLevel (string)
values (
READ UNCOMMITTED|
READ COMMITTED|
REPEATABLE READ|
SERIALIZABLE
)
$Sub (ref.code)
function to execute select statement

buildQueryString

Substitute any intermediate spaces in search string with %. e.g. " John ®§&? Doe " -> "John%Doe". String is prepared for sql like statements.

Syntax
$DBSearchString = $dbi->buildQueryString($SearchString);
Input
$SearchString (string)
string received by form
Return
$DBSearchString (string)
possible database string prepared for like statements

cacheKey

Returns the indentifier of the connection used to identify the right cache. different connections to one database can use the same key.

Syntax
$CacheKey = $dbi->cacheKey
Return
$CacheKey (string)
key to identify the connection

createDatabase

Creates a new database.

Syntax
$dbi->createDatabase($DBName);
Example
$dbi->createDatabase('storedb');
Input
$DBName (string)
database name

createEpagesDatabase

Creates a database with epages default sizes and names.

Syntax
$dbi->createEpagesDatabase($DBName, $DBLogin, $hOptions);
Example
$dbi->createEpagesDatabase('sitedb', 'usr_sitedb');
$dbi->createEpagesDatabase('storedb');
Input
$DBName (string)
database name
$DBLogin (string)
database login (optional)
$hOptions (ref.hash)
DBMS specific options

createIndex

Creates an index on some table columns.

Syntax
$dbi->createIndex($Table, $IndexName, $Options, $aColumns, $hColumnOptions, $ExtraOptions);
$dbi->createIndex('product', 'i_product_super', undef,
    ['superproductid', 'variationstring'],
    {'superproductid' => 'DESC', 'variationstring' => 'DESC'});
Input
$Table (string)
table name
$IndexName (string)
(optional) index name
$Options (string)
(optional) options, for example 'UNIQUE'
$aColumns (array)
list of column names
$hColumnOptions (ref.hash.string)
(optional) hash column name => options
$ExtraOptions (string)
(optional) special options after the CREATE INDEX statement

createTempTable

Creates a temporary table with the given name and parameters.

Syntax
$dbi->createTempTable($Table);
$dbi->createTempTable('temptable(objectid int not null primary key)'));
Input
$Table (string)
table name and parameters

currentDateTime

Returns the current date and time from the database server. Use this function to generate comparable timestamp values that are independent of the randomly selected application server.

Syntax
$DateTime = $dbi->currentDateTime
Example
print $dbi->currentDateTime->ymd;
Return
$DateTime (DateTime object)
current date and time

datetimeParser

Returns the parser for datetime objects.

Syntax
$datetimeParser = $dbi->datetimeParser
Return
$datetimeParser (DateTime::Format::DBI object)
datetime parser

dbh

Returns database handle of the current connection.

Syntax
$dbh = $dbi->dbh
Example
my $sth = $dbi->dbh->prepare( 'SELECT * FROM dual' );
Return
$dbh (object)
DBI database handle

disconnect

Disconnects the underlying database handle.

Syntax
$dbi->disconnect;

do

Executes an SQL statement without result set, such as INSERT, UPDATE or DELETE.

Syntax
$dbi->do( $SQL, $aParams );
$dbi->do( $SQL );
Example
$dbi->do('DELETE FROM shops');
$dbi->do('DELETE FROM shops WHERE name = ?', [ $ShopName ] );
Input
$SQL (string)
SQL statement
$aParams (array ref)
list of parameters to replace '?' placeholders in the SQL
string

doEscapeChars

Returns which character should be escaped.

Syntax
$doEscapeChars = $dbi->doEscapeChars;
Return
$doEscapeChars (string)
'%', '_', '[' and ']'

driverName

Returns the name of the DBD driver of the underlying database handle. See also $dbh->{'Driver'}->{'Name'} in the DBI specification. Returns 'Sybase' for DBD::Sybase and 'mysql' for DBD::mysql.

Syntax
$DriverName = $dbi->driverName
Return
$DriverName (string)
DBD driver name

dropAllTables

Removes all user tables from the database (deleting all data, of cause).

Syntax
$dbi->dropAllTables();

dropDatabase

Deletes a database.

Syntax
$dbi->dropDatabase($DBName);
Example
$dbi->dropDatabase('storedb');
Input
$DBName (string)
database name

dropForeignKey

Drops constaint (foreign key) $constraint from a table $tablename.

Syntax
$dbi->dropForeignKey($table, $constraint);
Example
$dbi->dropForeignKey('product', 'fk_product_object');
Input
$table (string)
table name
$constraint (string)
constraint name

dropForeignKeyIfExists

Drops constaint (foreign key) $constraint from a table $tablename if this foreign key exists already in the table.

Syntax
$dbi->dropForeignKeyIfExists($table, $constraint);
Example
$dbi->dropForeignKeyIfExists('product', 'fk_product_object');
Input
$table (string)
table name
$constraint (string)
constraint name

dropIndex

Drops index $indexname from table $tablename.

Syntax
$dbi->dropIndex($table, $indexname);
Example
$dbi->dropIndex('product', 'i_product_super');
Input
$table (string)
table name
$indexname (string)
index name

dropIndexIfExists

Drops index $indexname from table $tablename if this index exists already in the table.

Syntax
$dbi->dropIndexIfExists($table, $indexname);
Example
$dbi->dropIndexIfExists('product', 'i_product_super');
Input
$table (string)
table name
$indexname (string)
index name

dropPrimaryKey

Drops constaint (Primary key) $constraint from a table $tablename.

Syntax
$dbi->dropPrimaryKey($table, $constraint);
Example
$dbi->dropPrimaryKey('product', 'pk_product');
Input
$table (string)
table name
$constraint (string)
constraint name

dropProcedure

Removes a stored procedure from the database

Syntax
$dbi->dropProcedure($Procedure);
Example
$dbi->dropProcedure('sp_InsertAttribute');
Input
$Procedure (string)
procedure name

dropTable

Removes a table from the database (deleting all data, of cause).

Syntax
$dbi->dropTable($Table);
Example
$dbi->dropTable('product');
Input
$Table (string)
table name

dropTableColumn

Drops an existing column $column from a table $tablename.

Syntax
$dbi->dropTableColumn($table, $column);
Example
$table = 'tablename';
$column = 'columnname';
Input
$table (string)
table name
$column (string)
column name

dropTableColumnIfExists

Drops an existing column $column from a table $tablename.

Syntax
$dbi->dropTableColumnIfExists($table, $column);
Example
$table = 'tablename';
$column = 'columnname';
Input
$table (string)
table name
$column (string)
column name

enableTransactionLog

Activates or deactivates transaction logging.

Syntax
$dbi->enableTransactionLog($enabled);
Input
$enabled (boolean)
true to enable transaction log

encodeSpaces

Encodes spaces to simulate database-like string encoding. The global version does nothing at all.

Syntax
$string = encodeSpaces( $string );
Input
$string (string)
String to encode
Return
$string (string)
Encoded string

escapeChar

Returns the escape character '' to escape like parameter.

Syntax
$escapeChar = $dbi->escapeChar;
Return
$escapeChar (string)
empty string

escapeFromExtension

Returns string should be added after each like. escapeChar is used to get the escape char.

Syntax
$EscapeFromExtension = $dbi->escapeFromExtension;
Return
$EscapeFromExtension (string)
empty string for standard

execute

Executes an SQL statement and fetches all results.

Syntax
$aRows = $dbi->execute( $SQL, $aParams, $aDttps );
$aRows = $dbi->execute( $SQL );
Example
$aRows = $dbi->execute('SELECT * FROM shops');
$aRows = $dbi->execute('SELECT * FROM shops WHERE name = ?', [ $ShopName ] );
print "Shop id: " . $aRow->[0]->[0];
$aRows = $dbi->execute('SELECT siteid, creationdate FROM object WHERE objectid = ?', [ $ObjectID ], [ 'Integer', 'DateTime']);
print "Shop id: " . $aRow->[0]->[0];
Input
$SQL (string)
SQL statement
$aParams (ref.array.string)
list of parameters to replace '?' placeholders in the SQL
string (optional defauly [])
$aDttp (ref.array.string)
list data type position of return values (see unquoteResultSet (optional)
Return
$aRows (array ref)
list of result rows

existsDatabase

Returns true if the database exists.

Syntax
$Exists = $dbi->existsDatabase($DBName);
Input
$DBName (string)
logical database name
Return
$Exists (boolean)
database exists

existsForeignKey

Returns true if the foreign key exists.

Syntax
$Exists = $dbi->existsForeignKey( $Name );
Example
if( $dbi->existsForeignKey( 'sp_InsertAttribute' ) ) { ... };
Input
$ForeignKey (string)
foreign key name
Return
$Exists (boolean)
true if the foreign key exists

existsIndex

Returns true if the index exists.

Syntax
$exists = $dbi->existsIndex($Table, $IndexName);
Example
if( $dbi->existsIndex('product', 'i_product_super') ) { ... }
Input
$Table (string)
table name
$IndexName (string)
index name

existsProcedure

Returns true if the stored procedure exists.

Syntax
$Exists = $dbi->existsProcedure( $Procedure );
Example
if( $dbi->existsProcedure( 'sp_InsertAttribute' ) ) { ... };
Input
$Procedure (string)
stored procedure name
Return
$Exists (boolean)
true if the stored procedure exists

existsTable

Returns true if the database table exists.

Syntax
$Exists = $dbi->existsTable( $Table );
Example
if( $dbi->existsTable( 'sysobjects' ) ) { ... };
Input
$Table (string)
table name
Return
$Exists (boolean)
true if the table exists

existsTableColumn

Returns true if the database table column exists.

Syntax
$Exists = $dbi->existsTableColumn( $Table, $Column );
Example
if( $dbi->existsTableColumn( 'sysobjects', 'name' ) ) { ... };
Input
$Table (string)
table name
$Column (string)
column name
Return
$Exists (boolean)
true if the column exists

getAllTableReferences

Determines all table references

Syntax
$aaReferences = $dbi->getAllTableReferences();
Return
$aaReferences (ref.array.array.string)
list of table references
each list element is a pair of tables [ table => master_table ].
If master_table is undef, then the table does not depend on other
tables

getParameterString

Create the parameter string for a procedure call, for example "@Name='MyName', @Number=42". Tests and quotes the parameters according to the data type spefification given in $hTypes.

Syntax
$ProcParameter = $dbi->getParameterString($hTypes, $hValues);
Example
$ProcParameter = $dbi->getParameterString({'Name' => 'String;NotNull',
                        'Descr' => 'String',
                        'AnyNumber' => 'Integer'
                    }, {'Name'=>'TestName','AnyNumber'=> 1});
$ProcParameter = "@Name='TestName', @AnyNumber=1";
Input
$hTypes (ref.hash)
data type specification for parameters
$hValues (ref.hash)
parameter name => value hash
Return
$ProcParameter (string)
stored procedure parameter string

getSearchCollation

Returns additional SQL syntax for specification of collations for searches. This is ususally used for mysql to return 'COLLATE utf8_general_ci'

Syntax
$SearchCollation = $dbi->getSearchCollation;
Return
$SearchCollation (string)
empty string for standard

getTableLockingScheme

Gets the locking scheme of a table.

Syntax
$lockingscheme = $dbi->getTableLockingScheme($table );
Example
$lockingscheme = $dbi->getTableLockingScheme('tablename' );
Input
$table (string)
table name
Return
$lockingscheme (string)
locking scheme (datarows,datapages or allpages)

getTransactions

Returns the logged transactions, use (logTransactions to push statements to the collection.

Syntax
$aStatements = $dbi->getTransactions;
Return
$aStatements (ref.array.string)
statements ? placeholder are replaced

inTransaction

Returns true if database connection is in transaction mode.

Syntax
$IsInTransaction = $dbi->inTransaction;
Return
$IsInTransaction (boolean)
true if connection is in transaction mode

isTransactionLogEnabled

Returns whether transaction logging is currently enabled.

Syntax
$enabled = $dbi->isTransactionLogEnabled;
Return
$enabled (boolean)
true if transaction log is enabled

killConnections

Terminates all connections to the given database.

Syntax
$dbi->killConnections( $DBName );
Input
$DBName (string)
database name

lockTables

Locks the specified tables during execution of a code block. The actual implementation is database-specific. The default implementation only executeds $cCode, but does not lock any tables.

Syntax
$dbi->lockTables( $ahTables, $cCode );
Example
$dbi->lockTables( [
    { 'table' => 'test', 'mode' => 'WRITE'},
    { 'table' => 'test2', 'mode' => 'WRITE'},
], sub {
    $dbi->do('DELETE FROM test2 WHERE id = ?', $id);
    $dbi->do('DELETE FROM test WHERE id = ?', $id);
});
Input
$ahTables (ref.array.hash)
tables and locking modes. Hash keys are:
  • table - table name - string
  • mode - locking mode (READ|WRITE) - string
$cCode (code ref)
code block

logTransaction

Logs the transaction of this dbi and collect this at an internal structure. Use getTransactions and resetTransactions for your own purpose.

Syntax
$dbi->logTransaction($statement, $aParameter, $aTypes);
Input
$statement (string)
statement incl. ? as placeholder for parameter
$aParameter (ref.array.*)
parameters of statement
$aTypes (ref.array.string)
types of parameter (String|Integer|DateTime|Float|Boolean)

modifyTableColumn

Modifies an existing column of an existing table $tablename.

Syntax
$dbi->modifyTableColumn($table, $columndefinition);
Example
$table = 'tablename';
$columndefinition contains sql code to create a column
Input
$table (string)
table name
$columndefinition (not null])
sql definiton of the column | string
column_name datatype [null

modifyTableColumnDropDefault

Deletes a Default of an existing column of an existing table $tablename.

Syntax
$dbi->modifyTableColumnDropDefault($table, $column );
Example
$table = 'tablename';
$column = 'columnname';
Input
$table (string)
table name
$column (string)
column name

modifyTableColumnReplaceDefault

Modifies a default of an existing column $column of an existing table $tablename.

Syntax
$dbi->modifyTableColumnReplaceDefault($table, $column ,$defaultvalue);
Example
$table = 'tablename';
$column = 'columnname';
$defaultvalue = 0 use functions quote* to quote the value before
Input
$table (string)
table name
$column (string)
column name
$defaultvalue (string)
default value of the column

modifyTableLockingScheme

Changes the locking scheme of a table.

Syntax
$dbi->modifyTableLockingScheme($table, $lockingscheme );
Example
$dbi->modifyTableLockingScheme('tablename', 'datarows');
Input
$table (string)
table name
$lockingscheme (string)
locking scheme (datarows,datapages or allpages)

new

Creates a database connection using the supplied connection parameters.

Syntax
DE_EPAGES::Database::API::DBI->new( $DataSource, $User, $Password, $CacheKey );
Example
DE_EPAGES::Database::API::DBI->new( 'dbi:mysql:storedb', 'root', 'geheim', 'DAL' );
Input
$DataSource (string)
DBI connection string without user name/password
$User (string)
Database user or login name
$Password (string)
Database user password
$CacheKey (string)
key to identify the connection

ping

test if dbi connection is alive.

Syntax
$isAlive = $dbi->ping;
Return
$isAlive (boolean)
is connection alive

primaryKeyColumns

Returns a list of columns of the primary of a table. Retruns an empty list if the table does not have a primary key.

Syntax
@Columns = $dbi->primaryKeyColumns($Table);
Input
$Table (string)
table name
Return
@Columns (array.string)
column names

processID

Returns the ID of the current database process. Returns 0 if the DBMS does not support this feature.

Syntax
my $ProcessID = $dbi->processID;
Input
$ProcessID (integer)
process id

quoteBoolean

Formats an boolean number for use as argument in an SQL statement.

  • If the parameter is undefinded, the return value is the sting 'NULL' without qoutes.
    This function does not copy the parameters locally, because it is optimized for speed.

    Syntax
    $StrBool = $dbi->quoteBoolean($Bool);
    Example
    $StrBool = $dbi->quoteBoolean(1);
    Input
    $Bool (boolean)
    boolean input value or undef
    Return
    $StrBool (string)
    string ready for database
  • example: NULL
  • quoteDateTime

    Converts a DateTime object to a string representation suitable for the as argument in an SQL statement. Returns undef if the

  • If the parameter is undefinded, the return value is the sting 'NULL' without qoutes.

    Syntax
    $StrDateTime = $dbi->quoteDateTime( $DateTime );
    Example
    $StrDateTime = $dbi->quoteDateTime( DateTime->now );
    Input
    $DateTime (datetime)
    DateTime object or undef
    Return
    $StrDateTime (string)
    string ready for database

    quoteFloat

    Formats a number for use as argument in an SQL statement.

  • If the parameter is undefinded, the return value is the sting 'NULL' without qoutes.
    This function does not copy the parameters locally, because it is optimized for speed.

    Syntax
    $StrFloat = $dbi->quoteFloat($Float);
    Example
    $StrFloat = $dbi->quoteFloat(1223.4534);
    Input
    $Float (float)
    float input value or undef
    Return
    $StrFloat (string)
    string ready for database
  • example: NULL
  • quoteInteger

    Formats an integer number for use as argument in an SQL statement.

  • If the parameter is undefinded, the return value is the sting 'NULL' without qoutes.
    This function does not copy the parameters locally, because it is optimized for speed.

    Syntax
    $StrInteger = $dbi->quoteInteger($Integer);
    Example
    $StrInteger = $dbi->quoteInteger(1223);
    Input
    $Integer (integer)
    integer input value or undef
    Return
    $StrInteger (string)
    string ready for database
  • example: NULL
  • quoteParameter

    Tests and quotes the parameters according to the data type spefification.

    Syntax
    $Parameter = $dbi->quoteParameter($Type, $Value);
    Example
    $Parameter = $dbi->quoteParameter('String', "don't");
    Input
    $Type (ref.hash)
    data type specification for parameters
    $Value (*)
    value
    Return
    $Parameter (string)
    parameter for database

    quoteString

    Formats a string for use as argument in an SQL statement.

  • Replaces single quotes with a pair of single quotes, a' la str2database()
  • Adds leading and trailing single quotes
  • If the parameter is undefinded, the return value is the sting 'NULL' without qoutes.
    This function does not copy the parameters locally, because it is optimized for speed.

    Syntax
    $result = $dbi->quoteString($instring);
    Example
    $qstring = $dbi->quoteString("Don't worry.");
    $dbi->do( "DELETE FROM shops WHERE description = $qstring" );
    Input
    $instring (string)
    input string (iso 1 charset),
  • example: "Don't worry."
  • Return
    $result (string)
    quoted string, ready for database
  • example: "'Don''t worry.'"
  • reconnect

    Rebuilds a database connection, usefull if connect was closed by server.

    Syntax
    my $dbh = $dbi->reconnect();
    Return
    $dbh (string)
    dbi handle

    recreateIndex

    Creates an index on some table columns, drop it before if it still exists.

    Syntax
    $dbi->recreateIndex($Table, $IndexName, $Options, $aColumns, $hColumnOptions, $ExtraOptions);
    $dbi->recreateIndex('product', 'i_product_super', undef,
        ['superproductid', 'variationstring'],
        {'superproductid' => 'DESC', 'variationstring' => 'DESC'});
    Input
    $Table (string)
    table name
    $IndexName (string)
    (optional) index name
    $Options (string)
    (optional) options, for example 'UNIQUE'
    $aColumns (array)
    list of column names
    $hColumnOptions (ref.hash.string)
    (optional) hash column name => options
    $ExtraOptions (string)
    (optional) special options after the CREATE INDEX statement

    replaceLikeWildcards

    Replace chars used at where clause operator like (%_). escapeChar and doEscapeChars are used.

    Syntax
    $likestring = $dbi->replaceLikeWildcards($string);
    Input
    $string (string)
    string incl. chars (eg test[1])
    Return
    $likestring (string)
    string with replaced chars (eg test~[1~])

    resetTransactions

    Clears the statement collection.

    Syntax
    $dbi->resetTransactions;

    setPriority

    Sets the priority of the current database process.

    Syntax
    $dbi->setPriority( $Priority )
    Example
    $dbi->setPriority( 'LOW' )
    Input
    $Priority (string)
    priority (LOW|NORMAL|HIGH)

    sortDeleteAllTables

    Sort tables by references. Deleting tables in this order is possible.

    Syntax
    $aTables = $dbi->sortDeleteAllTables($aaReferences);
    Example
    $aTables = $dbi->sortDeleteAllTables([['product','object'],['object','object'],['object_nextid', undef]]);
    $aTables = $dbi->sortDeleteAllTables( $dbi->getAllTableReferences );
    Input
    $aaReferences (ref.array.array.string)
    list of table references each list element is a pair of
    tables [ table => master_table ]. If master_table is undef, then
    the table does not depend on other tables
    Return
    $aTables (ref.array.string)
    table names

    source

    Returns connection string to current dbi.

    Syntax
    $source = $dbi->source
    Return
    $source (string)
    DBI connection string without user name/password

    storeName

    Returns the storename of the connection.

    Syntax
    $storeName = $dbi->storeName
    Return
    $storeName (string)
    store name

    tempTableName

    Returns the name of the temporary table in the correct database style.

    Syntax
    $dbi->tempTableName($TableName);
    $dbi->tempTableName('temptable');
    Input
    $TableName (string)
    table name
    Return
    $TableName (string)
    correct table name

    testDateTimeRange

    Test a date/time string for a passes range. Returns Error if the date/time string is to large or to small.

    Syntax
    $DateTime = $dbi->testDateTimeRange($StrDateTime);
    Example
    $DateTime = $dbi->testDateTimeRange('20031127/09:56:57');
    Input
    $DateTime (string)
    input string

    transaction

    Executes a code block in a transaction.

    Syntax
    $dbi->transaction( $cCode, $cRollback );
    Example
    $dbi->transaction( sub {
        $dbi->do( "DELETE FROM objects WHERE classid = 25" );
        $dbi->do( "DELETE FROM classes WHERE classid = 25" );
    } );
    Input
    $cCode (code reference)
    code block
    $cRollback (code reference)
    roll back code block (optional)

    unquoteDateTime

    Parses a date/time string from a database result set. Returns undef if the database returned a NULL value.

    Syntax
    $DateTime = $dbi->unquoteDateTime($StrDateTime);
    Example
    $DateTime = $dbi->unquoteDateTime('20031127/09:56:57');
    Input
    $StrDateTime (string)
    input string or undef
    Return
    $DateTime (datetime)
    DateTime object

    unquoteResultSet

    Formats a date/time string to datetime object, and converts string to utf-8 perl strings. If the $ColumnNames are defined the rows will be converted to hashes.

    Syntax
    $aaResult = $dbi->unquoteResultSet($aaResult, $aDttps);
    $ahResult = $dbi->unquoteResultSet($aaResult, $aDttps, $ColumnNames);
    Example
    $result = $self->unquoteResultSet($sth->fetchall_arrayref, ['Integer', 'DateTime', 'String']);
    Input
    $aaResult (ref.array.array.string)
    resultset of sql statement
    $aDttps (ref.array.string)
    data type definition (String|DateTime|...)
    $ColumnNames (ref.array.string)
    names of columns
    Return
    $aaResult (ref.array.array.*)
    resultset to process in perl
    $ahResult (ref.array.hash.*)
    resultset with columnNames