[tracker/wip/carlosg/serialize-api: 25/36] 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: 25/36] libtracker-data: Forward number of columns to cursor
- Date: Fri, 4 Feb 2022 18:24:10 +0000 (UTC)
commit 9df641d9c02c0f4fc42556a7adc23159095e133b
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 499d5c96d..bb1357603 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -3700,6 +3700,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)
@@ -3707,7 +3708,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 e8a6e7c25..364d32f0e 100644
--- a/src/libtracker-data/tracker-sparql.c
+++ b/src/libtracker-data/tracker-sparql.c
@@ -4647,7 +4647,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);
@@ -4655,7 +4655,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);
@@ -9952,6 +9952,7 @@ tracker_sparql_execute_cursor (TrackerSparql *sparql,
TrackerDBStatement *stmt;
TrackerDBInterface *iface = NULL;
TrackerDBCursor *cursor = NULL;
+ TrackerSelectContext *select_context;
TrackerPropertyType *types;
guint n_types;
@@ -9993,8 +9994,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);
@@ -10005,6 +10007,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]