Bug 348473

Summary: Kexi query parameters do not work in COLUMNS section
Product: [Applications] KEXI Reporter: Jarosław Staniek <staniek>
Component: QueriesAssignee: Jarosław Staniek <staniek>
Status: CLOSED FIXED    
Severity: normal CC: adam, inksi
Priority: NOR    
Version: 2.9.4   
Target Milestone: 3.0.1   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 2.9.12
Sentry Crash Report:
Attachments: a db file with a test query

Description Jarosław Staniek 2015-05-30 21:35:05 UTC
Kexi query parameters does 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


Reproducible: Always



Expected Results:  
The COLUMNS section should accept parameters as well.
Comment 1 Jarosław Staniek 2016-02-01 00:33:41 UTC
Created attachment 96949 [details]
a db file with a test query
Comment 2 Jarosław Staniek 2016-02-16 20:07:04 UTC
Git commit 5c0d3ee52fd0cc366c7fe6f68e4a179ad60357d0 by Jaroslaw Staniek.
Committed on 16/02/2016 at 20:02.
Pushed by staniek into branch 'calligra/2.9'.

Make Kexi query parameters also work in COLUMNS section

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

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

Reviewers: piggz, wicik, wkosowicz

Subscribers: Kexi-Devel-list

Projects: #kexi, #calligra:_3.0

Differential Revision: https://phabricator.kde.org/D890

M  +3    -3    libs/db/connection.cpp
M  +2    -1    libs/db/parser/parser_p.cpp
M  +11   -3    libs/db/queryschema.cpp

http://commits.kde.org/calligra/5c0d3ee52fd0cc366c7fe6f68e4a179ad60357d0
Comment 3 Jarosław Staniek 2017-07-24 23:40:45 UTC
Git commit 875de031fcfb785279c02f2e5c7d0d7555cb0cdb by Jaroslaw Staniek.
Committed on 24/07/2017 at 23:39.
Pushed by staniek into branch '3.0'.

Make Kexi query parameters also work in COLUMNS section

Port calligra.git's 5c0d3ee52fd:

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

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

M  +4    -4    src/KDbNativeStatementBuilder.cpp
M  +12   -3    src/KDbQuerySchema.cpp
M  +1    -1    src/KDbQuerySchemaParameter.h
M  +2    -1    src/parser/KDbParser_p.cpp

https://commits.kde.org/kdb/875de031fcfb785279c02f2e5c7d0d7555cb0cdb