Public Member Functions | |
setLogger ($logger) | |
Sets a Logger class (e.g. | |
getNumQueriesExecuted () | |
Returns the number of queries executed on this connection so far. | |
getLastExecutedQuery () | |
Returns the last query executed on this connection. | |
connect ($dsninfo, $flags=0) | |
connect() | |
getDatabaseInfo () | |
getIdGenerator () | |
isConnected () | |
prepareStatement ($sql) | |
createStatement () | |
applyLimit (&$sql, $offset, $limit) | |
close () | |
executeQuery ($sql, $fetchmode=null) | |
executeUpdate ($sql) | |
getUpdateCount () | |
prepareCall ($sql) | |
getResource () | |
getDSN () | |
getFlags () | |
begin () | |
commit () | |
rollback () | |
setAutoCommit ($bit) | |
getAutoCommit () | |
Private Member Functions | |
log ($msg) | |
Private function that logs message using specified logger (if provided). | |
Private Attributes | |
$childConnection = null | |
$numQueriesExecuted = 0 | |
$lastExecutedQuery = '' | |
$logger |
Definition at line 27 of file DebugConnection.php.
DebugConnection::applyLimit | ( | &$ | sql, | |
$ | offset, | |||
$ | limit | |||
) |
Implements Connection.
Definition at line 135 of file DebugConnection.php.
References log().
00136 { 00137 $this->log("applyLimit(): $sql, offset: $offset, limit: $limit"); 00138 return $this->childConnection->applyLimit($sql, $offset, $limit); 00139 }
DebugConnection::begin | ( | ) |
Implements Connection.
Definition at line 216 of file DebugConnection.php.
References log().
00217 { 00218 $this->log("Beginning transaction."); 00219 return $this->childConnection->begin(); 00220 }
DebugConnection::close | ( | ) |
Implements Connection.
Definition at line 144 of file DebugConnection.php.
References log().
00145 { 00146 $this->log("close(): Closing connection."); 00147 return $this->childConnection->close(); 00148 }
DebugConnection::commit | ( | ) |
Implements Connection.
Definition at line 225 of file DebugConnection.php.
References log().
00226 { 00227 $this->log("Committing transaction."); 00228 return $this->childConnection->commit(); 00229 }
DebugConnection::connect | ( | $ | dsninfo, | |
$ | flags = 0 | |||
) |
Implements Connection.
Definition at line 76 of file DebugConnection.php.
References Creole::getDriver(), Creole::import(), and log().
00077 { 00078 if (!($driver = Creole::getDriver($dsninfo['phptype']))) { 00079 throw new SQLException("No driver has been registered to handle connection type: $type"); 00080 } 00081 $connectionClass = Creole::import($driver); 00082 $this->childConnection = new $connectionClass(); 00083 $this->log("connect(): DSN: ". var_export($dsninfo, true) . ", FLAGS: " . var_export($flags, true)); 00084 return $this->childConnection->connect($dsninfo, $flags); 00085 }
DebugConnection::createStatement | ( | ) |
Implements Connection.
Definition at line 125 of file DebugConnection.php.
00126 { 00127 $obj = $this->childConnection->createStatement(); 00128 $objClass = get_class($obj); 00129 return new $objClass($this); 00130 }
DebugConnection::executeQuery | ( | $ | sql, | |
$ | fetchmode = null | |||
) |
Implements Connection.
Definition at line 153 of file DebugConnection.php.
References log().
00154 { 00155 $this->log("executeQuery(): $sql"); 00156 $this->lastExecutedQuery = $sql; 00157 $this->numQueriesExecuted++; 00158 return $this->childConnection->executeQuery($sql, $fetchmode); 00159 }
DebugConnection::executeUpdate | ( | $ | sql | ) |
Implements Connection.
Definition at line 164 of file DebugConnection.php.
References log().
00165 { 00166 $this->log("executeUpdate(): $sql"); 00167 $this->lastExecutedQuery = $sql; 00168 $this->numQueriesExecuted++; 00169 return $this->childConnection->executeUpdate($sql); 00170 }
DebugConnection::getAutoCommit | ( | ) |
Implements Connection.
Definition at line 252 of file DebugConnection.php.
DebugConnection::getDatabaseInfo | ( | ) |
Implements Connection.
Definition at line 90 of file DebugConnection.php.
DebugConnection::getDSN | ( | ) |
Implements Connection.
Definition at line 200 of file DebugConnection.php.
DebugConnection::getFlags | ( | ) |
Implements Connection.
Definition at line 208 of file DebugConnection.php.
DebugConnection::getIdGenerator | ( | ) |
Implements Connection.
Definition at line 98 of file DebugConnection.php.
DebugConnection::getLastExecutedQuery | ( | ) |
Returns the last query executed on this connection.
Definition at line 68 of file DebugConnection.php.
DebugConnection::getNumQueriesExecuted | ( | ) |
Returns the number of queries executed on this connection so far.
Definition at line 58 of file DebugConnection.php.
DebugConnection::getResource | ( | ) |
Implements Connection.
Definition at line 192 of file DebugConnection.php.
DebugConnection::getUpdateCount | ( | ) |
Implements Connection.
Definition at line 175 of file DebugConnection.php.
DebugConnection::isConnected | ( | ) |
Implements Connection.
Definition at line 106 of file DebugConnection.php.
DebugConnection::log | ( | $ | msg | ) | [private] |
Private function that logs message using specified logger (if provided).
string | $msg Message to log. |
Definition at line 261 of file DebugConnection.php.
Referenced by applyLimit(), begin(), close(), commit(), connect(), executeQuery(), executeUpdate(), prepareCall(), prepareStatement(), rollback(), and setAutoCommit().
DebugConnection::prepareCall | ( | $ | sql | ) |
Implements Connection.
Definition at line 183 of file DebugConnection.php.
References log().
00184 { 00185 $this->log("prepareCall(): $sql"); 00186 return $this->childConnection->prepareCall($sql); 00187 }
DebugConnection::prepareStatement | ( | $ | sql | ) |
Implements Connection.
Definition at line 114 of file DebugConnection.php.
References log().
00115 { 00116 $this->log("prepareStatement(): $sql"); 00117 $obj = $this->childConnection->prepareStatement($sql); 00118 $objClass = get_class($obj); 00119 return new $objClass($this, $sql); 00120 }
DebugConnection::rollback | ( | ) |
Implements Connection.
Definition at line 234 of file DebugConnection.php.
References log().
00235 { 00236 $this->log("Rolling back transaction."); 00237 return $this->childConnection->rollback(); 00238 }
DebugConnection::setAutoCommit | ( | $ | bit | ) |
Implements Connection.
Definition at line 243 of file DebugConnection.php.
References log().
00244 { 00245 $this->log("Setting autocommit to: " . var_export($bit, true)); 00246 return $this->childConnection->setAutoCommit($bit); 00247 }
DebugConnection::setLogger | ( | $ | logger | ) |
Sets a Logger class (e.g.
PEAR Log) to use for logging. The logger class must have a log() method. All messages are logged at default log level.
object | $logger |
Definition at line 48 of file DebugConnection.php.
References $logger.
00049 { 00050 $this->logger = $logger; 00051 }
DebugConnection::$childConnection = null [private] |
Definition at line 30 of file DebugConnection.php.
DebugConnection::$lastExecutedQuery = '' [private] |
Definition at line 36 of file DebugConnection.php.
DebugConnection::$logger [private] |
DebugConnection::$numQueriesExecuted = 0 [private] |
Definition at line 33 of file DebugConnection.php.