summaryrefslogtreecommitdiffstats
path: root/app/sql/meta_table.cc
diff options
context:
space:
mode:
authormichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-29 22:46:55 +0000
committermichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-29 22:46:55 +0000
commit35f2094cd0ac27018aff2646445f44c3f9ee8d36 (patch)
tree0f4892fb2f6bcf9d5f044e70c1cf1ed0d42bb882 /app/sql/meta_table.cc
parent6d38a7fc2594f14cbb87e28389c81965381b64e8 (diff)
downloadchromium_src-35f2094cd0ac27018aff2646445f44c3f9ee8d36.zip
chromium_src-35f2094cd0ac27018aff2646445f44c3f9ee8d36.tar.gz
chromium_src-35f2094cd0ac27018aff2646445f44c3f9ee8d36.tar.bz2
AppCacheDatabase and SQL based AppCacheStorageImpl.
Still nothing is being written to disk with this CL, in-memory SQLite and DiskCaches are being utilized. Responses are not yet being removed from the DiskCasche when the should be. Once that's done (in the next CL), we'll start saving things on disk. BUG=none TEST=appcache_database_unittest.cc, appcache_storage_impl_unittest.cc Review URL: http://codereview.chromium.org/518020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35354 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/sql/meta_table.cc')
-rw-r--r--app/sql/meta_table.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/sql/meta_table.cc b/app/sql/meta_table.cc
index 03a1245..4d7c5e1 100644
--- a/app/sql/meta_table.cc
+++ b/app/sql/meta_table.cc
@@ -15,6 +15,12 @@ namespace sql {
static const char kVersionKey[] = "version";
static const char kCompatibleVersionKey[] = "last_compatible_version";
+// static
+bool MetaTable::DoesTableExist(sql::Connection* db) {
+ DCHECK(db);
+ return db->DoesTableExist("meta");
+}
+
MetaTable::MetaTable() : db_(NULL) {
}
@@ -24,7 +30,7 @@ MetaTable::~MetaTable() {
bool MetaTable::Init(Connection* db, int version, int compatible_version) {
DCHECK(!db_ && db);
db_ = db;
- if (!db_->DoesTableExist("meta")) {
+ if (!DoesTableExist(db)) {
if (!db_->Execute("CREATE TABLE meta"
"(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,"
"value LONGVARCHAR)"))
@@ -117,7 +123,7 @@ bool MetaTable::PrepareSetStatement(Statement* statement, const char* key) {
DCHECK(db_ && statement);
statement->Assign(db_->GetCachedStatement(SQL_FROM_HERE,
"INSERT OR REPLACE INTO meta (key,value) VALUES (?,?)"));
- if (!*statement) {
+ if (!statement->is_valid()) {
NOTREACHED() << db_->GetErrorMessage();
return false;
}
@@ -129,7 +135,7 @@ bool MetaTable::PrepareGetStatement(Statement* statement, const char* key) {
DCHECK(db_ && statement);
statement->Assign(db_->GetCachedStatement(SQL_FROM_HERE,
"SELECT value FROM meta WHERE key=?"));
- if (!*statement) {
+ if (!statement->is_valid()) {
NOTREACHED() << db_->GetErrorMessage();
return false;
}