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

Unified Diff: chrome/browser/extensions/activity_log/counting_policy.cc

Issue 22901002: Fix a copy-paste error in the extension activity log code (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add comments about BindNull Created 7 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/activity_log/counting_policy.cc
diff --git a/chrome/browser/extensions/activity_log/counting_policy.cc b/chrome/browser/extensions/activity_log/counting_policy.cc
index e99fade86cce5c6677a9fe413a2327bc1508f645..b82390adb246e095b89dd8e353cf476122d62a0c 100644
--- a/chrome/browser/extensions/activity_log/counting_policy.cc
+++ b/chrome/browser/extensions/activity_log/counting_policy.cc
@@ -324,6 +324,11 @@ bool CountingPolicy::FlushDatabase(sql::Connection* db) {
update_statement.BindInt64(1, day_start.ToInternalValue());
update_statement.BindInt64(2, next_day.ToInternalValue());
for (size_t j = 0; j < matched_values.size(); j++) {
+ // A call to BindNull when matched_values contains -1 is likely not
+ // necessary as parameters default to null before they are explicitly
+ // bound. But to be completely clear, and in case a cached statement
+ // ever comes with some values already bound, we bind all parameters
+ // (even null ones) explicitly.
if (matched_values[j] == -1)
update_statement.BindNull(j + 3);
else
@@ -347,7 +352,7 @@ bool CountingPolicy::FlushDatabase(sql::Connection* db) {
insert_statement.BindInt64(0, action.time().ToInternalValue());
for (size_t j = 0; j < matched_values.size(); j++) {
if (matched_values[j] == -1)
- update_statement.BindNull(j + 1);
+ insert_statement.BindNull(j + 1);
else
insert_statement.BindInt64(j + 1, matched_values[j]);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698