[tracker/direct-access] libtracker-data: Fix rewind for direct-access, added functional test
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/direct-access] libtracker-data: Fix rewind for direct-access, added functional test
- Date: Mon, 19 Jul 2010 12:06:49 +0000 (UTC)
commit 132338403c81dfb51c5d70adb4cb5f44a5ae75bf
Author: Philip Van Hoof <philip codeminded be>
Date: Mon Jul 19 14:00:33 2010 +0200
libtracker-data: Fix rewind for direct-access, added functional test
src/Makefile.am | 1 -
src/libtracker-data/tracker-db-interface-sqlite.c | 1 +
tests/functional-tests/direct-test.vala | 47 +++++++++++++--------
3 files changed, 30 insertions(+), 19 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 640e0ec..ebbaac6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -24,7 +24,6 @@ SUBDIRS = \
plugins \
tracker-store \
tracker-control \
- tracker-utils \
tracker-extract \
tracker-writeback \
vapi
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c b/src/libtracker-data/tracker-db-interface-sqlite.c
index 500d57b..73d641e 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -1162,6 +1162,7 @@ tracker_db_cursor_rewind (TrackerDBCursor *cursor)
g_return_if_fail (TRACKER_IS_DB_CURSOR (cursor));
sqlite3_reset (cursor->stmt);
+ cursor->finished = FALSE;
}
gboolean
diff --git a/tests/functional-tests/direct-test.vala b/tests/functional-tests/direct-test.vala
index b73581a..f1ec29e 100644
--- a/tests/functional-tests/direct-test.vala
+++ b/tests/functional-tests/direct-test.vala
@@ -1,19 +1,8 @@
using Tracker;
using Tracker.Sparql;
-int
-main( string[] args )
+private int iter_cursor (Cursor cursor)
{
- Sparql.Connection con = new Tracker.Direct.Connection ();
- Cursor cursor;
-
- try {
- cursor = con.query ("SELECT ?u WHERE { ?u a rdfs:Class }");
- } catch (GLib.Error e) {
- warning ("Couldn't perform query: %s", e.message);
- return -1;
- }
-
try {
while (cursor.next()) {
int i;
@@ -28,14 +17,36 @@ main( string[] args )
warning ("Couldn't iterate query results: %s", e.message);
return -1;
}
-
- // Testing new API with GModule
-
-// print ("\n\n");
-// Lookup foo = new Lookup ();
+ return (0);
+}
+
+int
+main( string[] args )
+{
+ Sparql.Connection con = new Tracker.Direct.Connection ();
+ Cursor cursor;
+ int a;
+
+ try {
+ cursor = con.query ("SELECT ?u WHERE { ?u a rdfs:Class }");
+ } catch (GLib.Error e) {
+ warning ("Couldn't perform query: %s", e.message);
+ return -1;
+ }
+
+ a = iter_cursor (cursor);
+
+ if (a == -1)
+ return a;
+
+ print ("\nRewinding\n");
+ cursor.rewind ();
+
+ print ("\nSecond run\n");
+ a = iter_cursor (cursor);
- return( 0 );
+ return a;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]