- Fixed a bug within INSERT query

This commit is contained in:
mcndave committed 2023-11-17 23:34:55 -05:00
1 parent 3a80fee9c3
commit 62792e8325
3 files changed
+9 -6

No files matched your search

+6 -4
View File
@@ -85,21 +85,23 @@ class PdoObject extends PDO {
foreach($parameters as $key => $value) {
switch(strtolower(gettype($value))) {
case "boolean":
$statement->bindValue($key, $value, Pdo::PARAM_BOOL);
$type = Pdo::PARAM_BOOL;
break;
case "integer":
$statement->bindValue($key, $value, Pdo::PARAM_INT);
$type = Pdo::PARAM_INT;
break;
case "null":
$statement->bindValue($key, $value, Pdo::PARAM_NULL);
$type = Pdo::PARAM_NULL;
break;
case "string":
default:
$statement->bindValue($key, (string) $value, Pdo::PARAM_STR);
$type = Pdo::PARAM_STR;
}
$statement->bindValue($key, (string) $value, $type);
}
$this->executionStatus = $statement->execute();
+2 -1
View File
@@ -25,7 +25,8 @@ class Values extends Fragment {
$this->fieldCount = count($row);
}
$this->rows[] = array_values($row);
# index starts at '1' for Pdo params
$this->rows[] = array_combine(range(1, count($row)), array_values($row));
return $this;
}
+1 -1
View File
@@ -84,7 +84,7 @@ abstract class Ulmus
public static function runInsertQuery(Query\QueryBuilderInterface $queryBuilder, ? ConnectionAdapter $adapter = null)
{
$return = static::connector($adapter)->runInsertQuery($queryBuilder->render(), array_merge($queryBuilder->values ?? [], $queryBuilder->parameters ?? []));
$return = static::connector($adapter)->runInsertQuery($queryBuilder->render(),$queryBuilder->values ?? []);
$queryBuilder->reset();
return $return;