Bug 405347

Summary: selecting by aspect ratio: abs function in sqlite lowercase, in mariadb uppercase
Product: [Applications] digikam Reporter: Jürgen Blumenschein <blumenschein>
Component: Searches-AdvancedAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: blumenschein, metzpinguin
Priority: NOR    
Version: 6.0.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 6.1.0
Sentry Crash Report:
Attachments: attachment-1801-0.html

Description Jürgen Blumenschein 2019-03-11 11:28:27 UTC
For a long time I tried on sunday selecting by aspect ratio, which
worked fine on my notebook with sqlite but not on the desktop with
mariadb.
The console said that the query was wrong.
I found out, that there is difference in the sql dialects:
the absolute function in sqlite is "abs( number )" in lowercase letters
in mariadb it's "ABS( number )" in uppercase.
Could it be fixed please?
Comment 1 Maik Qualmann 2019-03-11 12:25:03 UTC
The problem is not necessarily the lowercase letters. The CAST(... AS REAL) is the problem. The data type REAL is not supported by MySQL in the CAST. Depending on the database, we need different SQL queries here. I'll watch it tonight.

Maik
Comment 2 Maik Qualmann 2019-03-11 19:07:30 UTC
Git commit b3a3598a28c0e744920bf831296109af3338d3c8 by Maik Qualmann.
Committed on 11/03/2019 at 19:04.
Pushed by mqualmann into branch 'master'.

fix unknown data type REAL  for MySQL in the CAST function
testet with SQLite and MariaDB-10.2.22
FIXED-IN: 6.1.0

M  +2    -1    NEWS
M  +6    -6    core/libs/database/item/query/itemquerybuilder.cpp

https://commits.kde.org/digikam/b3a3598a28c0e744920bf831296109af3338d3c8
Comment 3 Jürgen Blumenschein 2019-03-12 06:53:33 UTC
Created attachment 118735 [details]
attachment-1801-0.html

  Thanks a lot,

I patched and compiled the 6.0.0 and all worked fine.

Jürgen

Zitat von Maik Qualmann <bugzilla_noreply@kde.org>:

> https://bugs.kde.org/show_bug.cgi?id=405347
>
> Maik Qualmann <metzpinguin@gmail.com> changed:
>
>           What    |Removed                     |Added
> ----------------------------------------------------------------------------
>             Status|REPORTED                    |RESOLVED
>   Version Fixed In|                            |6.1.0
>      Latest Commit|                            |https://commits.kde.org/dig
>                   |                            |ikam/b3a3598a28c0e744920bf8
>                   |                            |31296109af3338d3c8
>         Resolution|---                         |FIXED
>
> --- Comment #2 from Maik Qualmann <metzpinguin@gmail.com> ---
> Git commit b3a3598a28c0e744920bf831296109af3338d3c8 by Maik Qualmann.
> Committed on 11/03/2019 at 19:04.
> Pushed by mqualmann into branch 'master'.
>
> fix unknown data type REAL  for MySQL in the CAST function
> testet with SQLite and MariaDB-10.2.22
> FIXED-IN: 6.1.0
>
> M  +2    -1    NEWS
> M  +6    -6    core/libs/database/item/query/itemquerybuilder.cpp
> https://commits.kde.org/digikam/b3a3598a28c0e744920bf831296109af3338d3c8
  Jürgen Blumenschein, eMail: blumenschein@dokom.net
Homepage: http://members.dokom.net/blumenschein
Am Quartus 17
D-44149 Dortmund
Tel.: +49 231 7217321, Handy: +49 176 5591 4562
public key:
http://members.dokom.net/blumenscheinJuergen_Blumenschein_(0xC9358EBB)_public_key.asc