Permalink
Browse files

Removed unused attribute and moved getVersion to be reused in all PDO…

… drivers.
  • Loading branch information...
1 parent 072aee0 commit 2c9399a78aa6b272311a826bb75d141674bb9566 @jrbasso jrbasso committed Apr 1, 2012
@@ -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 @@ public function getEncoding() {
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 @@ public function connect() {
throw new MissingConnectionException(array('class' => $e->getMessage()));
}
- $this->_version = $this->_connection->getAttribute(PDO::ATTR_SERVER_VERSION);
return $this->connected;
}
@@ -515,7 +495,7 @@ public function renderStatement($type, $data) {
}
// 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 @@ public function disconnect() {
/**
* 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.
*

0 comments on commit 2c9399a

Please sign in to comment.