Bug 333206 - substr() function doesn't work in queries
Summary: substr() function doesn't work in queries
Status: CLOSED FIXED
Alias: None
Product: KEXI
Classification: Applications
Component: Queries (show other bugs)
Version: 2.8.1
Platform: unspecified All
: NOR normal
Target Milestone: 2.9.1
Assignee: Jarosław Staniek
URL:
Keywords:
: 341557 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-04-08 16:50 UTC by Andrius
Modified: 2015-03-06 21:37 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrius 2014-04-08 16:50:40 UTC
when using substr in a query it returns a blank column

Reproducible: Always

Steps to Reproduce:
1. import text to a table
2. create a query using substr on a field of the table

Actual Results:  
Returned column is blank

Expected Results:  
the query should return the result of the substring (it works in the underlying sqlite3 backend)
Comment 1 Andrius 2014-04-08 16:51:01 UTC
Note: happens on both sqlite3 and mysql backends
Comment 2 Jarosław Staniek 2014-04-09 06:50:39 UTC
Confirmed as a general issue. Set as NORMAL since relatively to other issues it's not above crash.
Comment 3 Jarosław Staniek 2015-03-03 00:00:33 UTC
*** Bug 341557 has been marked as a duplicate of this bug. ***
Comment 4 Jarosław Staniek 2015-03-06 21:22:16 UTC
Git commit 3696fa001fed690b6d9a4468d03e11e5038e5357 by Jaroslaw Staniek.
Committed on 02/03/2015 at 23:54.
Pushed by staniek into branch 'calligra/2.9'.

Kexi queries/parser: make SUBSTR(X, Y [, Z]) built-in SQL function work

This is a first step to make lots of functions work.
https://community.kde.org/Kexi/Plugins/Queries/SQL_Functions#Functions

Details:
- add a few convenience functions to BaseExpr
- N-arg expressions: make token-to-string function support char tokens
- add KexiDBExpr_ArgumentList class ID for N-arg expressions (,,,,)
- FunctionExpr: compute type and validation for SUBSTR()
- parser: also support empty arg list "()" in functions

REVIEW:122783
FIXED-IN:2.9.1

M  +138  -11   libs/db/expression.cpp
M  +33   -3    libs/db/expression.h
M  +3    -2    libs/db/field.cpp
M  +796  -1117 libs/db/parser/sqlparser.cpp
M  +75   -88   libs/db/parser/sqlparser.h
M  +7    -7    libs/db/parser/sqlparser.y

http://commits.kde.org/calligra/3696fa001fed690b6d9a4468d03e11e5038e5357
Comment 5 Jarosław Staniek 2015-03-06 21:36:04 UTC
Git commit 4cb72f0de5901e6ea4a101b72c3d306322e5efc2 by Jaroslaw Staniek.
Committed on 02/03/2015 at 23:54.
Pushed by staniek into branch 'master'.

Kexi queries/parser: make SUBSTR(X, Y [, Z]) built-in SQL function work

This is a first step to make lots of functions work.
https://community.kde.org/Kexi/Plugins/Queries/SQL_Functions#Functions

Details:
- add a few convenience functions to BaseExpr
- N-arg expressions: make token-to-string function support char tokens
- add KexiDBExpr_ArgumentList class ID for N-arg expressions (,,,,)
- FunctionExpr: compute type and validation for SUBSTR()
- parser: also support empty arg list "()" in functions

REVIEW:122783
FIXED-IN:2.9.1

M  +139  -12   libs/db/expression.cpp
M  +33   -3    libs/db/expression.h
M  +3    -2    libs/db/field.cpp
M  +796  -1117 libs/db/parser/sqlparser.cpp
M  +75   -88   libs/db/parser/sqlparser.h
M  +7    -7    libs/db/parser/sqlparser.y

http://commits.kde.org/calligra/4cb72f0de5901e6ea4a101b72c3d306322e5efc2