aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2011-06-02 23:30:09 +0200
committerAndreas Fischer <bantu@phpbb.com>2011-06-02 23:30:09 +0200
commitb1a4de3166f3f75fe707292f911076db53a0538d (patch)
tree6251b068fbc70ec6f6a7eebbec0eac00d46f7c8e
parent2159e4f28584ad795515e0c6c509f32f634e698b (diff)
parentf0287f7e57919619e7b8085a7e7071975e18da93 (diff)
downloadforums-b1a4de3166f3f75fe707292f911076db53a0538d.tar
forums-b1a4de3166f3f75fe707292f911076db53a0538d.tar.gz
forums-b1a4de3166f3f75fe707292f911076db53a0538d.tar.bz2
forums-b1a4de3166f3f75fe707292f911076db53a0538d.tar.xz
forums-b1a4de3166f3f75fe707292f911076db53a0538d.zip
Merge remote-tracking branch 'naderman/ticket/9685' into develop-olympus
* naderman/ticket/9685: [ticket/9685] Test for databases that are able to nest transactions [ticket/9685] Consistently name the new sql_buffer_nested_transactions function
-rw-r--r--phpBB/includes/db/dbal.php2
-rw-r--r--phpBB/includes/db/mssqlnative.php2
-rw-r--r--tests/dbal/select_test.php24
3 files changed, 26 insertions, 2 deletions
diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php
index d7860fc8bc..2f9619c8ea 100644
--- a/phpBB/includes/db/dbal.php
+++ b/phpBB/includes/db/dbal.php
@@ -246,7 +246,7 @@ class dbal
*
* @return bool Whether buffering is required.
*/
- function sql_buffer_nested_transaction()
+ function sql_buffer_nested_transactions()
{
return false;
}
diff --git a/phpBB/includes/db/mssqlnative.php b/phpBB/includes/db/mssqlnative.php
index e057e7fe74..6810562d17 100644
--- a/phpBB/includes/db/mssqlnative.php
+++ b/phpBB/includes/db/mssqlnative.php
@@ -261,7 +261,7 @@ class dbal_mssqlnative extends dbal
/**
* {@inheritDoc}
*/
- function sql_buffer_nested_transaction()
+ function sql_buffer_nested_transactions()
{
return true;
}
diff --git a/tests/dbal/select_test.php b/tests/dbal/select_test.php
index 533416f14b..e0d08d9306 100644
--- a/tests/dbal/select_test.php
+++ b/tests/dbal/select_test.php
@@ -8,6 +8,7 @@
*/
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php';
class phpbb_dbal_select_test extends phpbb_database_test_case
{
@@ -317,4 +318,27 @@ class phpbb_dbal_select_test extends phpbb_database_test_case
$db->sql_freeresult($result);
}
+
+ function test_nested_transactions()
+ {
+ $db = $this->new_dbal();
+
+ // nested transactions should work on systems that do not require
+ // buffering of nested transactions, so ignore the ones that need
+ // buffering
+ if ($db->sql_buffer_nested_transactions())
+ {
+ return;
+ }
+
+ $sql = 'SELECT user_id FROM phpbb_users ORDER BY user_id ASC';
+ $result1 = $db->sql_query($sql);
+
+ $db->sql_transaction('begin');
+ $result2 = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result2);
+ $db->sql_transaction('commit');
+
+ $this->assertEquals('1', $row['user_id']);
+ }
}