Skip to content
Permalink
Browse files

Removing a duplicated property.

Changing is_a() to instanceof as it marginally faster.
Adding a comment to getConnection as it was missing it.
Minor optimization to a regular expression.
  • Loading branch information...
markstory committed Dec 4, 2010
1 parent 66d0986 commit 466137485d48d668720f08141dcaaa4aa4656d22
Showing with 7 additions and 10 deletions.
  1. +7 −10 cake/libs/model/datasources/dbo_source.php
@@ -88,14 +88,6 @@ class DboSource extends DataSource {
*/
private $__sqlOps = array('like', 'ilike', 'or', 'not', 'in', 'between', 'regexp', 'similar to');
/**
* Indicates that a transaction have been started
*
* @var boolean
* @access protected
*/
protected $_transactionStarted = false;
/**
* Indicates the level of nested transactions
*
@@ -181,14 +173,19 @@ function reconnect($config = array()) {
* @return boolean True if the database could be disconnected, else false
*/
function disconnect() {
if (is_a($this->_result, 'PDOStatement')) {
if ($this->_result instanceof PDOStatement) {
$this->_result->closeCursor();
}
unset($this->_connection);
$this->connected = false;
return !$this->connected;
}
/**
* Get the underlying connection object.
*
* @return PDOConnection
*/
public function getConnection() {
return $this->_connection;
}
@@ -336,7 +333,7 @@ public function execute($sql, $options = array(), $params = array()) {
*/
protected function _execute($sql, $params = array()) {
$sql = trim($sql);
if (preg_match('/^CREATE|^ALTER|^DROP/i', $sql)) {
if (preg_match('/^(?:CREATE|ALTER|DROP)/i', $sql)) {
$statements = array_filter(explode(';', $sql));
if (count($statements) > 1) {
$result = array_map(array($this, '_execute'), $statements);

0 comments on commit 4661374

Please sign in to comment.
You can’t perform that action at this time.