Commit 4417ab30 authored by erikchen's avatar erikchen Committed by Commit bot

The SQLitePersistentCookieStore should use a non-partial index on iOS.

I recently added the "transient" partial index to the
SQLitePersistentCookieStore. iOS 8.1 and older doesn't have access to SQLite
3.8+, so it can't use partial indices. Instead, use a full index on
SQLitePersistentCookieStore on iOS.

BUG=478346

Review URL: https://codereview.chromium.org/1098883005

Cr-Commit-Position: refs/heads/master@{#327130}
parent 484fbc45
...@@ -432,9 +432,15 @@ bool InitTable(sql::Connection* db) { ...@@ -432,9 +432,15 @@ bool InitTable(sql::Connection* db) {
if (!db->Execute("CREATE INDEX domain ON cookies(host_key)")) if (!db->Execute("CREATE INDEX domain ON cookies(host_key)"))
return false; return false;
#if defined(OS_IOS)
// iOS 8.1 and older doesn't support partial indices. iOS 8.2 supports
// partial indices.
if (!db->Execute("CREATE INDEX is_transient ON cookies(persistent)")) {
#else
if (!db->Execute( if (!db->Execute(
"CREATE INDEX is_transient ON cookies(persistent) " "CREATE INDEX is_transient ON cookies(persistent) "
"where persistent != 1")) { "where persistent != 1")) {
#endif
return false; return false;
} }
...@@ -984,9 +990,16 @@ bool SQLitePersistentCookieStore::Backend::EnsureDatabaseVersion() { ...@@ -984,9 +990,16 @@ bool SQLitePersistentCookieStore::Backend::EnsureDatabaseVersion() {
return false; return false;
} }
#if defined(OS_IOS)
// iOS 8.1 and older doesn't support partial indices. iOS 8.2 supports
// partial indices.
if (!db_->Execute(
"CREATE INDEX IF NOT EXISTS is_transient ON cookies(persistent)")) {
#else
if (!db_->Execute( if (!db_->Execute(
"CREATE INDEX IF NOT EXISTS is_transient ON cookies(persistent) " "CREATE INDEX IF NOT EXISTS is_transient ON cookies(persistent) "
"where persistent != 1")) { "where persistent != 1")) {
#endif
LOG(WARNING) LOG(WARNING)
<< "Unable to create index is_transient in update to version 9."; << "Unable to create index is_transient in update to version 9.";
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment