ZenMagick 0.9.8


org.zenmagick.core.services.database.provider.ZMPdoDatabase
\core\services\database\provider\ZMPdoDatabase.php at line 34

Class ZMPdoDatabase

ZMObject
└─ZMPdoDatabase
All Implemented Interfaces:
ZMDatabase

public class ZMPdoDatabase
extends ZMObject

Implementation of the ZenMagick database layer using PDO.

Support for nested transactions via SAVEPOINTs inspired by http://www.kennynet.co.uk/2008/12/02/php-pdo-nested-transactions/.

Author:
DerManoMann
Version:
$Id: ZMPdoDatabase.php 2617 2009-11-22 22:32:11Z dermanomann $

Fields inherited from org.zenmagick.core.ZMObject
properties_
Constructor Summary

ZMPdoDatabase(array conf)

Create a new instance.

Method Summary
void

beginTransaction()

{@inheritDoc}

void

commit()

{@inheritDoc}

void

createModel(mixed table, mixed model, mixed mapping)

{@inheritDoc}

void

getConfig()

{@inheritDoc}

protected long

getExecutionTime(string start)

Get the elapsed time since $start.

void

getMetaData(mixed table)

{@inheritDoc}

void

getResource()

{@inheritDoc}

void

getStats()

{@inheritDoc}

protected boolean

isNestedTransactions()

Does this instance allow nested transactions?

void

loadModel(mixed table, mixed key, mixed modelClass, mixed mapping)

{@inheritDoc}

protected A

prepareStatement(string sql, mixed args, array mapping)

Create a prepared statement.

void

query(mixed sql, mixed args, mixed modelClass)

{@inheritDoc}

void

querySingle(mixed sql, mixed args, mixed modelClass)

{@inheritDoc}

void

removeModel(mixed table, mixed model, mixed mapping)

{@inheritDoc}

void

rollback()

{@inheritDoc}

protected array

translateRow(array row, array mapping)

Translate a given raw database row with the given mapping.

void

update(mixed sql, mixed data)

{@inheritDoc}

void

updateModel(mixed table, mixed model, mixed mapping)

{@inheritDoc}

Methods inherited from org.zenmagick.core.ZMObject
attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton

Constructor Detail

\core\services\database\provider\ZMPdoDatabase.php at line 51

ZMPdoDatabase

public ZMPdoDatabase(array conf)

Create a new instance.

Supports the custom configuration setting persistent (true | false)

.

Parameters:
conf - Configuration properties.

Method Detail

\core\services\database\provider\ZMPdoDatabase.php at line 117

beginTransaction

public void beginTransaction()


\core\services\database\provider\ZMPdoDatabase.php at line 133

commit

public void commit()


\core\services\database\provider\ZMPdoDatabase.php at line 236

createModel

public void createModel(mixed table, mixed model, mixed mapping)


\core\services\database\provider\ZMPdoDatabase.php at line 110

getConfig

public void getConfig()


\core\services\database\provider\ZMPdoDatabase.php at line 183

getExecutionTime

protected long getExecutionTime(string start)

Get the elapsed time since $start.

Parameters:
start - The starting time.
Returns:
The time in milliseconds.

\core\services\database\provider\ZMPdoDatabase.php at line 554

getMetaData

public void getMetaData(mixed table)


\core\services\database\provider\ZMPdoDatabase.php at line 595

getResource

public void getResource()


\core\services\database\provider\ZMPdoDatabase.php at line 165

getStats

public void getStats()


\core\services\database\provider\ZMPdoDatabase.php at line 103

isNestedTransactions

protected boolean isNestedTransactions()

Does this instance allow nested transactions?

Returns:
true if nested transactions are supported.

\core\services\database\provider\ZMPdoDatabase.php at line 192

loadModel

public void loadModel(mixed table, mixed key, mixed modelClass, mixed mapping)


\core\services\database\provider\ZMPdoDatabase.php at line 452

prepareStatement

protected A prepareStatement(string sql, mixed args, array mapping)

Create a prepared statement.

Parameters:
sql - The initial SQL.
args - The data either as map or ZMObject instance.
mapping - The field mapping.
Returns:
PreparedStatement or null;

\core\services\database\provider\ZMPdoDatabase.php at line 417

query

public void query(mixed sql, mixed args, mixed modelClass)


\core\services\database\provider\ZMPdoDatabase.php at line 409

querySingle

public void querySingle(mixed sql, mixed args, mixed modelClass)


\core\services\database\provider\ZMPdoDatabase.php at line 287

removeModel

public void removeModel(mixed table, mixed model, mixed mapping)


\core\services\database\provider\ZMPdoDatabase.php at line 149

rollback

public void rollback()


\core\services\database\provider\ZMPdoDatabase.php at line 527

translateRow

protected array translateRow(array row, array mapping)

Translate a given raw database row with the given mapping.

Parameters:
row - The database row map.
mapping - The mapping (may be null).
Returns:
The mapped row.

\core\services\database\provider\ZMPdoDatabase.php at line 390

update

public void update(mixed sql, mixed data)


\core\services\database\provider\ZMPdoDatabase.php at line 335

updateModel

public void updateModel(mixed table, mixed model, mixed mapping)


ZenMagick 0.9.8