- Fixed a bug within INSERT query
This commit is contained in:
parent
3a80fee9c3
commit
62792e8325
|
@ -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();
|
||||
|
|
|
@ -24,8 +24,9 @@ class Values extends Fragment {
|
|||
if ($this->fieldCount === null) {
|
||||
$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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue