Bug 358636 - <SELECT "a" + "b"> SQL queries don't work
Summary: <SELECT "a" + "b"> SQL queries don't work
Status: CLOSED FIXED
Alias: None
Product: KEXI
Classification: Applications
Component: Queries (show other bugs)
Version: 2.9.10
Platform: Other All
: HI normal
Target Milestone: 2.9.11
Assignee: Jarosław Staniek
URL: https://phabricator.kde.org/T677
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-27 11:44 UTC by Jarosław Staniek
Modified: 2016-03-03 22:49 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.9.11
Sentry Crash Report:


Attachments
A project file with test queries (10.00 KB, application/x-kexiproject-sqlite2)
2016-01-27 11:54 UTC, Jarosław Staniek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jarosław Staniek 2016-01-27 11:44:57 UTC
<SELECT "a" + "b"> parses in Kexi 2.9.7 but results in invalid type/value.


Reproducible: Always

Steps to Reproduce:
1. In the SQL view enter: SELECT "a" + "b" 
2. Switch to data view


Actual Results:  
Empty [boolean] column

Expected Results:  
Text column with value "ab"

Also, <SELECT "a" || "b"> does not work for MySQL.
Comment 1 Jarosław Staniek 2016-01-27 11:54:11 UTC
Created attachment 96865 [details]
A project file with test queries
Comment 2 Jarosław Staniek 2016-01-29 19:48:41 UTC
Git commit 2bb05472bca81d13565cf9501ae04589d38e00a4 by Jaroslaw Staniek.
Committed on 29/01/2016 at 19:43.
Pushed by staniek into branch 'calligra/2.9'.

Kexi: Make <SELECT "a" + "b"> SQL queries work and fix <SELECT "a" || "b">

Summary:
- <SELECT "a" + "b"> parses in Kexi>=2.9.7 but results in invalid (boolean) type/value
- for convenience, if either argument is of text type, operator "+" is now assumed to be identical to operator ||
- also fix SELECT "a" || "b" for MySQL (using CONCAT() is needed)

https://phabricator.kde.org/T677
FIXED-IN:2.9.11

Test Plan:
Try test queries from the project attached at https://bugs.kde.org/show_bug.cgi?id=358636.
Try other queries that use text columns instead of string constants.

Reviewers: piggz, wicik

Subscribers: Kexi-Devel-list

Projects: #kexi, #calligra:_3.0

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

M  +7    -2    kexi/kexidb/drivers/mysql/mysqldriver.cpp
M  +6    -1    kexi/kexidb/drivers/mysql/mysqldriver.h
M  +6    -1    libs/db/driver.cpp
M  +10   -1    libs/db/driver.h
M  +20   -2    libs/db/expression.cpp

http://commits.kde.org/calligra/2bb05472bca81d13565cf9501ae04589d38e00a4
Comment 3 Jarosław Staniek 2016-02-29 23:21:26 UTC
Git commit f19ae68c17822b33097119974b2ee01c0b93c534 by Jaroslaw Staniek.
Committed on 29/02/2016 at 23:16.
Pushed by staniek into branch 'master'.

Make <SELECT "a" + "b"> SQL queries work and fix <SELECT "a" || "b">

Summary:
- port from calligra.git
- <SELECT "a" + "b"> parses in Kexi>=2.9.7 but results in invalid (boolean) type/value
- for convenience, if either argument is of text type, operator "+" is now assumed to be identical to operator ||
- also fix SELECT "a" || "b" for MySQL (using CONCAT() is needed)
- add autotests and parser tests

https://phabricator.kde.org/T677
FIXED-IN:2.9.11

Test Plan:
    Try test queries from the project attached at https://bugs.kde.org/show_bug.cgi?id=358636.
    Try other queries that use text columns instead of string constants.

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

(from calligra.git)

M  +9    -2    autotests/ExpressionsTest.cpp
M  +11   -0    autotests/parser/data/statements.txt
M  +9    -1    src/KDbDriver.cpp
M  +12   -1    src/KDbDriver.h
M  +9    -1    src/drivers/mysql/MysqlDriver.cpp
M  +7    -1    src/drivers/mysql/MysqlDriver.h
M  +17   -2    src/expression/KDbBinaryExpression.cpp
M  +1    -0    src/expression/KDbExpression.h

http://commits.kde.org/kdb/f19ae68c17822b33097119974b2ee01c0b93c534