-
Notifications
You must be signed in to change notification settings - Fork 1
Module Database
Gerd Christian Kunze edited this page May 28, 2013
·
6 revisions
MOC\Api::Module()->Database()
-
->Driver( DRIVER_.. )-
->Open( Host, User, Password, Database ) -
->Statement( SqlTemplate ) -
->Parameter( Value, Identifier, PARAM_TYPE_.. ) -
->Execute( RESULT_AS_.. ) -
->Close() -
->[Driver-Methods]()
-
A driver is mainly used to unify the different database engines. It also adds additional methods specific to the database e.g. transactions
Native:
MySql
Odbc:
MsSql
Oracle
$Database = MOC\Api::Module()->Database();
$Database->Driver( $Database::DRIVER_MYSQL )->Open( '127.0.0.1', 'User', 'Password', 'Database' )
$Result = $Database->Statement( "SELECT * FROM Table WHERE Column = ?" )->Parameter( 'Value' )->Execute()
// Result: array( array( 'Column' => 'Value', 'Column' => 'Value', ... ), ... )