diff options
author | webchick <webchick@24967.no-reply.drupal.org> | 2011-06-27 08:42:37 -0700 |
---|---|---|
committer | webchick <webchick@24967.no-reply.drupal.org> | 2011-06-27 08:42:37 -0700 |
commit | 3b2601b62a0e9162609e417b54907ea09a1f508a (patch) | |
tree | feee0e639e625bc51de788abeed032f94de67321 /includes/database/sqlite | |
parent | cb6f0ff36c5facaa09dde0146f781816779f2d40 (diff) | |
download | brdo-3b2601b62a0e9162609e417b54907ea09a1f508a.tar.gz brdo-3b2601b62a0e9162609e417b54907ea09a1f508a.tar.bz2 |
Issue #561422 follow-up by Damien Tournoud, lyricnz, chx: Fixed SQLite support for faster db prefixes.
Diffstat (limited to 'includes/database/sqlite')
-rw-r--r-- | includes/database/sqlite/database.inc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/includes/database/sqlite/database.inc b/includes/database/sqlite/database.inc index cf3b9551f..0fc0b5528 100644 --- a/includes/database/sqlite/database.inc +++ b/includes/database/sqlite/database.inc @@ -71,12 +71,8 @@ class DatabaseConnection_sqlite extends DatabaseConnection { )); // Attach one database for each registered prefix. - $prefixes = &$this->prefixes; - if (!empty($this->defaultPrefix)) { - // Add in the default prefix, which is also attached. - $prefixes[] = &$this->defaultPrefix; - } - foreach ($this->prefixes as $table => &$prefix) { + $prefixes = $this->prefixes; + foreach ($prefixes as $table => &$prefix) { // Empty prefix means query the main database -- no need to attach anything. if (!empty($prefix)) { // Only attach the database once. @@ -90,6 +86,8 @@ class DatabaseConnection_sqlite extends DatabaseConnection { $prefix .= '.'; } } + // Regenerate the prefixes replacement table. + $this->setPrefix($prefixes); // Detect support for SAVEPOINT. $version = $this->query('SELECT sqlite_version()')->fetchField(); @@ -240,7 +238,9 @@ class DatabaseConnection_sqlite extends DatabaseConnection { // Generate a new temporary table name and protect it from prefixing. // SQLite requires that temporary tables to be non-qualified. $tablename = $this->generateTemporaryTableName(); - $this->prefixes[$tablename] = ''; + $prefixes = $this->prefixes; + $prefixes[$tablename] = ''; + $this->setPrefix($prefixes); $this->query(preg_replace('/^SELECT/i', 'CREATE TEMPORARY TABLE ' . $tablename . ' AS SELECT', $query), $args, $options); return $tablename; |