Libs/DBSimple

* also collect sql warnings for error handling
 * urlescape user/password on the db connection url (mysqli://)
This commit is contained in:
Sarjuuk
2024-01-31 22:20:35 +01:00
parent d8a6f67688
commit a14b5e2be1
2 changed files with 21 additions and 2 deletions

View File

@@ -163,6 +163,17 @@ class DbSimple_Mysqli extends DbSimple_Database
$result = mysqli_query($this->link, $queryMain[0]);
if ($result === false)
return $this->_setDbError($queryMain[0]);
if ($this->link->warning_count) {
if ($warn = $this->link->query("SHOW WARNINGS")) {
while ($warnRow = $warn->fetch_row())
if ($warnRow[0] !== 'Note')
$this->_setLastError(-$warnRow[1], $warnRow[2], $queryMain[0]);
$warn->close();
}
}
if (!is_object($result)) {
if (preg_match('/^\s* INSERT \s+/six', $queryMain[0]))
{