summaryrefslogtreecommitdiffstats
path: root/chrome/browser/history
diff options
context:
space:
mode:
authoryuzo@chromium.org <yuzo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-02 05:38:16 +0000
committeryuzo@chromium.org <yuzo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-02 05:38:16 +0000
commitfdc30615f7849eddcea3662f80074e7aba28adea (patch)
tree40de9ac7db36581e879f804efb31e25805c7ab1d /chrome/browser/history
parent25a5dcb7ce35ca15a9e4db1c13e8ec0db3b387b4 (diff)
downloadchromium_src-fdc30615f7849eddcea3662f80074e7aba28adea.zip
chromium_src-fdc30615f7849eddcea3662f80074e7aba28adea.tar.gz
chromium_src-fdc30615f7849eddcea3662f80074e7aba28adea.tar.bz2
Fix: Spurious SQL error message is logged in priming SQLite database cache.
This patch depends on the MetaTableHelper refactoring in: http://codereview.chromium.org/150094 Currently, a spurious SQL error message is logged every time a unit test that access SQLite database runs. Example: [----------] 6 tests from HistoryBackendTest [ RUN ] HistoryBackendTest.Loaded [5660:5304:0630/150705:414864129:ERROR:sqlite_utils.cc(204)] SQLStatement.prepare_v2 failed: no such table: meta BUG=none TEST=n/a Review URL: http://codereview.chromium.org/150095 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19803 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history')
-rw-r--r--chrome/browser/history/history_database.cc17
-rw-r--r--chrome/browser/history/history_database.h6
2 files changed, 2 insertions, 21 deletions
diff --git a/chrome/browser/history/history_database.cc b/chrome/browser/history/history_database.cc
index db63a34..7b198fc 100644
--- a/chrome/browser/history/history_database.cc
+++ b/chrome/browser/history/history_database.cc
@@ -57,8 +57,8 @@ InitStatus HistoryDatabase::Init(const FilePath& history_name,
// Make sure the statement cache is properly initialized.
statement_cache_->set_db(db_);
- // Prime the cache. See the header file's documentation for this function.
- PrimeCache();
+ // Prime the cache.
+ MetaTableHelper::PrimeCache(std::string(), db_);
// Create the tables and indices.
// NOTE: If you add something here, also add it to
@@ -88,19 +88,6 @@ void HistoryDatabase::BeginExclusiveMode() {
sqlite3_exec(db_, "PRAGMA locking_mode=EXCLUSIVE", NULL, NULL, NULL);
}
-void HistoryDatabase::PrimeCache() {
- // A statement must be open for the preload command to work. If the meta
- // table can't be read, it probably means this is a new database and there
- // is nothing to preload (so it's OK we do nothing).
- SQLStatement dummy;
- if (dummy.prepare(db_, "SELECT * from meta") != SQLITE_OK)
- return;
- if (dummy.step() != SQLITE_ROW)
- return;
-
- sqlite3Preload(db_);
-}
-
// static
int HistoryDatabase::GetCurrentVersion() {
return kCurrentVersionNumber;
diff --git a/chrome/browser/history/history_database.h b/chrome/browser/history/history_database.h
index 5791c07..61a27d7 100644
--- a/chrome/browser/history/history_database.h
+++ b/chrome/browser/history/history_database.h
@@ -129,12 +129,6 @@ class HistoryDatabase : public DownloadDatabase,
virtual sqlite3* GetDB();
virtual SqliteStatementCache& GetStatementCache();
- // Primes the sqlite cache on startup by filling it with the file in sequence
- // until there is no more data or the cache is full. Since this is one
- // contiguous read operation, it is much faster than letting the pages come
- // in on-demand (which causes lots of seeks).
- void PrimeCache();
-
// Migration -----------------------------------------------------------------
// Makes sure the version is up-to-date, updating if necessary. If the