Skip to content

Commit

Permalink
Merge pull request #1 from noahheck/nh/namedParametersAsArguments
Browse files Browse the repository at this point in the history
Updated to allow named key => value params as input parameters
  • Loading branch information
noahheck committed May 19, 2014
2 parents 360f4f0 + d1b4b6c commit 741b861
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions E_PDOStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,15 @@ public function interpolateQuery($inputParams = null)
*/
if (is_array($inputParams) && $inputParams !== array())
{
foreach ($inputParams as $replValue)
ksort($inputParams);
foreach ($inputParams as $key => $replValue)
{
$replValue = $this->_prepareValue($replValue);
$testQuery = preg_replace("/\?/", $replValue, $testQuery, 1);
$key = (is_numeric($key)) ? "\?" : $key;

$testParam = "/" . $key . "/";
$replValue = $this->_prepareValue($replValue);

$testQuery = preg_replace($testParam, $replValue, $testQuery, 1);
}
}

Expand Down

0 comments on commit 741b861

Please sign in to comment.