[tracker/direct-access: 19/122] libtracker-data: Let TrackerDBCursor subclass TrackerSparqlCursor



commit 5682d7317b486a4f7f953a91560d103e5c329202
Author: Jürg Billeter <j bitron ch>
Date:   Tue Jul 6 11:53:32 2010 +0200

    libtracker-data: Let TrackerDBCursor subclass TrackerSparqlCursor

 src/libtracker-data/Makefile.am                   |    1 +
 src/libtracker-data/tracker-db-interface-sqlite.c |   14 +++++++++++---
 src/libtracker-miner/Makefile.am                  |    1 +
 src/miners/fs/Makefile.am                         |    1 +
 4 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-data/Makefile.am b/src/libtracker-data/Makefile.am
index 7a37b87..55111af 100644
--- a/src/libtracker-data/Makefile.am
+++ b/src/libtracker-data/Makefile.am
@@ -79,6 +79,7 @@ libtracker_data_la_LDFLAGS =						\
 
 libtracker_data_la_LIBADD = 						\
 	$(top_builddir)/src/libtracker-common/libtracker-common.la	\
+	$(top_builddir)/src/libtracker-sparql/libtracker-sparql- TRACKER_API_VERSION@.la \
 	$(SQLITE3_LIBS)							\
 	$(DBUS_LIBS)							\
 	$(GLIB2_LIBS)							\
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c b/src/libtracker-data/tracker-db-interface-sqlite.c
index 4fd9375..2dc0efb 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -28,6 +28,8 @@
 
 #include <libtracker-common/tracker-common.h>
 
+#include <libtracker-sparql/tracker-sparql.h>
+
 #if HAVE_TRACKER_FTS
 #include <libtracker-fts/tracker-fts.h>
 #endif
@@ -56,14 +58,14 @@ struct TrackerDBInterfaceClass {
 };
 
 struct TrackerDBCursor {
-	GObject parent_instance;
+	TrackerSparqlCursor parent_instance;
 	sqlite3_stmt *stmt;
 	TrackerDBStatement *ref_stmt;
 	gboolean finished;
 };
 
 struct TrackerDBCursorClass {
-	GObjectClass parent_class;
+	TrackerSparqlCursorClass parent_class;
 };
 
 struct TrackerDBStatement {
@@ -93,7 +95,7 @@ G_DEFINE_TYPE (TrackerDBInterface, tracker_db_interface, G_TYPE_OBJECT)
 
 G_DEFINE_TYPE (TrackerDBStatement, tracker_db_statement, G_TYPE_OBJECT)
 
-G_DEFINE_TYPE (TrackerDBCursor, tracker_db_cursor, G_TYPE_OBJECT)
+G_DEFINE_TYPE (TrackerDBCursor, tracker_db_cursor, TRACKER_SPARQL_TYPE_CURSOR)
 
 void
 tracker_db_interface_sqlite_enable_shared_cache (void)
@@ -1073,8 +1075,14 @@ static void
 tracker_db_cursor_class_init (TrackerDBCursorClass *class)
 {
 	GObjectClass *object_class = G_OBJECT_CLASS (class);
+	TrackerSparqlCursorClass *sparql_cursor_class = TRACKER_SPARQL_CURSOR_CLASS (class);
 
 	object_class->finalize = tracker_db_cursor_finalize;
+
+	sparql_cursor_class->get_n_columns = (gint (*) (TrackerSparqlCursor *)) tracker_db_cursor_get_n_columns;
+	sparql_cursor_class->get_string = (const gchar * (*) (TrackerSparqlCursor *, gint, gint*)) tracker_db_cursor_get_string;
+	sparql_cursor_class->iter_next = (gboolean (*) (TrackerSparqlCursor *, GError **)) tracker_db_cursor_iter_next;
+	sparql_cursor_class->rewind = (void (*) (TrackerSparqlCursor *)) tracker_db_cursor_rewind;
 }
 
 static TrackerDBCursor *
diff --git a/src/libtracker-miner/Makefile.am b/src/libtracker-miner/Makefile.am
index ca3b003..bf9241f 100644
--- a/src/libtracker-miner/Makefile.am
+++ b/src/libtracker-miner/Makefile.am
@@ -62,6 +62,7 @@ libtracker_miner_ TRACKER_API_VERSION@_la_LDFLAGS = 	\
 
 libtracker_miner_ TRACKER_API_VERSION@_la_LIBADD = 	\
 	$(top_builddir)/src/libtracker-common/libtracker-common.la \
+	$(top_builddir)/src/libtracker-sparql/libtracker-sparql- TRACKER_API_VERSION@.la \
 	$(top_builddir)/src/libtracker-client/libtracker-client- TRACKER_API_VERSION@.la \
 	$(DBUS_LIBS)					\
 	$(GIO_LIBS)					\
diff --git a/src/miners/fs/Makefile.am b/src/miners/fs/Makefile.am
index f6655a8..fe9a705 100644
--- a/src/miners/fs/Makefile.am
+++ b/src/miners/fs/Makefile.am
@@ -37,6 +37,7 @@ tracker_miner_fs_SOURCES =						\
 tracker_miner_fs_LDADD =						\
 	$(top_builddir)/src/libtracker-client/libtracker-client- TRACKER_API_VERSION@.la \
 	$(top_builddir)/src/libtracker-miner/libtracker-miner- TRACKER_API_VERSION@.la	\
+	$(top_builddir)/src/libtracker-sparql/libtracker-sparql- TRACKER_API_VERSION@.la \
 	$(top_builddir)/src/libtracker-data/libtracker-data.la 		\
 	$(top_builddir)/src/libtracker-common/libtracker-common.la 	\
 	$(DBUS_LIBS)							\



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