Crash: SQL syntax error in get_bibles()

Bug #585937 reported by Caleb Maclennan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lyricue
Fix Released
Medium
ChrisDebenham

Bug Description

lyricue-2.2.1
mysql-5.1.46
perl-DBD-mysql-4.014

When running lyricue and after successfully logging into the database I have been getting this:

DBD::mysql::db selectall_arrayref failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INDEX_STATISTICS' at line 1 at /usr/bin/lyricue line 9896.
Can't use an undefined value as an ARRAY reference at /usr/bin/lyricue line 9896.

I finally figured out your scan for tables was returning the information_schema pseudo table in new mysql servers, and of course these tables can't be poked at with a select looking for verses like you normally would.

You can probably come up with something more elegant in perl than I can, but attached is a quick patch that makes it work here.

Revision history for this message
Caleb Maclennan (alerque) wrote :
Changed in lyricue:
assignee: nobody → ChrisDebenham (chris-debenham)
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
ChrisDebenham (chris-debenham) wrote :

Interesting - I have the information_schema db as well, but don't have the INDEX_STATISTICS table so I don't hit this issue.
The search for valid bible databases is able to handle databases without any suitable bible tables (it just checks all tables in each database for a 'verseid' field and then checks for a verse with the bookname 'Bible' so should ignore anything other than lyricue format bibles)
The failure is when lyricue is trying to run "describe INDEX_STATISTICS" so I'm not sure why that would fail
I've made a change to that direct line to avoid this issue for any table which is not behaving :-)
From:

my @fields = @{$db->selectall_arrayref("describe " . $tablename)};

To:

my $tmpfields = $db->selectall_arrayref("describe " . $tablename);
if (!defined $tmpfields) {
    next;
}
my @fields = @{$tmpfields};

Changed in lyricue:
status: In Progress → Fix Committed
Revision history for this message
Caleb Maclennan (alerque) wrote :

Thanks for looking into that. I patched the PLD package per your solution. http://cvs.pld-linux.org/cgi-bin/cvsweb/packages/lyricue/lyricue-mysql.patch

Looking forward to the next release.

Changed in lyricue:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.