summaryrefslogtreecommitdiffstats
path: root/chrome/browser/history/url_database.cc
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-01 22:08:40 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-01 22:08:40 +0000
commit2c6b431938793d4a687556f57df8e22927befdb4 (patch)
tree2602ae05ec2dcad5422c8a027eee343ff3edf045 /chrome/browser/history/url_database.cc
parent35d25886c6d29a2182e28f1a11d6e6141e16d5f5 (diff)
downloadchromium_src-2c6b431938793d4a687556f57df8e22927befdb4.zip
chromium_src-2c6b431938793d4a687556f57df8e22927befdb4.tar.gz
chromium_src-2c6b431938793d4a687556f57df8e22927befdb4.tar.bz2
Adds keyword_search_terms to in memory db so that we can synchronously
get past searches. BUG=none TEST=none Review URL: http://codereview.chromium.org/4087013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64668 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history/url_database.cc')
-rw-r--r--chrome/browser/history/url_database.cc28
1 files changed, 21 insertions, 7 deletions
diff --git a/chrome/browser/history/url_database.cc b/chrome/browser/history/url_database.cc
index b63d24a..3f297bd 100644
--- a/chrome/browser/history/url_database.cc
+++ b/chrome/browser/history/url_database.cc
@@ -247,16 +247,29 @@ bool URLDatabase::IsFavIconUsed(FavIconID favicon_id) {
void URLDatabase::AutocompleteForPrefix(const string16& prefix,
size_t max_results,
+ bool typed_only,
std::vector<history::URLRow>* results) {
// NOTE: this query originally sorted by starred as the second parameter. But
// as bookmarks is no longer part of the db we no longer include the order
// by clause.
results->clear();
- sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
- "SELECT" HISTORY_URL_ROW_FIELDS "FROM urls "
- "WHERE url >= ? AND url < ? AND hidden = 0 "
- "ORDER BY typed_count DESC, visit_count DESC, last_visit_time DESC "
- "LIMIT ?"));
+ const char* sql;
+ int line;
+ if (typed_only) {
+ sql = "SELECT" HISTORY_URL_ROW_FIELDS "FROM urls "
+ "WHERE url >= ? AND url < ? AND hidden = 0 AND typed_count > 0 "
+ "ORDER BY typed_count DESC, visit_count DESC, last_visit_time DESC "
+ "LIMIT ?";
+ line = __LINE__;
+ } else {
+ sql = "SELECT" HISTORY_URL_ROW_FIELDS "FROM urls "
+ "WHERE url >= ? AND url < ? AND hidden = 0 "
+ "ORDER BY typed_count DESC, visit_count DESC, last_visit_time DESC "
+ "LIMIT ?";
+ line = __LINE__;
+ }
+ sql::Statement statement(
+ GetDB().GetCachedStatement(sql::StatementID(__FILE__, line), sql));
if (!statement)
return;
@@ -327,7 +340,10 @@ bool URLDatabase::InitKeywordSearchTermsTable() {
"term LONGVARCHAR NOT NULL)")) // The actual search term.
return false;
}
+ return true;
+}
+void URLDatabase::CreateKeywordSearchTermsIndices() {
// For searching.
GetDB().Execute("CREATE INDEX keyword_search_terms_index1 ON "
"keyword_search_terms (keyword_id, lower_term)");
@@ -335,8 +351,6 @@ bool URLDatabase::InitKeywordSearchTermsTable() {
// For deletion.
GetDB().Execute("CREATE INDEX keyword_search_terms_index2 ON "
"keyword_search_terms (url_id)");
-
- return true;
}
bool URLDatabase::DropKeywordSearchTermsTable() {