mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/9892] Transaction support for database update sql execution function
Updates would fail before because 'begin' as generated by db_tools::sql_create_table would be executed literally. PHPBB3-9892
This commit is contained in:
parent
ef977abe59
commit
2569d7460a
1 changed files with 16 additions and 5 deletions
|
@ -534,12 +534,23 @@ function _sql($sql, &$errored, &$error_ary, $echo_dot = true)
|
||||||
|
|
||||||
$db->sql_return_on_error(true);
|
$db->sql_return_on_error(true);
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
if ($sql === 'begin')
|
||||||
if ($db->sql_error_triggered)
|
|
||||||
{
|
{
|
||||||
$errored = true;
|
$db->sql_transaction('begin');
|
||||||
$error_ary['sql'][] = $db->sql_error_sql;
|
}
|
||||||
$error_ary['error_code'][] = $db->sql_error_returned;
|
else if ($sql === 'commit')
|
||||||
|
{
|
||||||
|
$db->sql_transaction('commit');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
if ($db->sql_error_triggered)
|
||||||
|
{
|
||||||
|
$errored = true;
|
||||||
|
$error_ary['sql'][] = $db->sql_error_sql;
|
||||||
|
$error_ary['error_code'][] = $db->sql_error_returned;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->sql_return_on_error(false);
|
$db->sql_return_on_error(false);
|
||||||
|
|
Loading…
Add table
Reference in a new issue