Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5381)

Unified Diff: chrome/browser/history/history_database.cc

Issue 9071014: Database usage adjustment for .../history (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simplify SQL Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/history/download_database.cc ('k') | chrome/browser/history/in_memory_database.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/history_database.cc
diff --git a/chrome/browser/history/history_database.cc b/chrome/browser/history/history_database.cc
index 7a37245f4dc6d396e254f448f7ede5972c9c351b..8fcb2460f15f53cdf4d6b82b3b5524273d7ef5e7 100644
--- a/chrome/browser/history/history_database.cc
+++ b/chrome/browser/history/history_database.cc
@@ -48,13 +48,13 @@ void ComputeDatabaseMetrics(const FilePath& history_name,
UMA_HISTOGRAM_MEMORY_MB("History.DatabaseFileMB", file_mb);
sql::Statement url_count(db.GetUniqueStatement("SELECT count(*) FROM urls"));
- if (!url_count || !url_count.Step())
+ if (!url_count.Step())
return;
UMA_HISTOGRAM_COUNTS("History.URLTableCount", url_count.ColumnInt(0));
sql::Statement visit_count(db.GetUniqueStatement(
"SELECT count(*) FROM visits"));
- if (!visit_count || !visit_count.Step())
+ if (!visit_count.Step())
return;
UMA_HISTOGRAM_COUNTS("History.VisitTableCount", visit_count.ColumnInt(0));
}
@@ -188,25 +188,18 @@ bool HistoryDatabase::GetNeedsThumbnailMigration() {
bool HistoryDatabase::SetSegmentID(VisitID visit_id, SegmentID segment_id) {
sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE,
"UPDATE visits SET segment_id = ? WHERE id = ?"));
- if (!s) {
- NOTREACHED() << db_.GetErrorMessage();
- return false;
- }
s.BindInt64(0, segment_id);
s.BindInt64(1, visit_id);
DCHECK(db_.GetLastChangeCount() == 1);
+
return s.Run();
}
SegmentID HistoryDatabase::GetSegmentID(VisitID visit_id) {
sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE,
"SELECT segment_id FROM visits WHERE id = ?"));
- if (!s) {
- NOTREACHED() << db_.GetErrorMessage();
- return 0;
- }
-
s.BindInt64(0, visit_id);
+
if (s.Step()) {
if (s.ColumnType(0) == sql::COLUMN_TYPE_NULL)
return 0;
« no previous file with comments | « chrome/browser/history/download_database.cc ('k') | chrome/browser/history/in_memory_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698