Commit db4b370a authored by Steve Müller's avatar Steve Müller

fix insert with empty data given

parent 1c77da6e
......@@ -603,15 +603,16 @@ class Connection implements DriverConnection
{
$this->connect();
if ( ! is_int(key($types))) {
$types = $this->extractTypeValues($data, $types);
if (empty($data)) {
return $this->executeUpdate('INSERT INTO ' . $tableName . ' ()' . ' VALUES ()');
}
$query = 'INSERT INTO ' . $tableName
. ' (' . implode(', ', array_keys($data)) . ')'
. ' VALUES (' . implode(', ', array_fill(0, count($data), '?')) . ')';
return $this->executeUpdate($query, array_values($data), $types);
return $this->executeUpdate(
'INSERT INTO ' . $tableName . ' (' . implode(', ', array_keys($data)) . ')' .
' VALUES (' . implode(', ', array_fill(0, count($data), '?')) . ')',
array_values($data),
is_int(key($types)) ? $types : $this->extractTypeValues($data, $types)
);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment