Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Sqlite is failing in PHP 5.2, re-adding the check for driver support.

  • Loading branch information...
commit a512d466795380600a0223088f6b0d10605b936c 1 parent ffe0a18
@jrbasso jrbasso authored
View
2  lib/Cake/Model/Datasource/Database/Mysql.php
@@ -681,7 +681,7 @@ public function getSchemaName() {
*
* @return boolean
*/
- protected function _supportNestedTransaction() {
+ public function supportNestedTransaction() {
return version_compare($this->getVersion(), '4.1', '>=');
}
View
2  lib/Cake/Model/Datasource/Database/Postgres.php
@@ -900,7 +900,7 @@ public function getSchemaName() {
*
* @return boolean
*/
- protected function _supportNestedTransaction() {
+ public function supportNestedTransaction() {
return version_compare($this->getVersion(), '8.0', '>=');
}
View
2  lib/Cake/Model/Datasource/Database/Sqlite.php
@@ -564,7 +564,7 @@ public function getSchemaName() {
*
* @return boolean
*/
- protected function _supportNestedTransaction() {
+ public function supportNestedTransaction() {
return version_compare($this->getVersion(), '3.6.8', '>=');
}
View
8 lib/Cake/Model/Datasource/DboSource.php
@@ -2022,7 +2022,7 @@ public function truncate($table) {
*
* @return boolean
*/
- protected function _supportNestedTransaction() {
+ public function supportNestedTransaction() {
@ADmad Collaborator
ADmad added a note

A more grammatically correct name for the function would be $supportsNestedTransaction() ("supports" with an "s")

Edit: $supportsNestedTransaction() should read supportsNestedTransaction() :)

@tPl0ch
tPl0ch added a note

Grammar Nazi :p

@AD7six Collaborator
AD7six added a note

appropriate though - otherwise it sounds like a function that makes nested transactions supported

@ceeram Collaborator
ceeram added a note

nestedTransactionSupported()

@tPl0ch
tPl0ch added a note

+1 for Ceeram

<?php
    if ($this->nestedTransactionSupported()) {
        doMagic();
    }
?>

looks very readable to me and tells me exactly what the method does.

@ADmad Collaborator
ADmad added a note

@tPl0ch When it comes to API method/property names, its good to be picky, pedantic even. Otherwise you have to live with incorrect / inaccurate / inconsistent names until the next major release as they cannot be changed easily. PHP itself is a prime example of inconsistent naming we should learn from it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
return false;
}
@@ -2035,7 +2035,7 @@ protected function _supportNestedTransaction() {
*/
public function begin() {
if ($this->_transactionStarted) {
- if ($this->_supportNestedTransaction()) {
+ if ($this->supportNestedTransaction()) {
return $this->_beginNested();
}
$this->_transactionNesting++;
@@ -2083,7 +2083,7 @@ public function commit() {
return $this->_connection->commit();
}
- if ($this->_supportNestedTransaction()) {
+ if ($this->supportNestedTransaction()) {
return $this->_commitNested();
}
@@ -2125,7 +2125,7 @@ public function rollback() {
return $this->_connection->rollBack();
}
- if ($this->_supportNestedTransaction()) {
+ if ($this->supportNestedTransaction()) {
return $this->_rollbackNested();
}
View
2  lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
@@ -3586,6 +3586,8 @@ public function testTruncateStatements() {
* @return void
*/
public function testNestedTransaction() {
+ $this->skipIf($this->Dbo->supportNestedTransaction() === false, 'The MySQL server do not support nested transaction');
+
$this->loadFixtures('Address');
$model = ClassRegistry::init('Address');
$model->hasOne = $model->hasMany = $model->belongsTo = $model->hasAndBelongsToMany = array();
View
2  lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php
@@ -915,6 +915,8 @@ public function testTruncateStatements() {
* @return void
*/
public function testNestedTransaction() {
+ $this->skipIf($this->Dbo->supportNestedTransaction() === false, 'The Postgres server do not support nested transaction');
+
$this->loadFixtures('Article');
$model = new Article();
$model->hasOne = $model->hasMany = $model->belongsTo = $model->hasAndBelongsToMany = array();
View
2  lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php
@@ -389,6 +389,8 @@ public function testUuidPrimaryKeyInsertion() {
* @return void
*/
public function testNestedTransaction() {
+ $this->skipIf($this->Dbo->supportNestedTransaction() === false, 'The Sqlite version do not support nested transaction');
+
$this->loadFixtures('User');
$model = new User();
$model->hasOne = $model->hasMany = $model->belongsTo = $model->hasAndBelongsToMany = array();
@ADmad

A more grammatically correct name for the function would be $supportsNestedTransaction() ("supports" with an "s")

Edit: $supportsNestedTransaction() should read supportsNestedTransaction() :)

@AD7six

appropriate though - otherwise it sounds like a function that makes nested transactions supported

@ceeram

nestedTransactionSupported()

@tPl0ch

+1 for Ceeram

<?php
    if ($this->nestedTransactionSupported()) {
        doMagic();
    }
?>

looks very readable to me and tells me exactly what the method does.

@ADmad

@tPl0ch When it comes to API method/property names, its good to be picky, pedantic even. Otherwise you have to live with incorrect / inaccurate / inconsistent names until the next major release as they cannot be changed easily. PHP itself is a prime example of inconsistent naming we should learn from it :)

Please sign in to comment.
Something went wrong with that request. Please try again.