| Index: chrome/browser/history/text_database.cc
|
| diff --git a/chrome/browser/history/text_database.cc b/chrome/browser/history/text_database.cc
|
| index 310f52b2af76374c86a102233bba19143f66c9c0..3f0e176c73a0411da6cf3a71fab09c3170bf4a3e 100644
|
| --- a/chrome/browser/history/text_database.cc
|
| +++ b/chrome/browser/history/text_database.cc
|
| @@ -216,33 +216,22 @@ bool TextDatabase::AddPageData(base::Time time,
|
| // Add to the pages table.
|
| sql::Statement add_to_pages(db_.GetCachedStatement(SQL_FROM_HERE,
|
| "INSERT INTO pages (url, title, body) VALUES (?,?,?)"));
|
| - if (!add_to_pages) {
|
| - NOTREACHED() << db_.GetErrorMessage();
|
| - return false;
|
| - }
|
| add_to_pages.BindString(0, url);
|
| add_to_pages.BindString(1, title);
|
| add_to_pages.BindString(2, contents);
|
| - if (!add_to_pages.Run()) {
|
| - NOTREACHED() << db_.GetErrorMessage();
|
| + if (!add_to_pages.Run())
|
| return false;
|
| - }
|
|
|
| int64 rowid = db_.GetLastInsertRowId();
|
|
|
| // Add to the info table with the same rowid.
|
| sql::Statement add_to_info(db_.GetCachedStatement(SQL_FROM_HERE,
|
| "INSERT INTO info (rowid, time) VALUES (?,?)"));
|
| - if (!add_to_info) {
|
| - NOTREACHED() << db_.GetErrorMessage();
|
| - return false;
|
| - }
|
| add_to_info.BindInt64(0, rowid);
|
| add_to_info.BindInt64(1, time.ToInternalValue());
|
| - if (!add_to_info.Run()) {
|
| - NOTREACHED() << db_.GetErrorMessage();
|
| +
|
| + if (!add_to_info.Run())
|
| return false;
|
| - }
|
|
|
| return committer.Commit();
|
| }
|
| @@ -255,10 +244,9 @@ void TextDatabase::DeletePageData(base::Time time, const std::string& url) {
|
| "SELECT info.rowid "
|
| "FROM info JOIN pages ON info.rowid = pages.rowid "
|
| "WHERE info.time=? AND pages.url=?"));
|
| - if (!select_ids)
|
| - return;
|
| select_ids.BindInt64(0, time.ToInternalValue());
|
| select_ids.BindString(1, url);
|
| +
|
| std::set<int64> rows_to_delete;
|
| while (select_ids.Step())
|
| rows_to_delete.insert(select_ids.ColumnInt64(0));
|
| @@ -266,30 +254,24 @@ void TextDatabase::DeletePageData(base::Time time, const std::string& url) {
|
| // Delete from the pages table.
|
| sql::Statement delete_page(db_.GetCachedStatement(SQL_FROM_HERE,
|
| "DELETE FROM pages WHERE rowid=?"));
|
| - if (!delete_page)
|
| - return;
|
| +
|
| for (std::set<int64>::const_iterator i = rows_to_delete.begin();
|
| i != rows_to_delete.end(); ++i) {
|
| delete_page.BindInt64(0, *i);
|
| - if (!delete_page.Run()) {
|
| - NOTREACHED();
|
| + if (!delete_page.Run())
|
| return;
|
| - }
|
| delete_page.Reset();
|
| }
|
|
|
| // Delete from the info table.
|
| sql::Statement delete_info(db_.GetCachedStatement(SQL_FROM_HERE,
|
| "DELETE FROM info WHERE rowid=?"));
|
| - if (!delete_info)
|
| - return;
|
| +
|
| for (std::set<int64>::const_iterator i = rows_to_delete.begin();
|
| i != rows_to_delete.end(); ++i) {
|
| delete_info.BindInt64(0, *i);
|
| - if (!delete_info.Run()) {
|
| - NOTREACHED();
|
| + if (!delete_info.Run())
|
| return;
|
| - }
|
| delete_info.Reset();
|
| }
|
| }
|
| @@ -297,8 +279,6 @@ void TextDatabase::DeletePageData(base::Time time, const std::string& url) {
|
| void TextDatabase::Optimize() {
|
| sql::Statement statement(db_.GetCachedStatement(SQL_FROM_HERE,
|
| "SELECT OPTIMIZE(pages) FROM pages LIMIT 1"));
|
| - if (!statement)
|
| - return;
|
| statement.Run();
|
| }
|
|
|
| @@ -316,8 +296,6 @@ void TextDatabase::GetTextMatches(const std::string& query,
|
| sql += options.body_only ? "body " : "pages ";
|
| sql += "MATCH ? AND time >= ? AND time < ? ORDER BY time DESC LIMIT ?";
|
| sql::Statement statement(db_.GetCachedStatement(SQL_FROM_HERE, sql.c_str()));
|
| - if (!statement)
|
| - return;
|
|
|
| // When their values indicate "unspecified", saturate the numbers to the max
|
| // or min to get the correct result.
|
|
|