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 ...@@ -603,15 +603,16 @@ class Connection implements DriverConnection
{ {
$this->connect(); $this->connect();
if ( ! is_int(key($types))) { if (empty($data)) {
$types = $this->extractTypeValues($data, $types); return $this->executeUpdate('INSERT INTO ' . $tableName . ' ()' . ' VALUES ()');
} }
$query = 'INSERT INTO ' . $tableName return $this->executeUpdate(
. ' (' . implode(', ', array_keys($data)) . ')' 'INSERT INTO ' . $tableName . ' (' . implode(', ', array_keys($data)) . ')' .
. ' VALUES (' . implode(', ', array_fill(0, count($data), '?')) . ')'; ' VALUES (' . implode(', ', array_fill(0, count($data), '?')) . ')',
array_values($data),
return $this->executeUpdate($query, array_values($data), $types); 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