mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-06 14:35:56 +02:00
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
This commit is contained in:
commit
b1a4de3166
@ -246,7 +246,7 @@ class dbal
|
|||||||
*
|
*
|
||||||
* @return bool Whether buffering is required.
|
* @return bool Whether buffering is required.
|
||||||
*/
|
*/
|
||||||
function sql_buffer_nested_transaction()
|
function sql_buffer_nested_transactions()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ class dbal_mssqlnative extends dbal
|
|||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
function sql_buffer_nested_transaction()
|
function sql_buffer_nested_transactions()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
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
|
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);
|
$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']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user