summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-03 22:26:12 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-03 22:26:12 +0000
commita4d8a7bb664645e18a1d6045e94aa1f714a0a404 (patch)
tree1e402d9c10dfec493be4710e10eba3348b780f7a /chrome/browser
parent4354027e1b08d8ee2fca342c900bc9748e0d2863 (diff)
downloadchromium_src-a4d8a7bb664645e18a1d6045e94aa1f714a0a404.zip
chromium_src-a4d8a7bb664645e18a1d6045e94aa1f714a0a404.tar.gz
chromium_src-a4d8a7bb664645e18a1d6045e94aa1f714a0a404.tar.bz2
Wrap Sqlite utils functions into a sqlite_utils namespace.
Note: this was a TODO. BUG=None TEST=compiles Review URL: http://codereview.chromium.org/2410002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48883 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/importer/nss_decryptor.cc4
-rw-r--r--chrome/browser/safe_browsing/filter_false_positive_perftest.cc4
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_database_bloom.cc4
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_store_sqlite.cc4
-rw-r--r--chrome/browser/sync/syncable/directory_backing_store.cc4
-rw-r--r--chrome/browser/sync/util/user_settings.cc4
-rw-r--r--chrome/browser/sync/util/user_settings_unittest.cc16
7 files changed, 21 insertions, 19 deletions
diff --git a/chrome/browser/importer/nss_decryptor.cc b/chrome/browser/importer/nss_decryptor.cc
index 393732f..8cbc154 100644
--- a/chrome/browser/importer/nss_decryptor.cc
+++ b/chrome/browser/importer/nss_decryptor.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -236,7 +236,7 @@ void NSSDecryptor::ParseSignons(const std::string& content,
bool NSSDecryptor::ReadAndParseSignons(const FilePath& sqlite_file,
std::vector<webkit_glue::PasswordForm>* forms) {
sqlite3* sqlite;
- if (OpenSqliteDb(sqlite_file, &sqlite) != SQLITE_OK)
+ if (sqlite_utils::OpenSqliteDb(sqlite_file, &sqlite) != SQLITE_OK)
return false;
sqlite_utils::scoped_sqlite_db_ptr db(sqlite);
diff --git a/chrome/browser/safe_browsing/filter_false_positive_perftest.cc b/chrome/browser/safe_browsing/filter_false_positive_perftest.cc
index 27ab197..ea913d8 100644
--- a/chrome/browser/safe_browsing/filter_false_positive_perftest.cc
+++ b/chrome/browser/safe_browsing/filter_false_positive_perftest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -140,7 +140,7 @@ void BuildBloomFilter(int size_multiplier,
bool ReadDatabase(const FilePath& path, std::vector<SBPrefix>* prefixes) {
FilePath database_file = path.Append(FILE_PATH_LITERAL("database"));
sqlite3* db = NULL;
- if (OpenSqliteDb(database_file, &db) != SQLITE_OK) {
+ if (sqlite_utils::OpenSqliteDb(database_file, &db) != SQLITE_OK) {
sqlite3_close(db);
return false;
}
diff --git a/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc b/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc
index 802bbd2..b322c95 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc
@@ -295,7 +295,7 @@ bool SafeBrowsingDatabaseBloom::Open() {
if (db_)
return true;
- if (OpenSqliteDb(filename_, &db_) != SQLITE_OK) {
+ if (sqlite_utils::OpenSqliteDb(filename_, &db_) != SQLITE_OK) {
sqlite3_close(db_);
db_ = NULL;
return false;
@@ -307,7 +307,7 @@ bool SafeBrowsingDatabaseBloom::Open() {
statement_cache_.reset(new SqliteStatementCache(db_));
- if (!DoesSqliteTableExist(db_, "add_prefix")) {
+ if (!sqlite_utils::DoesSqliteTableExist(db_, "add_prefix")) {
if (!CreateTables()) {
// Database could be corrupt, try starting from scratch.
if (!ResetDatabase())
diff --git a/chrome/browser/safe_browsing/safe_browsing_store_sqlite.cc b/chrome/browser/safe_browsing/safe_browsing_store_sqlite.cc
index 37f5237..0ac8ec4 100644
--- a/chrome/browser/safe_browsing/safe_browsing_store_sqlite.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_store_sqlite.cc
@@ -98,7 +98,7 @@ bool SafeBrowsingStoreSqlite::Open() {
if (db_)
return true;
- if (OpenSqliteDb(filename_, &db_) != SQLITE_OK) {
+ if (sqlite_utils::OpenSqliteDb(filename_, &db_) != SQLITE_OK) {
sqlite3_close(db_);
db_ = NULL;
return false;
@@ -111,7 +111,7 @@ bool SafeBrowsingStoreSqlite::Open() {
statement_cache_.reset(new SqliteStatementCache(db_));
- if (!DoesSqliteTableExist(db_, "add_prefix"))
+ if (!sqlite_utils::DoesSqliteTableExist(db_, "add_prefix"))
return SetupDatabase();
return CheckCompatibleVersion();
diff --git a/chrome/browser/sync/syncable/directory_backing_store.cc b/chrome/browser/sync/syncable/directory_backing_store.cc
index 5962a02..2a29789 100644
--- a/chrome/browser/sync/syncable/directory_backing_store.cc
+++ b/chrome/browser/sync/syncable/directory_backing_store.cc
@@ -179,7 +179,7 @@ DirectoryBackingStore::~DirectoryBackingStore() {
bool DirectoryBackingStore::OpenAndConfigureHandleHelper(
sqlite3** handle) const {
- if (SQLITE_OK == OpenSqliteDb(backing_filepath_, handle)) {
+ if (SQLITE_OK == sqlite_utils::OpenSqliteDb(backing_filepath_, handle)) {
sqlite_utils::scoped_sqlite_db_ptr scoped_handle(*handle);
sqlite3_busy_timeout(scoped_handle.get(), std::numeric_limits<int>::max());
{
@@ -719,7 +719,7 @@ bool DirectoryBackingStore::SetVersion(int version) {
}
int DirectoryBackingStore::GetVersion() {
- if (!DoesSqliteTableExist(load_dbhandle_, "share_version"))
+ if (!sqlite_utils::DoesSqliteTableExist(load_dbhandle_, "share_version"))
return 0;
SQLStatement version_query;
version_query.prepare(load_dbhandle_, "SELECT data from share_version");
diff --git a/chrome/browser/sync/util/user_settings.cc b/chrome/browser/sync/util/user_settings.cc
index f8ac69b..9af7fb0 100644
--- a/chrome/browser/sync/util/user_settings.cc
+++ b/chrome/browser/sync/util/user_settings.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -178,7 +178,7 @@ bool UserSettings::Init(const FilePath& settings_path) {
ScopedDBHandle dbhandle(this);
if (dbhandle_)
sqlite3_close(dbhandle_);
- CHECK(SQLITE_OK == OpenSqliteDb(settings_path, &dbhandle_));
+ CHECK_EQ(SQLITE_OK, sqlite_utils::OpenSqliteDb(settings_path, &dbhandle_));
// In the worst case scenario, the user may hibernate his computer during
// one of our transactions.
sqlite3_busy_timeout(dbhandle_, numeric_limits<int>::max());
diff --git a/chrome/browser/sync/util/user_settings_unittest.cc b/chrome/browser/sync/util/user_settings_unittest.cc
index f17b514..073c29c 100644
--- a/chrome/browser/sync/util/user_settings_unittest.cc
+++ b/chrome/browser/sync/util/user_settings_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -38,8 +38,8 @@ class UserSettingsTest : public testing::Test {
sqlite3* primer_handle = NULL;
v10_user_setting_db_path_ =
destination_directory.Append(FilePath(kV10UserSettingsDB));
- ASSERT_EQ(SQLITE_OK, OpenSqliteDb(v10_user_setting_db_path_,
- &primer_handle));
+ ASSERT_EQ(SQLITE_OK, sqlite_utils::OpenSqliteDb(v10_user_setting_db_path_,
+ &primer_handle));
old_style_sync_data_path_ =
destination_directory.Append(FilePath(kOldStyleSyncDataDB));
@@ -91,8 +91,8 @@ class UserSettingsTest : public testing::Test {
sqlite3* primer_handle = NULL;
v11_user_setting_db_path_ =
destination_directory.Append(FilePath(kV11UserSettingsDB));
- ASSERT_EQ(SQLITE_OK, OpenSqliteDb(v11_user_setting_db_path_,
- &primer_handle));
+ ASSERT_EQ(SQLITE_OK, sqlite_utils::OpenSqliteDb(v11_user_setting_db_path_,
+ &primer_handle));
// Create settings table.
ExecOrDie(primer_handle, "CREATE TABLE settings"
@@ -162,7 +162,8 @@ TEST_F(UserSettingsTest, MigrateFromV10ToV11) {
// Now poke around using sqlite to see if UserSettings migrated properly.
sqlite3* handle = NULL;
- ASSERT_EQ(SQLITE_OK, OpenSqliteDb(v10_user_setting_db_path(), &handle));
+ ASSERT_EQ(SQLITE_OK, sqlite_utils::OpenSqliteDb(v10_user_setting_db_path(),
+ &handle));
// Note that we don't use ScopedStatement to avoid closing the sqlite handle
// before finalizing the statement.
@@ -194,7 +195,8 @@ TEST_F(UserSettingsTest, MigrateFromV11ToV12) {
settings.Init(v11_user_setting_db_path());
}
sqlite3* handle = NULL;
- ASSERT_EQ(SQLITE_OK, OpenSqliteDb(v11_user_setting_db_path(), &handle));
+ ASSERT_EQ(SQLITE_OK, sqlite_utils::OpenSqliteDb(v11_user_setting_db_path(),
+ &handle));
{
SQLStatement version_query;