Skip to content

Commit

Permalink
Fix for name params, resolves #219
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitch committed Jun 23, 2014
1 parent 7dd941d commit 85a0d2e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions idiorm.php
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,28 @@ protected static function _execute($query, $parameters = array(), $connection_na
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;
Expand Down

0 comments on commit 85a0d2e

Please sign in to comment.