[tracker/cursor: 4/15] libtracker-data: Use Cursor instead of ResultSet in backup-test



commit 979cc088174636c66b8bce4c30d0d0164cf47b83
Author: Jürg Billeter <j bitron ch>
Date:   Tue Jan 18 15:49:29 2011 +0100

    libtracker-data: Use Cursor instead of ResultSet in backup-test

 tests/libtracker-data/tracker-backup-test.c |   29 ++++++++++++++------------
 1 files changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/tests/libtracker-data/tracker-backup-test.c b/tests/libtracker-data/tracker-backup-test.c
index b5d7792..f9fd51b 100644
--- a/tests/libtracker-data/tracker-backup-test.c
+++ b/tests/libtracker-data/tracker-backup-test.c
@@ -54,25 +54,28 @@ check_content_in_db (gint expected_instances, gint expected_relations)
 	GError *error = NULL;
 	const gchar  *query_instances_1 = "SELECT ?u WHERE { ?u a foo:class1. }";
 	const gchar  *query_relation = "SELECT ?a ?b WHERE { ?a foo:propertyX ?b }";
-	TrackerDBResultSet *result_set;
+	TrackerDBCursor *cursor;
+	gint n_rows;
 
-	result_set = tracker_data_query_sparql (query_instances_1, &error);
+	cursor = tracker_data_query_sparql_cursor (query_instances_1, &error);
 	g_assert_no_error (error);
-	if (expected_instances == 0) {
-		g_assert (result_set == NULL);
-	} else {
-		g_assert_cmpint (tracker_db_result_set_get_n_rows (result_set), ==, expected_instances);
-		g_object_unref (result_set);
+	n_rows = 0;
+	while (tracker_db_cursor_iter_next (cursor, NULL, &error)) {
+		n_rows++;
 	}
+	g_assert_no_error (error);
+	g_assert_cmpint (n_rows, ==, expected_instances);
+	g_object_unref (cursor);
 
-	result_set = tracker_data_query_sparql (query_relation, &error);
+	cursor = tracker_data_query_sparql_cursor (query_relation, &error);
 	g_assert_no_error (error);
-	if (expected_relations == 0) {
-		g_assert (result_set == NULL);
-	} else {
-		g_assert_cmpint (tracker_db_result_set_get_n_rows (result_set), ==, expected_relations);
-		g_object_unref (result_set);
+	n_rows = 0;
+	while (tracker_db_cursor_iter_next (cursor, NULL, &error)) {
+		n_rows++;
 	}
+	g_assert_no_error (error);
+	g_assert_cmpint (n_rows, ==, expected_relations);
+	g_object_unref (cursor);
 
 	return TRUE;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]