[kexi] [Bug 332161] Identifiers equal to a reserved word not supported in queries

Jarosław Staniek via KDE Bugzilla bugzilla_noreply at kde.org
Thu Dec 3 10:45:57 UTC 2015


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

--- Comment #3 from Jarosław Staniek <staniek at kde.org> ---
My conclusion. One requirement is to keep *format* compatibility with []
notation for  query parameters.

Another "nice to have" requirement is to avoid (I think) a bad practice of MSA,
which treats undefined identifiers as query parameters. This is both confusing
and error-prone practice, which once introduced, is hard to fix (so MSA is in a
trap somehow here).

Based on that:

By format I mean representation of a query stored in Kexi projects. (note: it's
represented in KEXISQL / KDBSQL format, normalized subset of SQL)

Proposed solution is to introduce an internal format transparently:
- in the format use [ ] for query parameters as before, so no change for Kexi
<= 2.x
- in the format use ` ` ("grave accent" quotes) for escaping identifiers
- in the Kexi GUI use [[ ]] for query parameters, this is a change compared to
Kexi <= 2.x
- in the Kexi GUI use [ ] for escaping identifiers (Like in MSA) 

By 'internal' we mean that end-users never see queries in this format unless
they read debug information of KDb.

The above means that when saving user-supplied SQL (or fragments of it) to
KEXISQL format, following conversions should be made:
- [ ] to ` `
- [[ ]] to [ ]

Similarly, opposite conversion is needed while reading stored SQL to the
KEXISQL format.

Conversions are deterministic, do not require complex parsing, we're not
loosing any information.

Update for the notations ([[ ]] and [ ]) used by Kexi GUI should be made by
modification in the KEXISQL / KDBSQL parser. Conversions should happen in KDb's
routines where KDbQuerySchema instances are stored/retrieved. The routines can
be exposed in KDb's Utils API for engineers who wish to use the internal
format.

Extras:
- '[', ']', ` characters should be escaped as \[, \], respectively, if they
exist inside of [ ] or [[ ]]
- ` characters should be escaped as \` respectively if they exist inside of ` `

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Kexi-bugs mailing list