[HttpKernel] Fix issue in SQLite profiler storage when PDO fails to prepare a statement

This commit is contained in:
ornicar 2011-02-06 16:18:51 -08:00 committed by Fabien Potencier
parent 93fd935b70
commit 2201382fa1

View File

@ -146,6 +146,11 @@ class SQLiteProfilerStorage implements ProfilerStorageInterface
protected function exec($db, $query, array $args = array())
{
$stmt = $db->prepare($query);
if (false === $stmt) {
throw new \RuntimeException('The database cannot successfully prepare the statement');
}
if ($db instanceof \SQLite3) {
foreach ($args as $arg => $val) {
$stmt->bindValue($arg, $val, is_int($val) ? \SQLITE3_INTEGER : \SQLITE3_TEXT);