summaryrefslogtreecommitdiff
path: root/idiorm.php
diff options
context:
space:
mode:
Diffstat (limited to 'idiorm.php')
-rw-r--r--idiorm.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/idiorm.php b/idiorm.php
index 2794262..d824a9d 100644
--- a/idiorm.php
+++ b/idiorm.php
@@ -410,7 +410,17 @@
$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_int($parameters[$i])) $type = PDO::PARAM_INT;
+ $statement->bindParam($i + 1, $parameters[$i], $type);
+ }
+
+ $q = $statement->execute();
self::_log_query($query, $parameters, $connection_name, (microtime(true)-$time));
return $q;