diff options
Diffstat (limited to 'idiorm.php')
-rw-r--r-- | idiorm.php | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -410,7 +410,20 @@ $statement = self::get_db($connection_name)->prepare($query); self::$_last_statement = $statement; $time = microtime(true); - $q = $statement->execute($parameters); + + $count = count($parameters); + for ($i = 0; $i < $count; $i++) { + $type = PDO::PARAM_STR; + if (is_null($parameters[i])) $type = PDO::PARAM_NULL; + if (is_bool($parameters[i])) $type = PDO::PARAM_BOOL; + if (is_numeric($parameters[i])) { + $type = PDO::PARAM_INT; + $parameters[$i] = +($parameters[$i]); + } + $statement->bindParams($i + 1, $parameters[$i], $type); + } + + $q = $statement->execute(); self::_log_query($query, $parameters, $connection_name, (microtime(true)-$time)); return $q; |