Skip to content

Commit

Permalink
Fixes an issue where parameters requred to be numbers are treated as …
Browse files Browse the repository at this point in the history
…strings. (Fixes FaaPz#166)
  • Loading branch information
kwhat committed Aug 11, 2022
1 parent d1de9b4 commit f154d11
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/AbstractStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,16 @@ public function execute()
{
$stmt = $this->dbh->prepare($this->__toString());
if ($stmt !== false) {
$stmt->execute($this->getValues());
foreach ($this->getValues() as $i => $value) {
$type = PDO::PARAM_STR;
if (is_int($value)) {
$type = PDO::PARAM_INT;
}

$stmt->bindParam($i + 1, $value, $type);
}

$stmt->execute();
}

return $stmt;
Expand Down

0 comments on commit f154d11

Please sign in to comment.