protected function exec($db, $query, array $args = array()) {
$stmt = $this
->prepareStatement($db, $query);
foreach ($args as $arg => $val) {
$stmt
->bindValue($arg, $val, is_int($val) ? \PDO::PARAM_INT : \PDO::PARAM_STR);
}
$success = $stmt
->execute();
if (!$success) {
throw new \RuntimeException(sprintf('Error executing query "%s"', $query));
}
}