[tracker/rss-enclosures] libtracker-data, -sparql, functional-tests: Fixed some review issues



commit c9ccc9f5c43d1745f703677385d2bfc3cf42e1f2
Author: Philip Van Hoof <philip codeminded be>
Date:   Tue Sep 14 12:12:42 2010 +0200

    libtracker-data, -sparql, functional-tests: Fixed some review issues

 src/libtracker-data/tracker-db-interface-sqlite.c |   14 ++------------
 src/libtracker-sparql/tracker-cursor.vala         |   12 +++++-------
 tests/functional-tests/shared-query-test.vala     |    2 ++
 3 files changed, 9 insertions(+), 19 deletions(-)
---
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c b/src/libtracker-data/tracker-db-interface-sqlite.c
index 4c4a9a7..cf0dc24 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -91,13 +91,11 @@ struct TrackerDBStatementClass {
 
 static TrackerDBStatement *tracker_db_statement_sqlite_new   (TrackerDBInterface   *db_interface,
                                                               sqlite3_stmt         *sqlite_stmt);
+static void                tracker_db_statement_sqlite_reset (TrackerDBStatement   *stmt);
 static TrackerDBCursor    *tracker_db_cursor_sqlite_new      (sqlite3_stmt         *sqlite_stmt,
                                                               TrackerDBStatement   *ref_stmt,
                                                               TrackerPropertyType  *types,
                                                               gint                  n_types);
-static void                tracker_db_statement_sqlite_reset (TrackerDBStatement   *stmt);
-static gint                tracker_db_cursor_get_integer     (TrackerSparqlCursor  *cursor,
-                                                              guint                 column);
 static gboolean            tracker_db_cursor_get_boolean     (TrackerSparqlCursor  *cursor,
                                                               guint                 column);
 static gboolean            db_cursor_iter_next               (TrackerDBCursor      *cursor,
@@ -1191,7 +1189,7 @@ tracker_db_cursor_class_init (TrackerDBCursorClass *class)
 	sparql_cursor_class->next_finish = (gboolean (*) (TrackerSparqlCursor *, GAsyncResult *, GError **)) tracker_db_cursor_iter_next_finish;
 	sparql_cursor_class->rewind = (void (*) (TrackerSparqlCursor *)) tracker_db_cursor_rewind;
 
-	sparql_cursor_class->get_integer = (gint (*) (TrackerSparqlCursor *, gint)) tracker_db_cursor_get_integer;
+	sparql_cursor_class->get_integer = (gint64 (*) (TrackerSparqlCursor *, gint)) tracker_db_cursor_get_int;
 	sparql_cursor_class->get_double = (gdouble (*) (TrackerSparqlCursor *, gint)) tracker_db_cursor_get_double;
 	sparql_cursor_class->get_boolean = (gboolean (*) (TrackerSparqlCursor *, gint)) tracker_db_cursor_get_boolean;
 }
@@ -1384,14 +1382,6 @@ tracker_db_cursor_get_double (TrackerDBCursor *cursor,  guint column)
 	return (gdouble) sqlite3_column_double (cursor->stmt, column);
 }
 
-
-static gint
-tracker_db_cursor_get_integer (TrackerSparqlCursor *sparql_cursor,  guint column)
-{
-	TrackerDBCursor *cursor = (TrackerDBCursor *) sparql_cursor;
-	return (gint) sqlite3_column_int64 (cursor->stmt, column);
-}
-
 static gboolean
 tracker_db_cursor_get_boolean (TrackerSparqlCursor *sparql_cursor,  guint column)
 {
diff --git a/src/libtracker-sparql/tracker-cursor.vala b/src/libtracker-sparql/tracker-cursor.vala
index 0103e4a..4311143 100644
--- a/src/libtracker-sparql/tracker-cursor.vala
+++ b/src/libtracker-sparql/tracker-cursor.vala
@@ -39,6 +39,7 @@
  * @TRACKER_SPARQL_VALUE_TYPE_DOUBLE: Double value type, xsd:double
  * @TRACKER_SPARQL_VALUE_TYPE_DATETIME: Datetime value type, xsd:dateTime
  * @TRACKER_SPARQL_VALUE_TYPE_BLANK_NODE: Blank node value type
+ * @TRACKER_SPARQL_VALUE_TYPE_BOOLEAN: Boolean value type, xsd:boolean
  *
  * Enumeration with the possible types of the cursor's cells
  */
@@ -191,11 +192,10 @@ public abstract class Tracker.Sparql.Cursor : Object {
 	 *
 	 * Returns: a integer.
 	 */
-	public virtual int get_integer (int column) {
+	public virtual int64 get_integer (int column) {
 		return_val_if_fail (get_value_type (column) == ValueType.INTEGER, 0);
 		unowned string as_str = get_string (column);
-		return_val_if_fail (as_str != null, 0);
-		return as_str.to_int();
+		return as_str.to_int64();
 	}
 
 	/**
@@ -210,7 +210,6 @@ public abstract class Tracker.Sparql.Cursor : Object {
 	public virtual double get_double (int column) {
 		return_val_if_fail (get_value_type (column) == ValueType.DOUBLE, 0);
 		unowned string as_str = get_string (column);
-		return_val_if_fail (as_str != null, 0);
 		return as_str.to_double();
 	}
 
@@ -227,7 +226,6 @@ public abstract class Tracker.Sparql.Cursor : Object {
 		ValueType type = get_value_type (column);
 		return_val_if_fail (type == ValueType.BOOLEAN, 0);
 		unowned string as_str = get_string (column);
-		return_val_if_fail (as_str != null, false);
 		return (strcmp (as_str, "true") == 0);
 	}
 
@@ -240,8 +238,8 @@ public abstract class Tracker.Sparql.Cursor : Object {
 	 *
 	 * Returns: a boolean.
 	 */
-	public virtual bool get_unbound (int column) {
-		if (get_value_type (column) == ValueType.UNBOUND) {
+	public virtual bool is_bound (int column) {
+		if (get_value_type (column) != ValueType.UNBOUND) {
 			return true;
 		}
 		return false;
diff --git a/tests/functional-tests/shared-query-test.vala b/tests/functional-tests/shared-query-test.vala
index 267f3fd..4ce6405 100644
--- a/tests/functional-tests/shared-query-test.vala
+++ b/tests/functional-tests/shared-query-test.vala
@@ -26,6 +26,8 @@ public class TestApp : GLib.Object {
 				return "datetime";
 			case Sparql.ValueType.BLANK_NODE:
 				return "blank-node";
+			case Sparql.ValueType.BOOLEAN:
+				return "boolean";
 			default:
 				break;
 		}



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