Permalink
Browse files

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

  • Loading branch information...
1 parent ffe0a18 commit a512d466795380600a0223088f6b0d10605b936c @jrbasso jrbasso committed Apr 1, 2012
@@ -681,7 +681,7 @@ public function getSchemaName() {
*
* @return boolean
*/
- protected function _supportNestedTransaction() {
+ public function supportNestedTransaction() {
return version_compare($this->getVersion(), '4.1', '>=');
}
@@ -900,7 +900,7 @@ public function getSchemaName() {
*
* @return boolean
*/
- protected function _supportNestedTransaction() {
+ public function supportNestedTransaction() {
return version_compare($this->getVersion(), '8.0', '>=');
}
@@ -564,7 +564,7 @@ public function getSchemaName() {
*
* @return boolean
*/
- protected function _supportNestedTransaction() {
+ public function supportNestedTransaction() {
return version_compare($this->getVersion(), '3.6.8', '>=');
}
@@ -2022,7 +2022,7 @@ public function truncate($table) {
*
* @return boolean
*/
- protected function _supportNestedTransaction() {
+ public function supportNestedTransaction() {
@ADmad

ADmad Apr 26, 2012

Member

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

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

@tPl0ch

tPl0ch Apr 26, 2012

Grammar Nazi :p

@AD7six

AD7six Apr 26, 2012

Member

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

@ceeram

ceeram Apr 26, 2012

Member

nestedTransactionSupported()

@tPl0ch

tPl0ch Apr 26, 2012

+1 for Ceeram

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

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

@ADmad

ADmad Apr 26, 2012

Member

@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 :)

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();
}
@@ -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();
@@ -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();
@@ -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();

0 comments on commit a512d46

Please sign in to comment.