mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +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');
|
||||
|
||||
/**
|
||||
* Indicates that a transaction have been started
|
||||
*
|
||||
* @var boolean
|
||||
* @access protected
|
||||
*/
|
||||
protected $_transactionStarted = false;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
function disconnect() {
|
||||
if (is_a($this->_result, 'PDOStatement')) {
|
||||
if ($this->_result instanceof PDOStatement) {
|
||||
$this->_result->closeCursor();
|
||||
}
|
||||
unset($this->_connection);
|
||||
|
@ -189,6 +181,11 @@ class DboSource extends DataSource {
|
|||
return !$this->connected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the underlying connection object.
|
||||
*
|
||||
* @return PDOConnection
|
||||
*/
|
||||
public function getConnection() {
|
||||
return $this->_connection;
|
||||
}
|
||||
|
@ -336,7 +333,7 @@ class DboSource extends DataSource {
|
|||
*/
|
||||
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);
|
||||
|
|
Loading…
Add table
Reference in a new issue