Public Member Functions | |
init () | |
createCommand ($sql=null) | |
getSlave () | |
isReadOperation ($sql) |
Public Attributes | |
$slaves = array() | |
$enableSlave = true |
Gentics Portal.Node PHP Author & Copyright (c) by Gentics Software GmbH sales @gen tics. comhttp://www.gentics.com Licenses can be found in the LICENSE.txt file in the root-folder of this installation You must not use this software without a valid license agreement.
DbConnectionMan(Database Connection Manager) class is a manager of database connections. for the purpose of database read/write splitting. It override the createCommand method, detect the sql statement to decide which connection will be used. Default it use the master connection.
Definition at line 17 of file DbConnectionMan.php.
DbConnectionMan::createCommand | ( | $sql = null | ) |
Creates a CDbCommand object for excuting sql statement. It will detect the sql statement's behavior. While the sql is a simple read operation. It will use a slave database connection to contruct a CDbCommand object. Default it use current connection(master database).
string | $sql | query |
Definition at line 70 of file DbConnectionMan.php.
References getSlave().
DbConnectionMan::getSlave | ( | ) |
Construct a slave connection CDbConnection for read operation.
Definition at line 85 of file DbConnectionMan.php.
Referenced by createCommand().
DbConnectionMan::isReadOperation | ( | $sql | ) |
Detect whether the sql statement is just a simple read operation. Read Operation means this sql will not change any thing ang aspect of the database. Such as SELECT,DECRIBE,SHOW etc. On the other hand:UPDATE,INSERT,DELETE is write operation.
string | $sql | query |
Definition at line 133 of file DbConnectionMan.php.
bool DbConnectionMan::$enableSlave = true |
Whether enable the slave database connection. Defaut is true.Set this property to false for the purpose of only use the master database.
Definition at line 43 of file DbConnectionMan.php.