mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-15 21:25:55 +00:00
rollback current transaction before trying to report SQL query errors, properly save database error messages when logging query errors
This commit is contained in:
@@ -26,9 +26,12 @@ class Db_Mysql implements IDb {
|
||||
}
|
||||
|
||||
function query($query, $die_on_error = true) {
|
||||
$result = mysql_query($query, $this->link);
|
||||
$result = @mysql_query($query, $this->link);
|
||||
if (!$result) {
|
||||
user_error("Query $query failed: " . ($this->link ? mysql_error($this->link) : "No connection"),
|
||||
$error = @mysql_error($this->link);
|
||||
|
||||
@mysql_query("ROLLBACK", $this->link);
|
||||
user_error("Query $query failed: " . ($this->link ? $error : "No connection"),
|
||||
$die_on_error ? E_USER_ERROR : E_USER_WARNING);
|
||||
}
|
||||
return $result;
|
||||
|
||||
Reference in New Issue
Block a user