[tracker/direct-access: 30/90] libtracker-sparql: Added plugin loader class



commit bdc2ef53a59e214597cddc344e213633fa8d757c
Author: Martyn Russell <martyn lanedo com>
Date:   Tue Jul 13 12:23:09 2010 +0100

    libtracker-sparql: Added plugin loader class
    
    Now we can dynamically load the direct access library. For now, the
    environment variable TRACKER_SPARQL_MODULE_PATH must be set though.
    
    The Tracker.Sparql.Lookup class is named so because .Query is already
    taken for now.

 src/libtracker-direct/Makefile.am             |    2 +-
 src/libtracker-direct/tracker-connection.vala |    5 +++++
 tests/functional-tests/direct-test.vala       |   24 +++++++++++++++---------
 3 files changed, 21 insertions(+), 10 deletions(-)
---
diff --git a/src/libtracker-direct/Makefile.am b/src/libtracker-direct/Makefile.am
index 5c9d4cc..935c0fa 100644
--- a/src/libtracker-direct/Makefile.am
+++ b/src/libtracker-direct/Makefile.am
@@ -23,7 +23,7 @@ libtracker_direct_ TRACKER_API_VERSION@_la_SOURCES = 	\
 	$(libtracker_direct_la_VALASOURCES:.vala=.c)
 
 libtracker_direct_ TRACKER_API_VERSION@_la_LDFLAGS = 	\
-	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) 
+	-shared -fPIC -module -avoid-version
 
 #	-export-symbols-regex '^tracker_.*'
 
diff --git a/src/libtracker-direct/tracker-connection.vala b/src/libtracker-direct/tracker-connection.vala
index 444bb85..f3bbbb9 100644
--- a/src/libtracker-direct/tracker-connection.vala
+++ b/src/libtracker-direct/tracker-connection.vala
@@ -40,3 +40,8 @@ public class Tracker.Direct.Connection : Tracker.Sparql.Connection {
 		return cursor;
 	}
 }
+
+public Tracker.Sparql.Connection module_init (Tracker.Sparql.PluginLoader loader) {
+	Tracker.Sparql.Connection plugin = new Tracker.Direct.Connection ();
+	return plugin;
+}
diff --git a/tests/functional-tests/direct-test.vala b/tests/functional-tests/direct-test.vala
index 3269396..36c5243 100644
--- a/tests/functional-tests/direct-test.vala
+++ b/tests/functional-tests/direct-test.vala
@@ -5,18 +5,24 @@ using Tracker.Direct;
 int
 main( string[] args )
 {
-	Sparql.Connection con = new Direct.Connection ();
-	Cursor cursor = con.query ("SELECT ?u WHERE { ?u a rdfs:Class }");
+//	Sparql.Connection con = new Direct.Connection ();
+//	Cursor cursor = con.query ("SELECT ?u WHERE { ?u a rdfs:Class }");
 
-	while (cursor.iter_next()) {
-		int i;
+//	while (cursor.iter_next()) {
+//		int i;
 
-		for (i = 0; i < cursor.n_columns; i++) {
-			print ("%s%s", i != 0 ? ",":"", cursor.get_string (i));
-		}
+//		for (i = 0; i < cursor.n_columns; i++) {
+//			print ("%s%s", i != 0 ? ",":"", cursor.get_string (i));
+//		}
 
-		print ("\n");
-	}
+//		print ("\n");
+//	}
+	
+	// Testing new API with GModule
+	
+	print ("\n\n");
+
+	Lookup foo = new Lookup ();
 
 	return( 0 );
 }



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