[tracker/return-types] libtracker-data: Implement optimized versions for direct-access, for typed convenience funtions
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/return-types] libtracker-data: Implement optimized versions for direct-access, for typed convenience funtions
- Date: Mon, 13 Sep 2010 15:20:43 +0000 (UTC)
commit f6b53e2d6bc1be3eb62177bdc43119837028fdb2
Author: Philip Van Hoof <philip codeminded be>
Date: Mon Sep 13 17:20:15 2010 +0200
libtracker-data: Implement optimized versions for direct-access, for typed convenience funtions
src/libtracker-data/tracker-db-interface-sqlite.c | 23 ++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c b/src/libtracker-data/tracker-db-interface-sqlite.c
index 71c658c..a22a87d 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -91,7 +91,9 @@ static TrackerDBCursor * tracker_db_cursor_sqlite_new (sqlite3_stmt
TrackerDBStatement *ref_stmt,
TrackerPropertyType *types,
gint n_types);
-static void tracker_db_statement_sqlite_reset (TrackerDBStatement *stmt);
+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);
enum {
PROP_0,
@@ -1125,6 +1127,10 @@ tracker_db_cursor_class_init (TrackerDBCursorClass *class)
sparql_cursor_class->next_async = (void (*) (TrackerSparqlCursor *, GCancellable *, GAsyncReadyCallback, gpointer)) tracker_db_cursor_iter_next_async;
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_double = (gdouble (*) (TrackerSparqlCursor *, gint)) tracker_db_cursor_get_double;
+ sparql_cursor_class->get_boolean = (gboolean (*) (TrackerSparqlCursor *, gint)) tracker_db_cursor_get_boolean;
}
static TrackerDBCursor *
@@ -1303,6 +1309,21 @@ 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)
+{
+ TrackerDBCursor *cursor = (TrackerDBCursor *) sparql_cursor;
+ return (g_strcmp0 (sqlite3_column_text (cursor->stmt, column), "true") == 0);
+}
+
TrackerSparqlValueType
tracker_db_cursor_get_value_type (TrackerDBCursor *cursor, guint column)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]