summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* tests: Add test for coalesce behavior with URNswip/carlosg/fix-tracker-searchCarlos Garnacho2018-11-173-0/+3
|
* libtracker-data: Convert coalesced elements to stringCarlos Garnacho2018-11-171-0/+4
| | | | | | | | | | | | | | | Dropping that possibly fixes coalescing of URNs and datetimes with other types transparently handled by SQLite. Eg. this broke the "tracker search" CLI subcommand, where it uses: SELECT COALESCE(nie:url(?u), ?u) ... This resulted in "tracker search foo" returning "(null)" as the file uri/urn. We must translate each Expression to string so that correctly results in the URL string being coalesced with the URN string. This is the expected result, and a regression compared to the older parser.
* libtracker-data: Convert arguments to string in string functionsCarlos Garnacho2018-11-171-1/+40
| | | | | | | | This results in eg. URN strings or ISO8601 dates being passed to those if used in one such function, instead of ROWIDs or timestamps. It's unclear how that should behave as per the spec, this is however what the old parser did, so better to stick to the same implementation defined behavior.
* libtracker-data: Add builtin way to convert a Expression to a stringCarlos Garnacho2018-11-171-0/+20
| | | | | | | The Expression element may be used in several places (eg. ArgList or ExpressionList in functions) that may require them to be converted to string, add a builtin toggle in the state so this can ben done easily.
* tests: Add test for resource to string casts in select argumentsCarlos Garnacho2018-11-173-0/+3
|
* tests: Add test for ORDER BY an undefined variableCarlos Garnacho2018-11-173-0/+14
|
* libtracker-data: Do not force cursor column types to be stringsCarlos Garnacho2018-11-171-3/+1
| | | | | | | | We must propagate the original types, despite converting the resultset to string in the topmost select. Fixes warnings in the bus backend (seen with several flatpak apps), since it's not as lenient as the direct one wrt fetching values with the "wrong" vfunc.
* libtracker-bus: Make error clearerCarlos Garnacho2018-11-171-1/+7
| | | | | | | | The data != null check in get_string() really happens because of fetching values on a finished or not yet started cursor, so make it clearer to reason about. This is of course a programming error.
* libtracker-bus: Make cursor conform to API docsCarlos Garnacho2018-11-171-1/+6
| | | | | It says "NULL is returned if column is not between [0,n_columns]", says nothing about it being a programming error though.
* libtracker-data: Ensure conversion to string in topmost SELECTCarlos Garnacho2018-11-151-1/+3
| | | | | | We were missing it in the "SELECT ?a AS ?b ..." case, breaking those types that require a conversion to string when exposed through a cursor (resource, and presumably date/datetime).
* libtracker-data: Fix crash on unbound variables in ORDER BYCarlos Garnacho2018-11-151-1/+2
| | | | | | | Unbound variables are unexpected/meaningless here, the spec says nothing about raising errors though, and other SPARQL engines seem to agree about it being a no-op. So just go with it and avoid the crash.
* Merge branch 'wip/carlosg/issue-56'Carlos Garnacho2018-11-140-0/+0
|\
| * libtracker-data: Also set up blank node map on InsertDatawip/carlosg/issue-56Carlos Garnacho2018-11-131-0/+14
| | | | | | | | | | | | | | The blank node map must be set up there, both for the URN storage aspect and the GVariant generation one. Closes: https://gitlab.gnome.org/GNOME/tracker/issues/56
* | libtracker-data: Also set up blank node map on InsertDataCarlos Garnacho2018-11-131-0/+14
|/ | | | | The blank node map must be set up there, both for the URN storage aspect and the GVariant generation one.
* libtracker-data: Always set up blank node map on InsertClauseCarlos Garnacho2018-11-131-4/+5
| | | | | | | | Commit c58f7aa419 late in wip/carlosg/sparql-parser-ng wrongly made this dependent on the query being an update_blank() one (i.e. we need to generate a GVariant with blank node results to give back). This actually defeated the path where we generate unique URNs for blank nodes on inserts, resulting in simple urns like <1> being generated.
* libtracker-data: Perform caseless comparisonCarlos Garnacho2018-11-131-1/+1
| | | | | | The SPARQL protocol is supposedly case insensitive, and TrackerResource uses "TRUE"/"FALSE" for boolean strings. We must use caseless comparion or we get false negatives.
* fooCarlos Garnacho2018-11-131-1/+1
|
* tracker: Fix search subcommandCarlos Garnacho2018-11-131-2/+2
| | | | | The SPARQL was referring to a non-existent variable, which older parser used to ignore.
* Release 2.2.0-alpha12.2.0-alpha1Carlos Garnacho2018-11-131-0/+20
|
* Merge branch 'wip/carlosg/automatic-store-shutdown'Carlos Garnacho2018-11-137-92/+105
|\
| * tracker-store: Automatically shutdown on inactivitywip/carlosg/automatic-store-shutdownCarlos Garnacho2018-11-132-11/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the right conditions apply, tracker-store will shut down after 30s of inactivity (no clients doing updates/selects). Bringing it back again is relatively cheap, so let's see how this flies. For the cases it won't, tracker-store has a --disable-shutdown switch (also useful for testing from terminal), also running on other buses than the session one will disable it, since both shutting down and later restart pose questions and risks. In theory, this will make tracker-store disappear 99% of the time, since database updates are sparse. There's also the possibility of clients running with TRACKER_SPARQL_BACKEND=bus or resorting to bus connection (eg. flatpak apps), that will make selects go through tracker-store.
| * libtracker-miner: Drop pause/resume on tracker-store name availabilityCarlos Garnacho2018-11-131-68/+0
| | | | | | | | | | This no longer makes sense with tracker-store automatic shutdown, assume the activatable through DBus and keep the miner running in that situation.
| * libtracker-bus: Avoid pinging tracker-store on initializationCarlos Garnacho2018-11-134-13/+25
|/ | | | | | | | | | | Avoid possibly raising tracker-store when initializating a bus connection. This can be done in a delayed manner (eg. when some other dbus message is sent in its way). There is one situation where this is necessary though, the database may not exist yet. In this case we must poke tracker-store before setting up the direct connection. Detect those cases by handling direct connection initialization errors.
* Merge branch 'wip/carlosg/sparql-parser-ng'Carlos Garnacho2018-11-1377-4509/+12618
|\
| * libtracker-sparql: Silence -Wformat-security warningwip/carlosg/sparql-parser-ngCarlos Garnacho2018-11-131-9/+9
| | | | | | | | | | | | Since we no longer pass the string directly, we must also avoid the escaping of the strftime format modifiers. Those aren't any longer at risk of being mistaken for printf ones.
| * libtracker-sparql: Avoid implicitly relying on hashtable iteration orderCarlos Garnacho2018-11-131-12/+8
| | | | | | | | | | | | Recent GLib changed the hashtable hashing, thus changing the order in which the contents are iterated by a GHashTableIter. Avoid doing that in the one place we used to (also used to happen in previous vala code).
| * tests: Add some tests for the supported property pathsCarlos Garnacho2018-11-1318-0/+99
| | | | | | | | Inverse and sequence paths are tested thus far.
| * docs: Add references to TrackerSparqlStatementCarlos Garnacho2018-11-133-0/+27
| |
| * libtracker-data: Make unimplemented property path errors more specificCarlos Garnacho2018-11-131-4/+5
| | | | | | | | There's now partial support of property paths, so better be specific.
| * libtracker-data: Support sequence property pathCarlos Garnacho2018-11-131-3/+24
| | | | | | | | | | | | "?a :foo/:bar ?b" is equivalent to "?a :foo ?gen . ?gen :bar ?b", make the parser make up those generated variables before processing the current predicate property.
| * libtracker-data: Support inverse property pathCarlos Garnacho2018-11-131-1/+13
| | | | | | | | | | "?a ^:foo ?b" is equivalent to "?b :foo ?a", invert the subject/predicate in order to handle this.
| * libtracker-data: Prepare for property pathsCarlos Garnacho2018-11-131-17/+28
| | | | | | | | | | | | | | Property paths may introduce intermediate anonymous resources, or shuffle subject/object. We still do the bulk of the job while parsing the predicate, so prepare for the predicate being pre-filled, and the Path grammar element to alter the next parsed token.
| * tests: Add an FTS testCarlos Garnacho2018-11-133-1/+3
| | | | | | | | | | This query form was broken in the previous parser, add a test for it now that it is supported.
| * tests: Add more anonymous/blank nodes testsCarlos Garnacho2018-11-1319-0/+96
| | | | | | | | | | Some of those combinations were broken in the previous parser, now that they are handled properly, add tests for them.
| * libtracker-sparql-backend: Expose direct connection's query_statement()Carlos Garnacho2018-11-131-0/+10
| | | | | | | | | | This should eventually be implemented in the bus backend as well, but not yet.
| * libtracker-direct: Implement query_statement()Carlos Garnacho2018-11-135-0/+331
| | | | | | | | This uses an internal TrackerSparql to hold the query.
| * libtracker-sparql: Add TrackerSparqlStatementCarlos Garnacho2018-11-134-0/+136
| | | | | | | | | | This object can hold a long lived query, in which parameters may be changed prior to execution.
| * libtracker-data: Support parameter bindingsCarlos Garnacho2018-11-136-20/+199
| | | | | | | | | | Those relate to PARAMETERIZED_VAR, and allow binding values through it at query preparation time.
| * libtracker-data: Add syntax support for parameterized variablesCarlos Garnacho2018-11-131-5/+33
| | | | | | | | | | | | These variables (with "~var" syntax) will be bound through API, providing a decent protection against injections. They can be used in every place a boolean/numeric/string literal is allowed.
| * libtracker-data: Add tracker_db_interface_bind_valueCarlos Garnacho2018-11-132-0/+46
| | | | | | | | | | This function takes a generic GValue, and uses the right sqlite3_bind* function underneath, or transforms to a string.
| * libtracker-data: Drop old SPARQL parserCarlos Garnacho2018-11-134-4491/+0
| |
| * libtracker-data: Flip the TrackerSparql switchCarlos Garnacho2018-11-133-12/+15
| | | | | | | | From now on, TrackerSparql will be used for handling SPARQL queries.
| * libtracker-data: Append literals directly past the variable limitCarlos Garnacho2018-11-131-3/+79
| | | | | | | | | | | | Once we are past the variable limit (Currently hardcoded to 999, matching SQLite limits) resort to appending literals in SQL directly. This used to happen in the older parser, and unbreaks 02-sparql-bugs which tests this.
| * libtracker-data: Add back 'NULL' literal handling for INSERT OR REPLACECarlos Garnacho2018-11-132-1/+15
| | | | | | | | | | This is a tracker extension that allows INSERT OR REPLACE to also delete values.
| * libtracker-data: Fix handling of fn:string-joinCarlos Garnacho2018-11-132-1/+23
| | | | | | | | | | | | | | In a quite unstandard way, this function takes the list of strings to join surrounded by parentheses, eg. fn:string-join(('a', 'b'), '|'). Handle this through allowing nesting of ArgList for this case, it will error out in every other case.
| * libtracker-data: Preprocess \u and \U sequences in SPARQL queriesCarlos Garnacho2018-11-131-3/+5
| |
| * libtracker-common: Add helper function to escape \u and \U sequencesCarlos Garnacho2018-11-132-0/+91
| |
| * libtracker-data: Accept comma as GROUP_CONCAT separatorCarlos Garnacho2018-11-132-2/+33
| | | | | | | | This is a tracker extension present in previous SPARQL parser.
| * libtracker-sparql: Use INSERT DATA on insertionsCarlos Garnacho2018-11-131-1/+1
| |
| * libtracker-data: Add "INSERT INTO iri" syntax backCarlos Garnacho2018-11-132-3/+17
| | | | | | | | This is a Tracker extension to SPARQL.