aboutsummaryrefslogtreecommitdiffstats
path: root/lib/history
diff options
context:
space:
mode:
authorClaudio Saavedra <csaavedra@igalia.com>2012-01-11 01:15:50 +0800
committerXan Lopez <xan@igalia.com>2012-03-07 04:49:44 +0800
commit6267e6e241400daf0d986ea2e57d673beac06208 (patch)
treec5c52fd927a596856b17b6fbad5807b2a97c20b0 /lib/history
parente27d2f3e59743071b2d5269b274d36557a786f2f (diff)
downloadgsoc2013-epiphany-6267e6e241400daf0d986ea2e57d673beac06208.tar
gsoc2013-epiphany-6267e6e241400daf0d986ea2e57d673beac06208.tar.gz
gsoc2013-epiphany-6267e6e241400daf0d986ea2e57d673beac06208.tar.bz2
gsoc2013-epiphany-6267e6e241400daf0d986ea2e57d673beac06208.tar.lz
gsoc2013-epiphany-6267e6e241400daf0d986ea2e57d673beac06208.tar.xz
gsoc2013-epiphany-6267e6e241400daf0d986ea2e57d673beac06208.tar.zst
gsoc2013-epiphany-6267e6e241400daf0d986ea2e57d673beac06208.zip
history-service: take into account the query's result limit
Diffstat (limited to 'lib/history')
-rw-r--r--lib/history/ephy-history-service-urls-table.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/history/ephy-history-service-urls-table.c b/lib/history/ephy-history-service-urls-table.c
index 4892fd4a5..c2178eee5 100644
--- a/lib/history/ephy-history-service-urls-table.c
+++ b/lib/history/ephy-history-service-urls-table.c
@@ -256,7 +256,11 @@ ephy_history_service_find_url_rows (EphyHistoryService *self, EphyHistoryQuery *
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 ");
- statement_str = g_string_append (statement_str, "1");
+ statement_str = g_string_append (statement_str, "1 ");
+
+ if (query->limit) {
+ statement_str = g_string_append (statement_str, "LIMIT ? ");
+ }
statement = ephy_sqlite_connection_create_statement (priv->history_database,
statement_str->str, &error);
@@ -304,6 +308,14 @@ ephy_history_service_find_url_rows (EphyHistoryService *self, EphyHistoryQuery *
g_free (string);
}
+ if (query->limit)
+ if (ephy_sqlite_statement_bind_int (statement, i++, query->limit, &error) == FALSE) {
+ g_error ("Could not build urls table query statement: %s", error->message);
+ g_error_free (error);
+ g_object_unref (statement);
+ return NULL;
+ }
+
while (ephy_sqlite_statement_step (statement, &error))
urls = g_list_prepend (urls, create_url_from_statement (statement));