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

Side by Side Diff: chrome/browser/history/visitsegment_database.cc

Issue 9365030: More SQL statement usage regularization. Back-touch some (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix log messages Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/history/visitsegment_database.h" 5 #include "chrome/browser/history/visitsegment_database.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 "WHERE segments.id = ?")); 289 "WHERE segments.id = ?"));
290 290
291 if (!statement2.is_valid()) 291 if (!statement2.is_valid())
292 return; 292 return;
293 293
294 for (size_t i = 0; i < results->size(); ++i) { 294 for (size_t i = 0; i < results->size(); ++i) {
295 PageUsageData* pud = (*results)[i]; 295 PageUsageData* pud = (*results)[i];
296 statement2.BindInt64(0, pud->GetID()); 296 statement2.BindInt64(0, pud->GetID());
297 if (statement2.Step()) { 297 if (statement2.Step()) {
298 pud->SetURL(GURL(statement2.ColumnString(0))); 298 pud->SetURL(GURL(statement2.ColumnString(0)));
299 pud->SetTitle(UTF8ToUTF16(statement2.ColumnString(1))); 299 pud->SetTitle(statement2.ColumnString16(1));
300 } 300 }
301 statement2.Reset(); 301 statement2.Reset();
302 } 302 }
303 } 303 }
304 304
305 bool VisitSegmentDatabase::DeleteSegmentData(base::Time older_than) { 305 bool VisitSegmentDatabase::DeleteSegmentData(base::Time older_than) {
306 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE, 306 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
307 "DELETE FROM segment_usage WHERE time_slot < ?")); 307 "DELETE FROM segment_usage WHERE time_slot < ?"));
308 statement.BindInt64(0, older_than.LocalMidnight().ToInternalValue()); 308 statement.BindInt64(0, older_than.LocalMidnight().ToInternalValue());
309 309
(...skipping 22 matching lines...) Expand all
332 return false; 332 return false;
333 333
334 sql::Statement delete_seg(GetDB().GetCachedStatement(SQL_FROM_HERE, 334 sql::Statement delete_seg(GetDB().GetCachedStatement(SQL_FROM_HERE,
335 "DELETE FROM segments WHERE url_id = ?")); 335 "DELETE FROM segments WHERE url_id = ?"));
336 delete_seg.BindInt64(0, url_id); 336 delete_seg.BindInt64(0, url_id);
337 337
338 return delete_seg.Run(); 338 return delete_seg.Run();
339 } 339 }
340 340
341 } // namespace history 341 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698