Skip to content
Snippets Groups Projects
Commit 46c6f293 authored by Jarosław Staniek's avatar Jarosław Staniek
Browse files

Fix issues because of using " quotes for identifiers in SQLite driver

Use the [...] notation instead.

BUG:376052

Details:

From https://www.sqlite.org/lang_keywords.html:

RULE[*] "If a keyword in double quotes (ex: "key" or "glob") is used in a context where it cannot be resolved to an identifier but where a string literal is allowed, then the token is understood to be a string literal instead of an identifier."

So for table T(A TEXT) this query works:

SELECT * FROM T WHERE "A1"='A1';

And it even returns all rows of T.

Expected: "identifier not found" error at SQLite level.

Notes: Kexi parses the KDbSQL query supplied by the user so there's no issue in the Query Designer's SQL editor. But APIs such as KDb::deleteRecords() use the native queries through calls such as KDbConnection::executeVoidSQL("DELETE FROM %1 WHERE %2=%3").

Solution: Instead of using " quotes for identifiers, use []. This way the RULE[*] will not be applied. This is a global solution for the SQLite driver so altering the SQL commands constructed internally is not needed if they are use KDbConnection::escapeIdentifier().
parent 1702ba8f
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment