Bug 53887 - filter *always* treats string literals as LIKE patterns
Summary: filter *always* treats string literals as LIKE patterns
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
3.6.1.1 rc
Hardware: All All
: medium normal
Assignee: Lionel Elie Mamane
URL:
Whiteboard: target:3.7.0 target:3.6.2
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-21 15:55 UTC by Lionel Elie Mamane
Modified: 2012-08-30 12:16 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
reproduction DB (3.96 KB, application/vnd.oasis.opendocument.database)
2012-08-21 15:55 UTC, Lionel Elie Mamane
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lionel Elie Mamane 2012-08-21 15:55:31 UTC
Created attachment 65898 [details]
reproduction DB

1. Register attached file as a data source
2. Launch Calc.
3. Hit F4 to open the Data Sources panel.
4. Select a table from your data source.
5. Click on the "Standard Filter" icon on the Data Sources toolbar.
6. Enter search criteria: comments = *
7. Hit OK.

Expected result: the line AssetID=0, where Comments='*', is displayed.

Actual result: the line AssetID=1, where Comments='%', is displayed.

That's because the * gets replaced by a %, as if it were the clause in a LIKE. SHOULD NOT HAPPEN. Culprit: Replace_OS_PlaceHolder in dbaccess/source/ui/dlg/queryfilter.cxx


Queries (in Base, new query) do not have this bug. Even queries like:

 SELECT * FROM "Assets" WHERE "Comments" LIKE 'e*' ESCAPE 'e'
 SELECT * FROM "Assets" WHERE "Comments" LIKE 'e%' ESCAPE 'e'

are handled correctly, while

 SELECT * FROM "Assets" WHERE "Comments" LIKE '*'

is sent to the database as

 SELECT * FROM "Assets" WHERE "Comments" LIKE '%'

correctly implementing the "* is a pattern".

However, doubling the escape character is not handled correctly:

 SELECT * FROM "Assets" WHERE "Comments" LIKE 'ee*' ESCAPE 'e'

is not handled correctly. Note that

 SELECT * FROM "Assets" WHERE "Comments" LIKE 'ee%' ESCAPE 'e'

works as expected.
Comment 1 Not Assigned 2012-08-21 17:35:43 UTC
Lionel Elie Mamane committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e8409cbd7227849fe446661011c8bc73acdca319

fdo#53887 ConvertLikeToken(): make escape character properly escape itself
Comment 2 Lionel Elie Mamane 2012-08-21 17:42:16 UTC
(In reply to comment #1)
> Lionel Elie Mamane committed a patch related to this issue.
> It has been pushed to "master":
> 
> http://cgit.freedesktop.org/libreoffice/core/commit/?id=e8409cbd7227849fe446661011c8bc73acdca319
> 
> fdo#53887 ConvertLikeToken(): make escape character properly escape itself

Note that this is *only* for the
 LIKE 'ee*' ESCAPE 'e'
problem in queries.

It is *not* related to the problem in "Standard Filter".
Comment 3 Not Assigned 2012-08-22 15:39:19 UTC
Lionel Elie Mamane committed a patch related to this issue.
It has been pushed to "libreoffice-3-6":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=c90db23996c0580e9cd45db0230062a586fb8a53&g=libreoffice-3-6

fdo#53887 ConvertLikeToken(): make escape character properly escape itself


It will be available in LibreOffice 3.6.2.
Comment 4 Not Assigned 2012-08-30 04:04:26 UTC
Lionel Elie Mamane committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=c556c5bbd2627aafeb895cb1eb3fb7281d67357d

fdo#53887 convert filter value as LIKE pattern only on (NOT) LIKE
Comment 5 Not Assigned 2012-08-30 10:09:30 UTC
Lionel Elie Mamane committed a patch related to this issue.
It has been pushed to "libreoffice-3-6":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=5b43272845878243ce94c1170776ec87c19ad6fd&g=libreoffice-3-6

fdo#53887 convert filter value as LIKE pattern only on (NOT) LIKE


It will be available in LibreOffice 3.6.2.