https://bugs.kde.org/show_bug.cgi?id=376052

            Bug ID: 376052
           Summary: Using quotes " for identifiers has side effects for
                    SQLite
           Product: KDb
           Version: 3.0
          Platform: Other
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: Driver: SQLite
          Assignee: stan...@kde.org
          Reporter: stan...@kde.org
  Target Milestone: ---

>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"). 

Proposed 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().

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to