aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorClaudio Saavedra <csaavedra@igalia.com>2012-03-03 03:15:50 +0800
committerXan Lopez <xan@igalia.com>2012-03-07 04:49:46 +0800
commit03ec152d954d554ac6cca8d26616dfa55acda460 (patch)
treee03dcdb8e8a46f2af17073918a355f32d8e17b5f /lib
parentf73a9d9a5ba6a3f7613fc566af24c75d022a27ec (diff)
downloadgsoc2013-epiphany-03ec152d954d554ac6cca8d26616dfa55acda460.tar
gsoc2013-epiphany-03ec152d954d554ac6cca8d26616dfa55acda460.tar.gz
gsoc2013-epiphany-03ec152d954d554ac6cca8d26616dfa55acda460.tar.bz2
gsoc2013-epiphany-03ec152d954d554ac6cca8d26616dfa55acda460.tar.lz
gsoc2013-epiphany-03ec152d954d554ac6cca8d26616dfa55acda460.tar.xz
gsoc2013-epiphany-03ec152d954d554ac6cca8d26616dfa55acda460.tar.zst
gsoc2013-epiphany-03ec152d954d554ac6cca8d26616dfa55acda460.zip
Allow the visits and urls queries to be host-specific
Diffstat (limited to 'lib')
-rw-r--r--lib/history/ephy-history-service-urls-table.c11
-rw-r--r--lib/history/ephy-history-service-visits-table.c11
-rw-r--r--lib/history/ephy-history-types.c1
-rw-r--r--lib/history/ephy-history-types.h1
4 files changed, 24 insertions, 0 deletions
diff --git a/lib/history/ephy-history-service-urls-table.c b/lib/history/ephy-history-service-urls-table.c
index 5473894d5..75d98ea0c 100644
--- a/lib/history/ephy-history-service-urls-table.c
+++ b/lib/history/ephy-history-service-urls-table.c
@@ -252,6 +252,9 @@ ephy_history_service_find_url_rows (EphyHistoryService *self, EphyHistoryQuery *
statement_str = g_string_append (statement_str, "WHERE ");
}
+ if (query->host > 0)
+ statement_str = g_string_append (statement_str, "urls.host = ? AND ");
+
for (substring = query->substring_list; substring != NULL; substring = substring->next)
statement_str = g_string_append (statement_str, "(urls.url LIKE ? OR urls.title LIKE ?) AND ");
@@ -298,6 +301,14 @@ ephy_history_service_find_url_rows (EphyHistoryService *self, EphyHistoryQuery *
return NULL;
}
}
+ if (query->host > 0) {
+ if (ephy_sqlite_statement_bind_int (statement, i++, (int)query->host, &error) == FALSE) {
+ g_error ("Could not build urls table query statement: %s", error->message);
+ g_error_free (error);
+ g_object_unref (statement);
+ return NULL;
+ }
+ }
for (substring = query->substring_list; substring != NULL; substring = substring->next) {
char *string = g_strdup_printf ("%%%s%%", (char*)substring->data);
if (ephy_sqlite_statement_bind_string (statement, i++, string, &error) == FALSE) {
diff --git a/lib/history/ephy-history-service-visits-table.c b/lib/history/ephy-history-service-visits-table.c
index 822a33653..b14aa4222 100644
--- a/lib/history/ephy-history-service-visits-table.c
+++ b/lib/history/ephy-history-service-visits-table.c
@@ -138,6 +138,9 @@ ephy_history_service_find_visit_rows (EphyHistoryService *self, EphyHistoryQuery
if (query->to >= 0)
statement_str = g_string_append (statement_str, "visits.visit_time <= ? AND ");
+ if (query->host > 0)
+ statement_str = g_string_append (statement_str, "urls.host = ? AND ");
+
for (substring = query->substring_list; substring != NULL; substring = substring->next) {
statement_str = g_string_append (statement_str, "(urls.url LIKE ? OR urls.title LIKE ?) AND ");
}
@@ -170,6 +173,14 @@ ephy_history_service_find_visit_rows (EphyHistoryService *self, EphyHistoryQuery
return NULL;
}
}
+ if (query->host > 0) {
+ if (ephy_sqlite_statement_bind_int (statement, i++, (int)query->host, &error) == FALSE) {
+ g_error ("Could not build urls table query statement: %s", error->message);
+ g_error_free (error);
+ g_object_unref (statement);
+ return NULL;
+ }
+ }
for (substring = query->substring_list; substring != NULL; substring = substring->next) {
char *string = g_strdup_printf ("%%%s%%", (char*)substring->data);
if (ephy_sqlite_statement_bind_string (statement, i++, string, &error) == FALSE) {
diff --git a/lib/history/ephy-history-types.c b/lib/history/ephy-history-types.c
index 0afd1908e..c003e04b2 100644
--- a/lib/history/ephy-history-types.c
+++ b/lib/history/ephy-history-types.c
@@ -210,6 +210,7 @@ ephy_history_query_copy (EphyHistoryQuery *query)
copy->to = query->to;
copy->limit = query->limit;
copy->sort_type = query->sort_type;
+ copy->host = query->host;
for (iter = query->substring_list; iter != NULL; iter = iter->next) {
copy->substring_list = g_list_prepend (copy->substring_list, g_strdup (iter->data));
diff --git a/lib/history/ephy-history-types.h b/lib/history/ephy-history-types.h
index 67af9bbe6..4ff836fc6 100644
--- a/lib/history/ephy-history-types.h
+++ b/lib/history/ephy-history-types.h
@@ -85,6 +85,7 @@ typedef struct _EphyHistoryQuery
gint64 to;
guint limit;
GList* substring_list;
+ gint host;
EphyHistorySortType sort_type;
} EphyHistoryQuery;