[tracker/direct-access: 4/40] libtracker-data: Let TrackerDBCursor subclass TrackerSparqlCursor



commit a88a3fca575bb34832b92202aebee1ba12b43b14
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/miners/fs/Makefile.am                         |    1 +
 3 files changed, 13 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/miners/fs/Makefile.am b/src/miners/fs/Makefile.am
index 509edb5..d5749a7 100644
--- a/src/miners/fs/Makefile.am
+++ b/src/miners/fs/Makefile.am
@@ -39,6 +39,7 @@ tracker_miner_fs_SOURCES =						\
 
 tracker_miner_fs_LDADD =						\
 	$(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]