44 lines
1.8 KiB
Diff
44 lines
1.8 KiB
Diff
From d54f5ae5b296937ff58233a9a283f46ae2800af2 Mon Sep 17 00:00:00 2001
|
|
From: Carlos Garnacho <carlosg@gnome.org>
|
|
Date: Sun, 20 Nov 2022 12:16:58 +0100
|
|
Subject: [PATCH] core: Handle ROWIDs turned into strings in SparqlPrintIRI()
|
|
|
|
Even though normally we expect ROWIDs to preserve numeric affinity
|
|
when we proceed to print their IRI in the higher parts of the query,
|
|
it is not guaranteed by the SQLite documentation:
|
|
|
|
"Whether or not a persistent internal datatype conversion occurs
|
|
is undefined and may change from one release of SQLite to the next."
|
|
|
|
And this in fact changed for the core/property-paths/alternative-path-3
|
|
unit test, where it does the '|' union of text and resource (i.e. ROWIDs)
|
|
properties. Since SQLite 3.40.0, the SparqlPrintIRI() happening in the
|
|
topmost select will get SQLITE_TEXT affinity for all ROWID values received
|
|
through the union.
|
|
|
|
In order to work with both older and newer version of SQLite, attempt to
|
|
force integer affinity so ROWID IRIs are correctly resolved instead of
|
|
being interpreted as IRI strings.
|
|
|
|
Closes: https://gitlab.gnome.org/GNOME/tracker/-/issues/387
|
|
---
|
|
src/libtracker-sparql/core/tracker-db-interface-sqlite.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/src/libtracker-sparql/core/tracker-db-interface-sqlite.c b/src/libtracker-sparql/core/tracker-db-interface-sqlite.c
|
|
index ca1ebb985..68f6bd310 100644
|
|
--- a/src/libtracker-sparql/core/tracker-db-interface-sqlite.c
|
|
+++ b/src/libtracker-sparql/core/tracker-db-interface-sqlite.c
|
|
@@ -1901,7 +1901,7 @@ function_sparql_print_iri (sqlite3_context *context,
|
|
return;
|
|
}
|
|
|
|
- if (sqlite3_value_type (argv[0]) == SQLITE_INTEGER) {
|
|
+ if (sqlite3_value_numeric_type (argv[0]) == SQLITE_INTEGER) {
|
|
sqlite3_stmt *stmt;
|
|
gboolean store_auxdata = FALSE;
|
|
sqlite3 *db;
|
|
--
|
|
GitLab
|
|
|