From f4438a01036bb53e42b879a6da6e6f63052453d6 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Mon, 24 Jan 2022 21:44:20 +0100 Subject: [PATCH] inserting CLOB absolutely requires a length argument Co-authored-by: Austin Huang --- lib/Data/Database.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/Data/Database.php b/lib/Data/Database.php index 657107b..0e60598 100644 --- a/lib/Data/Database.php +++ b/lib/Data/Database.php @@ -548,12 +548,13 @@ class Database extends AbstractData private static function _exec($sql, array $params) { $statement = self::$_db->prepare($sql); - foreach ($params as $key => $parameter) { - $position = $key + 1; + foreach ($params as $key => &$parameter) { if (is_int($parameter)) { - $statement->bindValue($position, $parameter, PDO::PARAM_INT); + $statement->bindParam($key + 1, $parameter, PDO::PARAM_INT); + } elseif (strlen($parameter) >= 4000) { + $statement->bindParam($key + 1, $parameter, PDO::PARAM_STR, strlen($parameter)); } else { - $statement->bindValue($position, $parameter); + $statement->bindParam($key + 1, $parameter); } } $result = $statement->execute();