diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2022-11-20 12:16:58 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2022-11-21 13:56:40 +0100 |
commit | d54f5ae5b296937ff58233a9a283f46ae2800af2 (patch) | |
tree | 360b325b0e282b15c6f01332f16f39036b9d042d /src/libtracker-sparql | |
parent | 57eab62a80f0821fee0376aaec5e1d56e2025c09 (diff) | |
download | tracker-d54f5ae5b296937ff58233a9a283f46ae2800af2.tar.gz |
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
Diffstat (limited to 'src/libtracker-sparql')
-rw-r--r-- | src/libtracker-sparql/core/tracker-db-interface-sqlite.c | 2 |
1 files changed, 1 insertions, 1 deletions
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; |