diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-07-21 01:56:36 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-07-21 01:56:36 +0000 |
commit | d2c02ca453f938fb6f8f2c6853f36dfe426ced1f (patch) | |
tree | d447f5810b5f80a0ce1836fa5e1fe591591bbaa4 /includes/database/sqlite | |
parent | 7719a888950f61c68b6645b3e9adc53df46338d4 (diff) | |
download | brdo-d2c02ca453f938fb6f8f2c6853f36dfe426ced1f.tar.gz brdo-d2c02ca453f938fb6f8f2c6853f36dfe426ced1f.tar.bz2 |
#481288 by Berdir and Crell: Add support for INSERT INTO ... SELECT FROM ...
Diffstat (limited to 'includes/database/sqlite')
-rw-r--r-- | includes/database/sqlite/query.inc | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/includes/database/sqlite/query.inc b/includes/database/sqlite/query.inc index 287fc9008..35314e8a8 100644 --- a/includes/database/sqlite/query.inc +++ b/includes/database/sqlite/query.inc @@ -21,11 +21,7 @@ class InsertQuery_sqlite extends InsertQuery { public function execute() { - if (count($this->insertFields) + count($this->defaultFields) == 0 && empty($this->fromQuery)) { - return NULL; - } - // Don't execute query without values. - if (!isset($this->insertValues[0]) && count($this->insertFields) > 0 && empty($this->fromQuery)) { + if (!$this->preExecute()) { return NULL; } if (count($this->insertFields)) { @@ -40,6 +36,8 @@ class InsertQuery_sqlite extends InsertQuery { // Produce as many generic placeholders as necessary. $placeholders = array_fill(0, count($this->insertFields), '?'); + // If we're selecting from a SelectQuery, finish building the query and + // pass it back, as any remaining options are irrelevant. if (!empty($this->fromQuery)) { return "INSERT INTO {" . $this->table . '} (' . implode(', ', $this->insertFields) . ') ' . $this->fromQuery; } |