[tracker] Ported tracker_data_update_get_next_modseq to use cursor API



commit 47619ac6b61bf9c70a8a33b68d90e3a7bf8f6017
Author: Philip Van Hoof <philip codeminded be>
Date:   Mon Aug 31 14:02:59 2009 +0200

    Ported tracker_data_update_get_next_modseq to use cursor API

 src/libtracker-data/tracker-data-update.c |   26 +++++++++++---------------
 1 files changed, 11 insertions(+), 15 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index f9fc870..ed89100 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -152,13 +152,12 @@ tracker_data_update_get_new_service_id (TrackerDBInterface *iface)
 	return ++max;
 }
 
-
 static guint32
 tracker_data_update_get_next_modseq (void)
 {
-	guint32		    files_max;
-	TrackerDBResultSet *result_set;
+	TrackerDBCursor    *cursor;
 	TrackerDBInterface *temp_iface;
+	TrackerDBStatement *stmt;
 	static guint32	    max = 0;
 
 	if (G_LIKELY (max != 0)) {
@@ -167,18 +166,15 @@ tracker_data_update_get_next_modseq (void)
 
 	temp_iface = tracker_db_manager_get_db_interface ();
 
-	result_set = tracker_db_interface_execute_query (temp_iface, NULL,
-							 "SELECT MAX(\"tracker:modified\") AS A FROM \"rdfs:Resource\"");
+	stmt = tracker_db_interface_create_statement (temp_iface, 
+	                                              "SELECT MAX(\"tracker:modified\") AS A FROM \"rdfs:Resource\"");
+	cursor = tracker_db_statement_start_cursor (stmt, NULL);
+	g_object_unref (stmt);
 
-	if (result_set) {
-		GValue val = {0, };
-		_tracker_db_result_set_get_value (result_set, 0, &val);
-		if (G_VALUE_TYPE (&val) == G_TYPE_INT) {
-			files_max = g_value_get_int (&val);
-			max = MAX (files_max, max);
-			g_value_unset (&val);
-		}
-		g_object_unref (result_set);
+	if (cursor) {
+		tracker_db_cursor_iter_next (cursor);
+		max = MAX (tracker_db_cursor_get_int (cursor, 0), max);
+		g_object_unref (cursor);
 	}
 
 	return ++max;



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