summaryrefslogtreecommitdiff
path: root/idiorm.php
diff options
context:
space:
mode:
authorMitch <[email protected]>2014-06-23 21:56:26 +1000
committerMitch <[email protected]>2014-06-23 21:56:26 +1000
commit85a0d2e1d609645427fc4bf8e9cc1bfd94543d4e (patch)
treefae6a87d64fa11ac476964e7ad36b74caf79fa80 /idiorm.php
parent7dd941dd4b4aea05eb903111bb98673e3bc6187c (diff)
Fix for name params, resolves #219
Diffstat (limited to 'idiorm.php')
-rw-r--r--idiorm.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/idiorm.php b/idiorm.php
index 8a3854d..ed91c28 100644
--- a/idiorm.php
+++ b/idiorm.php
@@ -412,6 +412,28 @@
self::$_last_statement = $statement;
$time = microtime(true);
+ foreach ($parameters as $key => &$param) {
+ switch (true) {
+ case is_null($param):
+ $type = PDO::PARAM_NULL;
+ break;
+
+ case is_bool($param):
+ $type = PDO::PARAM_BOOL;
+ break;
+
+ case is_int($param):
+ $type = PDO::PARAM_INT;
+ break;
+
+ default:
+ $type = PDO::PARAM_STR;
+ break;
+ }
+
+ $statement->bindParam(is_int($key) ? ++$key : $key, $param, $type);
+ }
+
$count = count($parameters);
for ($i = 0; $i < $count; $i++) {
$type = PDO::PARAM_STR;