[tracker/cursor] Ported the FTS synchronization to the cursor API



commit 8435969a047358f7e79eb801fce39300dbfaccd6
Author: Philip Van Hoof <philip codeminded be>
Date:   Thu Aug 27 11:42:05 2009 +0200

    Ported the FTS synchronization to the cursor API

 src/libtracker-db/tracker-db-backup.c           |   19 ++++++++++---------
 src/libtracker-db/tracker-db-interface-sqlite.c |    5 ++++-
 2 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/src/libtracker-db/tracker-db-backup.c b/src/libtracker-db/tracker-db-backup.c
index 0620b32..b36880e 100644
--- a/src/libtracker-db/tracker-db-backup.c
+++ b/src/libtracker-db/tracker-db-backup.c
@@ -273,7 +273,7 @@ tracker_db_backup_sync_fts (void)
 	TrackerProperty   **properties, **property;
 	TrackerDBInterface *iface;
 	TrackerDBStatement *stmt;
-	TrackerDBResultSet *result_set;
+	TrackerDBCursor    *cursor;
 	GValue              id   = { 0 };
 	GValue              text = { 0 };
 	TrackerClass       *prop_class;
@@ -309,15 +309,14 @@ tracker_db_backup_sync_fts (void)
 			}
 
 			stmt = tracker_db_interface_create_statement (iface, "%s", query);
-			result_set = tracker_db_statement_execute (stmt, NULL);
-			g_object_unref (stmt);
+			cursor = tracker_db_statement_start_cursor (stmt, NULL);
 
-			if (result_set) {
-				do {
+			if (cursor) {
+				while (tracker_cursor_set_iter_next (cursor)) {
 					guint32 vid;
 
-					_tracker_db_result_set_get_value (result_set, 0, &id);
-					_tracker_db_result_set_get_value (result_set, 1, &text);
+					tracker_db_cursor_get_value (cursor, 0, &id);
+					tracker_db_cursor_get_value (cursor, 1, &text);
 
 					vid = (guint32) g_value_get_int (&id);
 
@@ -330,11 +329,13 @@ tracker_db_backup_sync_fts (void)
 					g_value_unset (&id);
 					g_value_unset (&text);
 
-				} while (tracker_db_result_set_iter_next (result_set));
+				}
 
-				g_object_unref (result_set);
+				g_object_unref (cursor);
 			}
 
+			g_object_unref (stmt);
+
 			g_free (query);
 		}
 	}
diff --git a/src/libtracker-db/tracker-db-interface-sqlite.c b/src/libtracker-db/tracker-db-interface-sqlite.c
index 43601cf..7133e95 100644
--- a/src/libtracker-db/tracker-db-interface-sqlite.c
+++ b/src/libtracker-db/tracker-db-interface-sqlite.c
@@ -956,6 +956,8 @@ tracker_db_cursor_sqlite_new (TrackerDBInterfaceSqlite	*db_interface,
 	priv->finished = FALSE;
 	priv->owns_stmt = owns_stmt;
 
+	tracker_cursor_set_iter_next (cursor);
+
 	return cursor;
 }
 
@@ -1029,7 +1031,8 @@ tracker_db_cursor_sqlite_set_iter_next (TrackerDBCursor *cursor)
 		guint result;
 
 		result = sqlite3_step (priv->stmt);
-		priv->finished = (result != SQLITE_OK || result != SQLITE_ROW);
+
+		priv->finished = (result != SQLITE_ROW);
 	}
 
 	return (!priv->finished);



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