浏览代码

[HttpKernel] Throw exception when SQLite statement execution failed

This fixes SQLiteProfilerStorageTest, that was failing using PDO.
ornicar 14 年之前
父节点
当前提交
80b03f92b3
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      src/Symfony/Component/HttpKernel/Profiler/SQLiteProfilerStorage.php

+ 4 - 1
src/Symfony/Component/HttpKernel/Profiler/SQLiteProfilerStorage.php

@@ -157,7 +157,10 @@ class SQLiteProfilerStorage implements ProfilerStorageInterface
             foreach ($args as $arg => $val) {
                 $stmt->bindValue($arg, $val, is_int($val) ? \PDO::PARAM_INT : \PDO::PARAM_STR);
             }
-            $stmt->execute();
+            $success = $stmt->execute();
+            if (!$success) {
+                throw new \RuntimeException(sprintf('Error executing SQLite query "%s"', $query));
+            }
         }
     }