| Index: chrome/browser/history/starred_url_database.cc
|
| diff --git a/chrome/browser/history/starred_url_database.cc b/chrome/browser/history/starred_url_database.cc
|
| index c6ffceba600b97f8d228cae0397605a7fc1d7cb8..c0d976a414494ad042fec5660ed28cb31e6e6b0a 100644
|
| --- a/chrome/browser/history/starred_url_database.cc
|
| +++ b/chrome/browser/history/starred_url_database.cc
|
| @@ -150,10 +150,8 @@ bool StarredURLDatabase::GetAllStarredEntries(
|
| sql += "ORDER BY parent_id, visual_order";
|
|
|
| sql::Statement s(GetDB().GetUniqueStatement(sql.c_str()));
|
| - if (!s) {
|
| - NOTREACHED() << "Statement prepare failed";
|
| + if (!s.is_valid())
|
| return false;
|
| - }
|
|
|
| history::StarredEntry entry;
|
| while (s.Step()) {
|
| @@ -199,14 +197,12 @@ bool StarredURLDatabase::UpdateStarredEntryRow(StarID star_id,
|
| sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
|
| "UPDATE starred SET title=?, parent_id=?, visual_order=?, "
|
| "date_modified=? WHERE id=?"));
|
| - if (!statement)
|
| - return 0;
|
| -
|
| statement.BindString16(0, title);
|
| statement.BindInt64(1, parent_folder_id);
|
| statement.BindInt(2, visual_order);
|
| statement.BindInt64(3, date_modified.ToInternalValue());
|
| statement.BindInt64(4, star_id);
|
| +
|
| return statement.Run();
|
| }
|
|
|
| @@ -217,12 +213,10 @@ bool StarredURLDatabase::AdjustStarredVisualOrder(UIStarID parent_folder_id,
|
| sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
|
| "UPDATE starred SET visual_order=visual_order+? "
|
| "WHERE parent_id=? AND visual_order >= ?"));
|
| - if (!statement)
|
| - return false;
|
| -
|
| statement.BindInt(0, delta);
|
| statement.BindInt64(1, parent_folder_id);
|
| statement.BindInt(2, start_visual_order);
|
| +
|
| return statement.Run();
|
| }
|
|
|
| @@ -239,8 +233,6 @@ StarID StarredURLDatabase::CreateStarredEntryRow(URLID url_id,
|
| "INSERT INTO starred "
|
| "(type, url_id, group_id, title, date_added, visual_order, parent_id, "
|
| "date_modified) VALUES (?,?,?,?,?,?,?,?)"));
|
| - if (!statement)
|
| - return 0;
|
|
|
| switch (type) {
|
| case history::StarredEntry::URL:
|
| @@ -265,6 +257,7 @@ StarID StarredURLDatabase::CreateStarredEntryRow(URLID url_id,
|
| statement.BindInt(5, visual_order);
|
| statement.BindInt64(6, parent_folder_id);
|
| statement.BindInt64(7, base::Time().ToInternalValue());
|
| +
|
| if (statement.Run())
|
| return GetDB().GetLastInsertRowId();
|
| return 0;
|
| @@ -273,10 +266,8 @@ StarID StarredURLDatabase::CreateStarredEntryRow(URLID url_id,
|
| bool StarredURLDatabase::DeleteStarredEntryRow(StarID star_id) {
|
| sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
|
| "DELETE FROM starred WHERE id=?"));
|
| - if (!statement)
|
| - return false;
|
| -
|
| statement.BindInt64(0, star_id);
|
| +
|
| return statement.Run();
|
| }
|
|
|
| @@ -285,9 +276,6 @@ bool StarredURLDatabase::GetStarredEntry(StarID star_id, StarredEntry* entry) {
|
| sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
|
| "SELECT" STAR_FIELDS "FROM starred LEFT JOIN urls ON "
|
| "starred.url_id = urls.id WHERE starred.id=?"));
|
| - if (!statement)
|
| - return false;
|
| -
|
| statement.BindInt64(0, star_id);
|
|
|
| if (statement.Step()) {
|
| @@ -345,12 +333,8 @@ StarID StarredURLDatabase::CreateStarredEntry(StarredEntry* entry) {
|
| UIStarID StarredURLDatabase::GetMaxFolderID() {
|
| sql::Statement max_folder_id_statement(GetDB().GetUniqueStatement(
|
| "SELECT MAX(group_id) FROM starred"));
|
| - if (!max_folder_id_statement) {
|
| - NOTREACHED() << GetDB().GetErrorMessage();
|
| - return 0;
|
| - }
|
| +
|
| if (!max_folder_id_statement.Step()) {
|
| - NOTREACHED() << GetDB().GetErrorMessage();
|
| return 0;
|
| }
|
| return max_folder_id_statement.ColumnInt64(0);
|
|
|