[tracker/wip/carlosg/serialize-api: 4/13] libtracker-data: Forward number of columns to cursor
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/serialize-api: 4/13] libtracker-data: Forward number of columns to cursor
- Date: Wed, 2 Feb 2022 13:48:32 +0000 (UTC)
commit 84786e26959fc42cedc52a342d0c6a8c7ac5a25f
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Jan 30 12:52:59 2022 +0100
libtracker-data: Forward number of columns to cursor
This way, we can allow the amount of columns as seen by the user
differ from the real number of columns. These extra columns might
bring additional per-row data, like correct column value types
that do not depend on static information or lacking (from our
perspective) SQLite type information.
src/libtracker-data/tracker-db-interface-sqlite.c | 3 ++-
src/libtracker-data/tracker-db-interface.h | 1 +
src/libtracker-data/tracker-sparql.c | 9 ++++++---
3 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c
b/src/libtracker-data/tracker-db-interface-sqlite.c
index 6fec55741..53a53af2d 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -3693,6 +3693,7 @@ tracker_db_statement_start_cursor (TrackerDBStatement *stmt,
TrackerDBCursor *
tracker_db_statement_start_sparql_cursor (TrackerDBStatement *stmt,
+ guint n_columns,
TrackerPropertyType *types,
guint n_types,
GError **error)
@@ -3700,7 +3701,7 @@ tracker_db_statement_start_sparql_cursor (TrackerDBStatement *stmt,
g_return_val_if_fail (TRACKER_IS_DB_STATEMENT (stmt), NULL);
g_return_val_if_fail (!stmt->stmt_is_used, NULL);
- return tracker_db_cursor_sqlite_new (stmt, 0, types, n_types);
+ return tracker_db_cursor_sqlite_new (stmt, n_columns, types, n_types);
}
static void
diff --git a/src/libtracker-data/tracker-db-interface.h b/src/libtracker-data/tracker-db-interface.h
index 83e0e9438..67b76704d 100644
--- a/src/libtracker-data/tracker-db-interface.h
+++ b/src/libtracker-data/tracker-db-interface.h
@@ -143,6 +143,7 @@ void tracker_db_statement_execute (TrackerDBS
TrackerDBCursor * tracker_db_statement_start_cursor (TrackerDBStatement *stmt,
GError **error);
TrackerDBCursor * tracker_db_statement_start_sparql_cursor (TrackerDBStatement *stmt,
+ guint n_columns,
TrackerPropertyType *types,
guint n_types,
GError **error);
diff --git a/src/libtracker-data/tracker-sparql.c b/src/libtracker-data/tracker-sparql.c
index bb62db65d..16b7a567f 100644
--- a/src/libtracker-data/tracker-sparql.c
+++ b/src/libtracker-data/tracker-sparql.c
@@ -4646,7 +4646,7 @@ get_solution_for_pattern (TrackerSparql *sparql,
iface = tracker_data_manager_get_writable_db_interface (sparql->data_manager);
stmt = prepare_query (sparql, iface,
- TRACKER_SELECT_CONTEXT (sparql->context)->literal_bindings,
+ TRACKER_SELECT_CONTEXT (sparql->context)->literal_bindings,
NULL, TRUE,
error);
g_clear_object (&sparql->context);
@@ -4654,7 +4654,7 @@ get_solution_for_pattern (TrackerSparql *sparql,
if (!stmt)
return NULL;
- cursor = tracker_db_statement_start_sparql_cursor (stmt,
+ cursor = tracker_db_statement_start_sparql_cursor (stmt, 0,
NULL, 0,
error);
g_object_unref (stmt);
@@ -9951,6 +9951,7 @@ tracker_sparql_execute_cursor (TrackerSparql *sparql,
TrackerDBStatement *stmt;
TrackerDBInterface *iface = NULL;
TrackerDBCursor *cursor = NULL;
+ TrackerSelectContext *select_context;
TrackerPropertyType *types;
guint n_types;
@@ -9992,8 +9993,9 @@ tracker_sparql_execute_cursor (TrackerSparql *sparql,
if (!iface)
goto error;
+ select_context = TRACKER_SELECT_CONTEXT (sparql->context);
stmt = prepare_query (sparql, iface,
- TRACKER_SELECT_CONTEXT (sparql->context)->literal_bindings,
+ select_context->literal_bindings,
parameters,
sparql->cacheable,
error);
@@ -10004,6 +10006,7 @@ tracker_sparql_execute_cursor (TrackerSparql *sparql,
n_types = sparql->var_types->len;
cursor = tracker_db_statement_start_sparql_cursor (stmt,
+ select_context->n_columns,
types, n_types,
error);
g_object_unref (stmt);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]