15 public function preparedStatement($sql, $params = [], $fetchResponse =
false, $paramTypes = []) {
17 $statement = $this->connection->prepare($sql);
18 foreach (array_values($params) as $index => $value) {
19 $type = $paramTypes[$index] ?? (str_starts_with($sql,
'INSERT') && $index === 5 ? PDO::PARAM_LOB : PDO::PARAM_STR);
20 $statement->bindValue($index + 1, $value, $type);
22 $statement->execute();
23 return $fetchResponse ? $statement->fetchAll(PDO::FETCH_ASSOC) :
true;
26 public function preparedRows($sql, $params = [], $buffered =
true): Generator {
28 $statement = $this->connection->prepare($sql);
29 $statement->execute(array_values($params));
31 while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
35 $statement->closeCursor();