[tracker/direct-access: 24/121] libtracker-data: Let TrackerDBCursor subclass TrackerSparqlCursor



commit 26d82f3f9e3f2dcb9c8dccce902020934fff32f1
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/libtracker-sparql/Makefile.am                 |   19 ++++++++++++++-----
 src/libtracker-sparql/tracker-cursor.vala         |    4 ++--
 src/miners/fs/Makefile.am                         |    1 +
 6 files changed, 30 insertions(+), 10 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/libtracker-sparql/Makefile.am b/src/libtracker-sparql/Makefile.am
index 56f73d2..153be2f 100644
--- a/src/libtracker-sparql/Makefile.am
+++ b/src/libtracker-sparql/Makefile.am
@@ -1,16 +1,25 @@
 include $(top_srcdir)/Makefile.decl
 
+INCLUDES =								\
+	-DG_LOG_DOMAIN=\"Tracker\"					\
+	-DTRACKER_COMPILATION						\
+	-I$(top_srcdir)/src						\
+	-I$(top_builddir)/src						\
+	$(WARN_CFLAGS)							\
+	$(GLIB2_CFLAGS)							\
+	$(GCOV_CFLAGS)
+
 lib_LTLIBRARIES = libtracker-sparql- TRACKER_API_VERSION@.la
 
 libtracker_sparqlincludedir = $(includedir)/tracker-$(TRACKER_API_VERSION)/libtracker-sparql
 
-libtracker_sparql_ TRACKER_API_VERSION@_la_VALASOURCES = \
+libtracker_sparql_la_VALASOURCES = \
 	tracker-connection.vala				\
 	tracker-cursor.vala
 
 libtracker_sparql_ TRACKER_API_VERSION@_la_SOURCES = 	\
 	libtracker-sparql.vala.stamp			\
-	$(libtracker_sparql_ TRACKER_API_VERSION@_la_VALASOURCES:.vala=.c)
+	$(libtracker_sparql_la_VALASOURCES:.vala=.c)
 
 libtracker_sparql_ TRACKER_API_VERSION@_la_LDFLAGS = 	\
 	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) 
@@ -26,7 +35,7 @@ vapi_DATA =                     			\
 	tracker-sparql-$(TRACKER_API_VERSION).vapi
 
 # Vala sources
-libtracker-sparql.vala.stamp: $(libtracker_sparql_ TRACKER_API_VERSION@_la_VALASOURCES)
+libtracker-sparql.vala.stamp: $(libtracker_sparql_la_VALASOURCES)
 	$(AM_V_GEN)$(VALAC) $(GCOV_VALAFLAGS) -C $(VALAFLAGS) --pkg gio-2.0 -H tracker-sparql.h --vapi tracker-sparql-$(TRACKER_API_VERSION).vapi $^
 	$(AM_V_GEN)touch $@
 
@@ -37,10 +46,10 @@ CLEANFILES = 						\
 	$(BUILT_SOURCES)
 
 MAINTAINERCLEANFILES =					\
-	$(libtracker_sparql_ TRACKER_API_VERSION@_la_VALASOURCES:.vala=.c) \
+	$(libtracker_sparql_la_VALASOURCES:.vala=.c) \
 	libtracker-sparql.vala.stamp			\
 	tracker-sparql.h
 
 EXTRA_DIST = 						\
-	$(libtracker_sparql_ TRACKER_API_VERSION@_la_VALASOURCES) \
+	$(libtracker_sparql_la_VALASOURCES) \
 	libtracker-sparql.vala.stamp
diff --git a/src/libtracker-sparql/tracker-cursor.vala b/src/libtracker-sparql/tracker-cursor.vala
index 0728cfe..c30861a 100644
--- a/src/libtracker-sparql/tracker-cursor.vala
+++ b/src/libtracker-sparql/tracker-cursor.vala
@@ -19,12 +19,12 @@
 
 public abstract class Tracker.Sparql.Cursor : Object {
 	public abstract int n_columns { get; }
-	public abstract unowned string get_string (int column);
+	public abstract unowned string get_string (int column, out int length = null);
 	public virtual bool interrupt () throws GLib.Error {
 		warning ("Interrupt interface called when not implemented");
 		return false;
 	}
 
 	public abstract bool iter_next () throws GLib.Error;
-	public abstract bool rewind ();
+	public abstract void rewind ();
 }
diff --git a/src/miners/fs/Makefile.am b/src/miners/fs/Makefile.am
index c97cc96..835a903 100644
--- a/src/miners/fs/Makefile.am
+++ b/src/miners/fs/Makefile.am
@@ -34,6 +34,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]