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

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

Issue 6135001: Makes the in memory db update rows that have search terms associated (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Improve comments and forward declare Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/url_database.h" 5 #include "chrome/browser/history/url_database.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 if (!statement) 379 if (!statement)
380 return false; 380 return false;
381 381
382 statement.BindInt64(0, keyword_id); 382 statement.BindInt64(0, keyword_id);
383 statement.BindInt64(1, url_id); 383 statement.BindInt64(1, url_id);
384 statement.BindString16(2, l10n_util::ToLower(term)); 384 statement.BindString16(2, l10n_util::ToLower(term));
385 statement.BindString16(3, term); 385 statement.BindString16(3, term);
386 return statement.Run(); 386 return statement.Run();
387 } 387 }
388 388
389 bool URLDatabase::GetKeywordSearchTermRow(URLID url_id,
390 KeywordSearchTermRow* row) {
391 DCHECK(url_id);
392 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
393 "SELECT keyword_id, term FROM keyword_search_terms WHERE url_id=?"));
394 if (!statement)
395 return false;
396
397 statement.BindInt64(0, url_id);
398 if (!statement.Step())
399 return false;
400
401 if (row) {
402 row->url_id = url_id;
403 row->keyword_id = statement.ColumnInt64(0);
404 row->term = statement.ColumnString16(1);
405 }
406 return true;
407 }
408
389 void URLDatabase::DeleteAllSearchTermsForKeyword( 409 void URLDatabase::DeleteAllSearchTermsForKeyword(
390 TemplateURLID keyword_id) { 410 TemplateURLID keyword_id) {
391 DCHECK(keyword_id); 411 DCHECK(keyword_id);
392 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE, 412 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
393 "DELETE FROM keyword_search_terms WHERE keyword_id=?")); 413 "DELETE FROM keyword_search_terms WHERE keyword_id=?"));
394 if (!statement) 414 if (!statement)
395 return; 415 return;
396 416
397 statement.BindInt64(0, keyword_id); 417 statement.BindInt64(0, keyword_id);
398 statement.Run(); 418 statement.Run();
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 // this likely already exists (and the same below). 522 // this likely already exists (and the same below).
503 GetDB().Execute("CREATE INDEX urls_url_index ON urls (url)"); 523 GetDB().Execute("CREATE INDEX urls_url_index ON urls (url)");
504 } 524 }
505 525
506 void URLDatabase::CreateSupplimentaryURLIndices() { 526 void URLDatabase::CreateSupplimentaryURLIndices() {
507 // Add a favicon index. This is useful when we delete urls. 527 // Add a favicon index. This is useful when we delete urls.
508 GetDB().Execute("CREATE INDEX urls_favicon_id_INDEX ON urls (favicon_id)"); 528 GetDB().Execute("CREATE INDEX urls_favicon_id_INDEX ON urls (favicon_id)");
509 } 529 }
510 530
511 } // namespace history 531 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698