Skip to content

Commit

Permalink
param binding fix
Browse files Browse the repository at this point in the history
  • Loading branch information
donwilson committed Sep 5, 2023
1 parent b5ac871 commit 10f6cc0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Magnetar/Database/HasPDOTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ protected function bindStatementParams(

foreach($params as $param_key => $param_value) {
if($is_list) {
$param_key++; // increment the key by 1 to match the PDOStatement bindParam() method which starts at 1
$param_key++; // increment the key by 1 to match the PDOStatement bindValue() method which starts at 1
} else {
if($prepend_param_key_with_colon) {
// prepend the param key with a colon
$param_key = ":". $param_key;
}
}

$statement->bindParam(
$statement->bindValue(
$param_key,
$param_value,
match(gettype($param_value)) {
Expand Down
1 change: 1 addition & 0 deletions src/Magnetar/Database/HasQuickQueryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

/**
* @TODO replace PDO-specific code with a more generic solution
* @TODO bindStatementParams is in HasPDOTrait
*/
trait HasQuickQueryTrait {
/**
Expand Down

0 comments on commit 10f6cc0

Please sign in to comment.