Make Kexi query parameters also work in COLUMNS section
ClosedPublic

Authored by staniek on Feb 1 2016, 12:35 AM.

Details

Summary

Kexi query parameters do not work in COLUMNS section,
e.g. this won't work ('invalid query' error appears):
SELECT [Param]

The parameters work only in the WHERE section,
e.g. SELECT 123 WHERE [Param] = 1

BUG:348473

Test Plan

Test the query in the attached db https://bugs.kde.org/show_bug.cgi?id=348473#c1

Diff Detail

Repository
R8 Calligra
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
staniek updated this revision to Diff 2158.Feb 1 2016, 12:35 AM
staniek retitled this revision from to Make Kexi query parameters also work in COLUMNS section.
staniek updated this object.
staniek edited the test plan for this revision. (Show Details)
staniek added reviewers: piggz, wicik, wkosowicz.
staniek added a subscriber: Kexi-Devel-list.
Restricted Application added projects: KEXI, Calligra: 3.0. · View Herald TranscriptFeb 1 2016, 12:35 AM
piggz accepted this revision.Feb 16 2016, 7:11 AM
piggz edited edge metadata.

should such queries require a from clause? im thinking of oracle db that uses special 'dual' table to select such params from...in the case where no 'from' is used, how many rows are returned?

This revision is now accepted and ready to land.Feb 16 2016, 7:11 AM
This revision was automatically updated to reflect the committed changes.
In D890#18398, @piggz wrote:

should such queries require a from clause? im thinking of oracle db that uses special 'dual' table to select such params from...in the case where no 'from' is used, how many rows are returned?

FROM is not required in KDbSQL (ex KexiSQL). Our SQL parser is flexible, so we can be more liberal than db engines. A number of engines including SQLite allows to select without the FROM. Then 1 row is returned. This is a nice way to test expressions that don't need actual columns.