From f154d11fa140a4fc086d41a52d7451881e5a105a Mon Sep 17 00:00:00 2001 From: Alexander Barker Date: Wed, 10 Aug 2022 19:45:48 -0700 Subject: [PATCH] Fixes an issue where parameters requred to be numbers are treated as strings. (Fixes #166) --- src/AbstractStatement.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/AbstractStatement.php b/src/AbstractStatement.php index e644774..e4b5d64 100644 --- a/src/AbstractStatement.php +++ b/src/AbstractStatement.php @@ -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;