mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Removed unused attribute and moved getVersion to be reused in all PDO drivers.
This commit is contained in:
parent
072aee0a0f
commit
2c9399a78a
4 changed files with 11 additions and 64 deletions
|
@ -77,17 +77,6 @@ class Mysql extends DboSource {
|
|||
*/
|
||||
protected $_useAlias = true;
|
||||
|
||||
/**
|
||||
* Index of basic SQL commands
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_commands = array(
|
||||
'begin' => 'START TRANSACTION',
|
||||
'commit' => 'COMMIT',
|
||||
'rollback' => 'ROLLBACK'
|
||||
);
|
||||
|
||||
/**
|
||||
* List of engine specific additional field parameters used on table creating
|
||||
*
|
||||
|
@ -262,15 +251,6 @@ class Mysql extends DboSource {
|
|||
return $this->_execute('SHOW VARIABLES LIKE ?', array('character_set_client'))->fetchObject()->Value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the version string of the database server
|
||||
*
|
||||
* @return string The database encoding
|
||||
*/
|
||||
public function getVersion() {
|
||||
return $this->_connection->getAttribute(PDO::ATTR_SERVER_VERSION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query charset by collation
|
||||
*
|
||||
|
|
|
@ -33,17 +33,6 @@ class Postgres extends DboSource {
|
|||
*/
|
||||
public $description = "PostgreSQL DBO Driver";
|
||||
|
||||
/**
|
||||
* Index of basic SQL commands
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_commands = array(
|
||||
'begin' => 'BEGIN',
|
||||
'commit' => 'COMMIT',
|
||||
'rollback' => 'ROLLBACK'
|
||||
);
|
||||
|
||||
/**
|
||||
* Base driver configuration settings. Merged with user settings.
|
||||
*
|
||||
|
|
|
@ -98,31 +98,12 @@ class Sqlserver extends DboSource {
|
|||
'boolean' => array('name' => 'bit')
|
||||
);
|
||||
|
||||
/**
|
||||
* Index of basic SQL commands
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_commands = array(
|
||||
'begin' => 'BEGIN TRANSACTION',
|
||||
'commit' => 'COMMIT',
|
||||
'rollback' => 'ROLLBACK'
|
||||
);
|
||||
|
||||
/**
|
||||
* Magic column name used to provide pagination support for SQLServer 2008
|
||||
* which lacks proper limit/offset support.
|
||||
*/
|
||||
const ROW_COUNTER = '_cake_page_rownum_';
|
||||
|
||||
/**
|
||||
* The version of SQLServer being used. If greater than 11
|
||||
* Normal limit offset statements will be used
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_version;
|
||||
|
||||
/**
|
||||
* Connects to the database using options in the given configuration array.
|
||||
*
|
||||
|
@ -151,7 +132,6 @@ class Sqlserver extends DboSource {
|
|||
throw new MissingConnectionException(array('class' => $e->getMessage()));
|
||||
}
|
||||
|
||||
$this->_version = $this->_connection->getAttribute(PDO::ATTR_SERVER_VERSION);
|
||||
return $this->connected;
|
||||
}
|
||||
|
||||
|
@ -515,7 +495,7 @@ class Sqlserver extends DboSource {
|
|||
}
|
||||
|
||||
// For older versions use the subquery version of pagination.
|
||||
if (version_compare($this->_version, '11', '<') && preg_match('/FETCH\sFIRST\s+([0-9]+)/i', $limit, $offset)) {
|
||||
if (version_compare($this->getVersion(), '11', '<') && preg_match('/FETCH\sFIRST\s+([0-9]+)/i', $limit, $offset)) {
|
||||
preg_match('/OFFSET\s*(\d+)\s*.*?(\d+)\s*ROWS/', $limit, $limitOffset);
|
||||
|
||||
$limit = 'TOP ' . intval($limitOffset[2]);
|
||||
|
|
|
@ -183,17 +183,6 @@ class DboSource extends DataSource {
|
|||
*/
|
||||
protected $_transactionNesting = 0;
|
||||
|
||||
/**
|
||||
* Index of basic SQL commands
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_commands = array(
|
||||
'begin' => 'BEGIN',
|
||||
'commit' => 'COMMIT',
|
||||
'rollback' => 'ROLLBACK'
|
||||
);
|
||||
|
||||
/**
|
||||
* Default fields that are used by the DBO
|
||||
*
|
||||
|
@ -294,12 +283,21 @@ class DboSource extends DataSource {
|
|||
/**
|
||||
* Get the underlying connection object.
|
||||
*
|
||||
* @return PDOConnection
|
||||
* @return PDO
|
||||
*/
|
||||
public function getConnection() {
|
||||
return $this->_connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the version string of the database server
|
||||
*
|
||||
* @return string The database version
|
||||
*/
|
||||
public function getVersion() {
|
||||
return $this->_connection->getAttribute(PDO::ATTR_SERVER_VERSION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a quoted and escaped string of $data for use in an SQL statement.
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue