ZenMagick 0.9.8


org.zenmagick.store.provider.ZMZenCartDatabase
\store\provider\ZMZenCartDatabase.php at line 34

Class ZMZenCartDatabase

ZMObject
└─ZMZenCartDatabase
All Implemented Interfaces:
ZMDatabase

public class ZMZenCartDatabase
extends ZMObject

Implementation of the ZenMagick database layer using zen-cart's $db.

Author:
DerManoMann
Version:
$Id: ZMZenCartDatabase.php 2694 2009-12-03 22:32:18Z dermanomann $

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

ZMZenCartDatabase(array conf)

Create a new instance.

Method Summary
void

beginTransaction()

{@inheritDoc}

protected string

bindObject(string sql, mixed obj)

Bind object to a given SQL query.

protected string

bindValueList(string sql, string bindName, array values, string type)

Bind a list of values to a given SQL query.

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.

static string

getMappedType(string type)

Optional mappings.

void

getMetaData(mixed table)

{@inheritDoc}

void

getResource()

{@inheritDoc}

void

getStats()

{@inheritDoc}

void

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

{@inheritDoc}

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

\store\provider\ZMZenCartDatabase.php at line 52

ZMZenCartDatabase

public ZMZenCartDatabase(array conf)

Create a new instance.

Since this is just a wrapper around the existing global $db, the parameters in $conf are ignored.

Parameters:
conf - Configuration properties.

Method Detail

\store\provider\ZMZenCartDatabase.php at line 89

beginTransaction

public void beginTransaction()


\store\provider\ZMZenCartDatabase.php at line 503

bindObject

protected string bindObject(string sql, mixed obj)

Bind object to a given SQL query.

This is based on introspection/reflection on the given object and the available getXXX() or isXXX() methods.

SQL label must follow the listed convenctions:

Examples:

Parameters:
sql - The sql to work on.
obj - The data object instance.
Returns:
The updated SQL query.

\store\provider\ZMZenCartDatabase.php at line 545

bindValueList

protected string bindValueList(string sql, string bindName, array values, string type)

Bind a list of values to a given SQL query.

Converts the values in the given array into a comma separated list of the specified type.

Parameters:
sql - The sql query to work on.
bindName - The name to bind the list to.
values - An array of values.
type - The value type; default is 'string'
Returns:
The sql with $bindName replaced with a properly formatted value list.

\store\provider\ZMZenCartDatabase.php at line 95

commit

public void commit()


\store\provider\ZMZenCartDatabase.php at line 184

createModel

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


\store\provider\ZMZenCartDatabase.php at line 82

getConfig

public void getConfig()


\store\provider\ZMZenCartDatabase.php at line 120

getExecutionTime

protected long getExecutionTime(string start)

Get the elapsed time since $start.

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

\store\provider\ZMZenCartDatabase.php at line 134

getMappedType

public static string getMappedType(string type)

Optional mappings.

Allows to use types not supported bb zen-cart, for example boolean.

Parameters:
type - The type.
Returns:
A valid zen-cart data type.

\store\provider\ZMZenCartDatabase.php at line 416

getMetaData

public void getMetaData(mixed table)


\store\provider\ZMZenCartDatabase.php at line 449

getResource

public void getResource()


\store\provider\ZMZenCartDatabase.php at line 107

getStats

public void getStats()


\store\provider\ZMZenCartDatabase.php at line 144

loadModel

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


\store\provider\ZMZenCartDatabase.php at line 371

query

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


\store\provider\ZMZenCartDatabase.php at line 363

querySingle

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


\store\provider\ZMZenCartDatabase.php at line 320

removeModel

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


\store\provider\ZMZenCartDatabase.php at line 101

rollback

public void rollback()


\store\provider\ZMZenCartDatabase.php at line 460

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.

\store\provider\ZMZenCartDatabase.php at line 234

update

public void update(mixed sql, mixed data)


\store\provider\ZMZenCartDatabase.php at line 270

updateModel

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


ZenMagick 0.9.8