diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-29 17:09:15 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-29 17:09:15 +0000 |
commit | f1775c74f4cb83320ca53b82dc4e3c28c754d6d9 (patch) | |
tree | befd62a2951f52e9b47ac1f224c8a15a2ab62865 /chrome/common | |
parent | 2da95da3c557c70318900db9a9e06876dedf3e94 (diff) | |
download | chromium_src-f1775c74f4cb83320ca53b82dc4e3c28c754d6d9.zip chromium_src-f1775c74f4cb83320ca53b82dc4e3c28c754d6d9.tar.gz chromium_src-f1775c74f4cb83320ca53b82dc4e3c28c754d6d9.tar.bz2 |
Add fieldnames to SQL statements for better forward-compatibility. Had we had this code in place already, I wouldn't have needed to rev the compatible version number in my upcoming database change >:(
I checked the rest of our sourcebase's INSERT and SELECT statements, but these were the only ones that needed to have fieldnames added (in a few cases SELECT * was appropriate).
Review URL: http://codereview.chromium.org/8684
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4130 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/net/cookie_monster_sqlite.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/chrome/common/net/cookie_monster_sqlite.cc b/chrome/common/net/cookie_monster_sqlite.cc index f4026d0..8b9c430 100644 --- a/chrome/common/net/cookie_monster_sqlite.cc +++ b/chrome/common/net/cookie_monster_sqlite.cc @@ -149,7 +149,9 @@ void SQLitePersistentCookieStore::Backend::Commit() { return; SQLITE_UNIQUE_STATEMENT(add_smt, *cache_, - "INSERT INTO cookies VALUES (?,?,?,?,?,?,?,?)"); + "INSERT INTO cookies (creation_utc, host_key, name, value, path, " + "expires_utc, secure, httponly) " + "VALUES (?,?,?,?,?,?,?,?)"); if (!add_smt.is_valid()) { NOTREACHED(); return; @@ -182,6 +184,7 @@ void SQLitePersistentCookieStore::Backend::Commit() { NOTREACHED() << "Could not add a cookie to the DB."; } break; + case PendingOperation::COOKIE_DELETE: del_smt->reset(); del_smt->bind_int64(0, po->cc().CreationDate().ToInternalValue()); @@ -189,6 +192,7 @@ void SQLitePersistentCookieStore::Backend::Commit() { NOTREACHED() << "Could not delete a cookie from the DB."; } break; + default: NOTREACHED(); break; @@ -284,7 +288,9 @@ bool SQLitePersistentCookieStore::Load( // Slurp all the cookies into the out-vector. SQLStatement smt; - if (smt.prepare(db, "SELECT * FROM cookies") != SQLITE_OK) { + if (smt.prepare(db, + "SELECT creation_utc, host_key, name, value, path, expires_utc, secure, " + "httponly FROM cookies") != SQLITE_OK) { NOTREACHED() << "select statement prep failed"; sqlite3_close(db); return false; |