Commit b0a60999 authored by Dries's avatar Dries

- Patch #432128 by Berdir: adding some babysitting code to insert queries --...

- Patch #432128 by Berdir: adding some babysitting code to insert queries -- don't execute query when there are no values.
parent dfff6528
......@@ -20,6 +20,11 @@ public function execute() {
return NULL;
}
// Don't execute query without values.
if (!isset($this->insertValues[0]) && count($this->insertFields) > 0) {
return NULL;
}
$last_insert_id = 0;
$max_placeholder = 0;
......
......@@ -24,6 +24,11 @@ public function execute() {
if (count($this->insertFields) + count($this->defaultFields) == 0) {
return NULL;
}
// Don't execute query without values.
if (!isset($this->insertValues[0]) && count($this->insertFields) > 0) {
return NULL;
}
$stmt = $this->connection->prepareQuery((string)$this);
......
......@@ -428,6 +428,11 @@ public function execute() {
return NULL;
}
// Don't execute query without values.
if (!isset($this->insertValues[0]) && count($this->insertFields) > 0) {
return NULL;
}
// Each insert happens in its own query in the degenerate case. However,
// we wrap it in a transaction so that it is atomic where possible. On many
// databases, such as SQLite, this is also a notable performance boost.
......
......@@ -19,6 +19,10 @@ public function execute() {
if (count($this->insertFields) + count($this->defaultFields) == 0) {
return NULL;
}
// Don't execute query without values.
if (!isset($this->insertValues[0]) && count($this->insertFields) > 0) {
return NULL;
}
if (count($this->insertFields)) {
return parent::execute();
}
......
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