Skip to content

Commit

Permalink
Trigger report if warnings were generated when running query.
Browse files Browse the repository at this point in the history
git-svn-id: http://voip.null.ro/svn/ansql/trunk@158 dbfed7de-b0aa-0410-b6a1-c7e608b77fc9
  • Loading branch information
monica committed Apr 7, 2015
1 parent 46a96b7 commit b780577
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,19 @@ public static function db_query($query)
global $db_type;
switch ($db_type) {
case "mysql":
return mysqli_query(self::$_connection,$query);
$res = mysqli_query(self::$_connection,$query);
$warn_count = mysqli_warning_count(self::$_connection);
if ($warn_count) {
$warnings = array();
$warning = mysqli_get_warnings(self::$_connection);
do {
$warnings[] = $warning->message;
} while ($warning->next());
$warning = "$warn_count warning(s) when running query: '$query'. ".implode(", ",$warnings);
Debug::trigger_report('critical', $warning);
}
return $res;
break;
case "postgresql":
return pg_query(self::$_connection,$query);
}
Expand Down

0 comments on commit b780577

Please sign in to comment.