diff --git a/core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php b/core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php index 9130620..404cbb2 100644 --- a/core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php +++ b/core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php @@ -702,12 +702,16 @@ public function fieldSetNoDefault($table, $field) { public function findTables($table_expression) { $tables = []; - // Try to find tables in all attached databases. + // The SQLite implementation doesn't need to use the same filtering strategy + // as the parent one because individually prefixed tables live in their own + // schema (database), which means that neither the main database nor any + // attached one will contain a prefixed table name, so we just need to loop + // over all known schemas and filter by the user-supplied table expression. $attached_dbs = $this->connection->getAttachedDatabases(); foreach ($attached_dbs as $schema) { - // Can't use query placeholders for the schema because the query would have - // to be :prefixsqlite_master, which does not work. We also need to ignore - // the internal SQLite tables. + // Can't use query placeholders for the schema because the query would + // have to be :prefixsqlite_master, which does not work. We also need to + // ignore the internal SQLite tables. $result = db_query("SELECT name FROM " . $schema . ".sqlite_master WHERE type = :type AND name LIKE :table_name AND name NOT LIKE :pattern", array( ':type' => 'table', ':table_name' => $table_expression,