Bug 27008 - Broken SQL statement formed in Breeding.pm
Summary: Broken SQL statement formed in Breeding.pm
Status: RESOLVED DUPLICATE of bug 17979
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-13 09:14 UTC by Joonas Kylmälä
Modified: 2021-04-09 12:18 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joonas Kylmälä 2020-11-13 09:14:13 UTC
The C4/Breeding.pm code doesn't properly form SQL statements and gives error instead:

> DBD::mysql::st execute failed: You have an error in your SQL syntax; check the > manual that corresponds to your MariaDB server version for the right syntax to > use near '' at line 5 [for Statement "SELECT import_record_id, file_name, isbn, > title, author
>               FROM  import_biblios 
>               JOIN import_records USING (import_record_id)
>               JOIN import_batches USING (import_batch_id)
>               WHERE "] at /usr/share/koha/lib/C4/Breeding.pm line 100.
Comment 1 Jonathan Druart 2020-12-01 13:30:10 UTC
I don't recreate, please provide steps to recreate the problem.
Comment 2 Jonathan Druart 2020-12-01 13:31:56 UTC
I get an explosion if I search " " or "-", but not on the SQL query.
Comment 3 Joonas Kylmälä 2020-12-01 13:35:40 UTC
You can reproduce with this command in koha-shell:
perl -e 'use C4::Context; use C4::Breeding; C4::Breeding::BreedingSearch();'
Comment 4 Jonathan Druart 2020-12-01 13:55:22 UTC
Well ok, but it's never called as it. It could be fixed however.
Comment 5 Joonas Kylmälä 2020-12-01 13:59:16 UTC
(In reply to Jonathan Druart from comment #4)
> Well ok, but it's never called as it. It could be fixed however.

In some real life situation it happens as well but I don't know which one yet, I just got the error waiting in production logs and thought to report it to not forget to fix this :)
Comment 6 Jonathan Druart 2021-04-09 12:18:49 UTC
Recreated with

GET /intranet/cataloguing/addbooks.pl?q=400638133393x

*** This bug has been marked as a duplicate of bug 17979 ***