mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-07 12:36:25 +00:00
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.
This commit is contained in:
parent
66d0986cd4
commit
466137485d
1 changed files with 7 additions and 10 deletions
|
@ -88,14 +88,6 @@ class DboSource extends DataSource {
|
||||||
*/
|
*/
|
||||||
private $__sqlOps = array('like', 'ilike', 'or', 'not', 'in', 'between', 'regexp', 'similar to');
|
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
|
* Indicates the level of nested transactions
|
||||||
*
|
*
|
||||||
|
@ -181,7 +173,7 @@ class DboSource extends DataSource {
|
||||||
* @return boolean True if the database could be disconnected, else false
|
* @return boolean True if the database could be disconnected, else false
|
||||||
*/
|
*/
|
||||||
function disconnect() {
|
function disconnect() {
|
||||||
if (is_a($this->_result, 'PDOStatement')) {
|
if ($this->_result instanceof PDOStatement) {
|
||||||
$this->_result->closeCursor();
|
$this->_result->closeCursor();
|
||||||
}
|
}
|
||||||
unset($this->_connection);
|
unset($this->_connection);
|
||||||
|
@ -189,6 +181,11 @@ class DboSource extends DataSource {
|
||||||
return !$this->connected;
|
return !$this->connected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the underlying connection object.
|
||||||
|
*
|
||||||
|
* @return PDOConnection
|
||||||
|
*/
|
||||||
public function getConnection() {
|
public function getConnection() {
|
||||||
return $this->_connection;
|
return $this->_connection;
|
||||||
}
|
}
|
||||||
|
@ -336,7 +333,7 @@ class DboSource extends DataSource {
|
||||||
*/
|
*/
|
||||||
protected function _execute($sql, $params = array()) {
|
protected function _execute($sql, $params = array()) {
|
||||||
$sql = trim($sql);
|
$sql = trim($sql);
|
||||||
if (preg_match('/^CREATE|^ALTER|^DROP/i', $sql)) {
|
if (preg_match('/^(?:CREATE|ALTER|DROP)/i', $sql)) {
|
||||||
$statements = array_filter(explode(';', $sql));
|
$statements = array_filter(explode(';', $sql));
|
||||||
if (count($statements) > 1) {
|
if (count($statements) > 1) {
|
||||||
$result = array_map(array($this, '_execute'), $statements);
|
$result = array_map(array($this, '_execute'), $statements);
|
||||||
|
|
Loading…
Add table
Reference in a new issue