diff options
author | gbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-22 19:25:51 +0000 |
---|---|---|
committer | gbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-22 19:25:51 +0000 |
commit | bed29d94d90663ab161e5832677dae9dd4d4be13 (patch) | |
tree | 0527ff3b39d74e69ac5c030fbb6ade0fad803e20 /chrome/browser/webdata/keyword_table.cc | |
parent | 443853c674eeabd922bfcda2caf0411f47c9a93c (diff) | |
download | chromium_src-bed29d94d90663ab161e5832677dae9dd4d4be13.zip chromium_src-bed29d94d90663ab161e5832677dae9dd4d4be13.tar.gz chromium_src-bed29d94d90663ab161e5832677dae9dd4d4be13.tar.bz2 |
Update webdata files to take advantage of DLOG(FATAL) in
sql/Statement and Connection.
R=shess@chromium.org
BUG=
TEST=webdata/*Test*.*
Review URL: http://codereview.chromium.org/8966003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115574 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/webdata/keyword_table.cc')
-rw-r--r-- | chrome/browser/webdata/keyword_table.cc | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/chrome/browser/webdata/keyword_table.cc b/chrome/browser/webdata/keyword_table.cc index 9243902..51ded3b 100644 --- a/chrome/browser/webdata/keyword_table.cc +++ b/chrome/browser/webdata/keyword_table.cc @@ -148,14 +148,10 @@ bool KeywordTable::AddKeyword(const TemplateURL& url) { "autogenerate_keyword, logo_id, created_by_policy, instant_url, " "last_modified, sync_guid, id) VALUES " "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")); - if (!s) { - NOTREACHED() << "Statement prepare failed"; - return false; - } BindURLToStatement(url, &s); s.BindInt64(kUrlIdPosition, url.id()); + if (!s.Run()) { - NOTREACHED(); return false; } return UpdateBackupSignature(); @@ -163,12 +159,10 @@ bool KeywordTable::AddKeyword(const TemplateURL& url) { bool KeywordTable::RemoveKeyword(TemplateURLID id) { DCHECK(id); - sql::Statement s(db_->GetUniqueStatement("DELETE FROM keywords WHERE id=?")); - if (!s) { - NOTREACHED() << "Statement prepare failed"; - return false; - } + sql::Statement s( + db_->GetUniqueStatement("DELETE FROM keywords WHERE id = ?")); s.BindInt64(0, id); + return s.Run() && UpdateBackupSignature(); } @@ -180,10 +174,7 @@ bool KeywordTable::GetKeywords(std::vector<TemplateURL*>* urls) { "suggest_url, prepopulate_id, autogenerate_keyword, logo_id, " "created_by_policy, instant_url, last_modified, sync_guid " "FROM keywords ORDER BY id ASC")); - if (!s) { - NOTREACHED() << "Statement prepare failed"; - return false; - } + while (s.Step()) { TemplateURL* template_url = new TemplateURL(); GetURLFromStatement(s, template_url); @@ -203,12 +194,9 @@ bool KeywordTable::UpdateKeyword(const TemplateURL& url) { "suggest_url=?, prepopulate_id=?, autogenerate_keyword=?, " "logo_id=?, created_by_policy=?, instant_url=?, last_modified=?, " "sync_guid=? WHERE id=?")); - if (!s) { - NOTREACHED() << "Statement prepare failed"; - return false; - } BindURLToStatement(url, &s); s.BindInt64(kUrlIdPosition, url.id()); + return s.Run() && UpdateBackupSignature(); } |