Subject: | using distinct leads to DBI error |
Date: | Mon, 25 Mar 2019 17:09:52 +0000 |
To: | "'bug-Rose-DB-Object [...] rt.cpan.org'" <bug-Rose-DB-Object [...] rt.cpan.org> |
From: | Augustin Heinz-Werner Dr. <augustin [...] heidenhain.de> |
Dear Sirs and Madams,
using the distinct parameter as described in
https://metacpan.org/pod/Rose::DB::Object::Manager#distinct-[-BOOL-|-ARRAYREF-]
leads to a DB exception.
Reason is a missing whitespace which is not inserted during building the SQL statement.
Statements produced are consisting of something like:
"SELECTDISTINCT" instead of "SELECT DISTINCT".
I could fix the problem by changing the code slightly
https://metacpan.org/release/Rose-DB-Object/source/lib/Rose/DB/Object/Manager.pm#L1691
https://metacpan.org/release/Rose-DB-Object/source/lib/Rose/DB/Object/Manager.pm#L1964
and adding blanks ...
...' DISTINCT ' ...
$t1_sql = "SELECT $distinct ...
https://metacpan.org/source/JSIRACUSA/Rose-DB-Object-0.815/lib/Rose/DB/Object/QueryBuilder.pm#L110
my $distinct = delete $args{'distinct'} ? ' DISTINCT ' : '';
I didn't dive into the very deep and as far as I'm concerned everything's fine now.
But maybe it's helpful for others to fix this problem in more valuable manner.
Kind regards,
HW Augustin
------------------------------------------------------------------------------------------------------
Registergericht: Traunstein / Registry Court: HRB 275 - Sitz / Head Office: Traunreut
Aufsichtsratsvorsitzender / Chairman of Supervisory Board: Thomas Sesselmann
Geschäftsführung / Managing Directors: Hubert Ermer, Lutz Rissing, Anna Enzinger
E-Mail Haftungsausschluss / E-Mail Disclaimer: http://www.heidenhain.de/disclaimer