mirror of
https://github.com/ConnectedHumber/Air-Quality-Web
synced 2024-11-25 06:53:00 +00:00
Log SQL warnings to the error log, but only in development
This commit is contained in:
parent
e86b0b4f97
commit
74b1b212fe
1 changed files with 6 additions and 0 deletions
|
@ -88,6 +88,12 @@ class Database
|
|||
// FUTURE: Optionally cache prepared statements?
|
||||
$statement = $this->connection->prepare($sql);
|
||||
$statement->execute($variables);
|
||||
|
||||
if($this->settings->get("env.mode") == "development") {
|
||||
$warnings = $this->connection->query("SHOW WARNINGS;")->fetchAll();
|
||||
error_log("Warnings: " . var_export($warnings, true));
|
||||
}
|
||||
|
||||
return $statement; // fetchColumn(), fetchAll(), etc. are defined on the statement, not the return value of execute()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue