mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
DB/Errors
* don't need to handle sql warnings in batch when the error handler doesn't use exit() any longer * display warnings as [WARN] and use consts instead of magic numbers
This commit is contained in:
@@ -116,7 +116,7 @@ set_error_handler(function($errNo, $errStr, $errFile, $errLine)
|
|||||||
|
|
||||||
Util::addNote($uGroup, $errName.' - '.$errStr.' @ '.$errFile. ':'.$errLine);
|
Util::addNote($uGroup, $errName.' - '.$errStr.' @ '.$errFile. ':'.$errLine);
|
||||||
if (CLI)
|
if (CLI)
|
||||||
CLI::write($errName.' - '.$errStr.' @ '.$errFile. ':'.$errLine, $errNo & 0x40A ? CLI::LOG_WARN : CLI::LOG_ERROR);
|
CLI::write($errName.' - '.$errStr.' @ '.$errFile. ':'.$errLine, $errNo & (E_WARNING | E_USER_WARNING | E_NOTICE | E_USER_NOTICE) ? CLI::LOG_WARN : CLI::LOG_ERROR);
|
||||||
|
|
||||||
if (DB::isConnected(DB_AOWOW))
|
if (DB::isConnected(DB_AOWOW))
|
||||||
DB::Aowow()->query('INSERT INTO ?_errors (`date`, `version`, `phpError`, `file`, `line`, `query`, `userGroups`, `message`) VALUES (UNIX_TIMESTAMP(), ?d, ?d, ?, ?d, ?, ?d, ?) ON DUPLICATE KEY UPDATE `date` = UNIX_TIMESTAMP()',
|
DB::Aowow()->query('INSERT INTO ?_errors (`date`, `version`, `phpError`, `file`, `line`, `query`, `userGroups`, `message`) VALUES (UNIX_TIMESTAMP(), ?d, ?d, ?, ?d, ?, ?d, ?) ON DUPLICATE KEY UPDATE `date` = UNIX_TIMESTAMP()',
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ class DbSimple_Mysqli extends DbSimple_Database
|
|||||||
if ($this->link->warning_count) {
|
if ($this->link->warning_count) {
|
||||||
if ($warn = $this->link->query("SHOW WARNINGS")) {
|
if ($warn = $this->link->query("SHOW WARNINGS")) {
|
||||||
while ($warnRow = $warn->fetch_row())
|
while ($warnRow = $warn->fetch_row())
|
||||||
if ($warnRow[0] !== 'Note')
|
if ($warnRow[0] === 'Warning')
|
||||||
$this->_setLastError(-$warnRow[1], $warnRow[2], $queryMain[0]);
|
$this->_setLastError(-$warnRow[1], $warnRow[2], $queryMain[0]);
|
||||||
|
|
||||||
$warn->close();
|
$warn->close();
|
||||||
|
|||||||
Reference in New Issue
Block a user