Skip Menu |

This queue is for tickets about the DBIx-Class-Schema-Loader CPAN distribution.

Report information
The Basics
Id: 21025
Status: resolved
Priority: 0/
Queue: DBIx-Class-Schema-Loader

People
Owner: blblack [...] gmail.com
Requestors: edencardim [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.03008



Subject: SQLite SQL parsing issue
Date: Wed, 16 Aug 2006 14:00:14 -0300
To: bug-DBIx-Class-Schema-Loader [...] rt.cpan.org
From: "Eden Cardim" <edencardim [...] gmail.com>
Activating debug gives me this: <debug> Askgene::Data::Entry->has_many( "annotations", "Annotation", { "foreign.entry_id)" => "self.id" }, ); </debug> which causes the following error when I attempt to use the relationship: <error> DBD::SQLite::db prepare_cached failed: near ")": syntax error(1) at dbdimp.c line 269 at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 839. DBIx::Class::Relationship::Accessor::__ANON__(): no sth generated via sql (near ")": syntax error(1) at dbdimp.c line 269): SELECT me.id, me.entry_id, me.seqread_id, me.label, me.description, me.begin, me.end FROM annotation me WHERE ( me.entry_id) = ? ) at /opt/eden/workspace/Askgene/lib/Askgene/Segment/Xterm.pm line 14 </error> <loader_options> __PACKAGE__->loader_options( relationships => 1, debug => 1 ); </loader_options> <schema> CREATE TABLE plate ( id INTEGER PRIMARY KEY NOT NULL, label VARCHAR(50) NOT NULL UNIQUE ); CREATE TABLE entry ( id INTEGER PRIMARY KEY NOT NULL, plate_id INTEGER UNSIGNED NOT NULL, created DATE NOT NULL, FOREIGN KEY( plate_id ) REFERENCES plate(id) ); CREATE TABLE seqRead ( id INTEGER PRIMARY KEY NOT NULL, plate_id INTEGER UNSIGNED NOT NULL, label VARCHAR(255) NOT NULL, size SMALLINT UNSIGNED NOT NULL, sequence TEXT NOT NULL, quality TEXT NOT NULL, FOREIGN KEY( plate_id ) REFERENCES plate(id) ); CREATE TABLE annotation ( id INTEGER PRIMARY KEY NOT NULL, entry_id INTEGER UNSIGNED NOT NULL, seqRead_id INTEGER UNSIGNED NOT NULL, label VARCHAR(255) NOT NULL, description TEXT NULL, begin SMALLINT UNSIGNED NULL, end SMALLINT UNSIGNED NULL, FOREIGN KEY( seqRead_id ) REFERENCES seqRead(id), FOREIGN KEY( entry_id ) REFERENCES entry(id) ); </schema> <versions> DBD::SQLite 1.12 DBIx::Class::Schema::Loader 0.03007 perl 5.8.8 Linux 2.6.16-2-686-smp #1 SMP Sat Jul 15 22:33:00 UTC 2006 i686 GNU/Linux </versions> -- Eden Cardim
I cannot reproduce this bug using your input on DBD::SQLite 1.13. Have you tried that release of DBD::SQLite? (If you can confim it happens with 1.12 but not 1.13, I'll just bump the requirements on the next release).
From: edencardim [...] gmail.com
On Wed Sep 20 00:25:20 2006, BLBLACK wrote: Show quoted text
> > I cannot reproduce this bug using your input on DBD::SQLite 1.13. Have > you tried that release of DBD::SQLite? (If you can confim it happens > with 1.12 but not 1.13, I'll just bump the requirements on the next > release).
I think the html chomped up the extra spaces, in the "annotation" table there's an extra double space in the FOREGIN KEY definition: FOREIGN KEY( entry_id ) REFERENCES entry(id) *double space*---------^
From: edencardim [...] gmail.com
On Wed Sep 20 08:02:31 2006, edencardim@gmail.com wrote: Show quoted text
> I think the html chomped up the extra spaces, in the "annotation" table > there's an extra double space in the FOREGIN KEY definition: > > FOREIGN KEY( entry_id ) REFERENCES entry(id) > *double space*---------^
Arg, sorry, this isn't plain text... FOREIGN KEY( entry_id ) [double space here]REFERENCES entry(id)
On Wed Sep 20 08:06:29 2006, edencardim@gmail.com wrote: Show quoted text
> On Wed Sep 20 08:02:31 2006, edencardim@gmail.com wrote: >
> > I think the html chomped up the extra spaces, in the "annotation" table > > there's an extra double space in the FOREGIN KEY definition: > > > > FOREIGN KEY( entry_id ) REFERENCES entry(id) > > *double space*---------^
> > Arg, sorry, this isn't plain text... > > FOREIGN KEY( entry_id ) [double space here]REFERENCES entry(id)
Can you try the attached patch and see if all's well for you?
Index: t/lib/dbixcsl_common_tests.pm =================================================================== --- t/lib/dbixcsl_common_tests.pm (revision 2798) +++ t/lib/dbixcsl_common_tests.pm (working copy) @@ -550,8 +550,8 @@ Id2 INTEGER, loader_test2 INTEGER, dat VARCHAR(8), - FOREIGN KEY (loader_test2) REFERENCES loader_test2 (id), - FOREIGN KEY (id, Id2 ) REFERENCES loader_test5 (id1,iD2) + FOREIGN KEY (loader_test2) REFERENCES loader_test2 (id), + FOREIGN KEY(id,Id2) REFERENCES loader_test5 (id1,iD2) ) $self->{innodb} }, Index: lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm =================================================================== --- lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm (revision 2798) +++ lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm (working copy) @@ -90,7 +90,7 @@ push(@uniqs, [ $name => \@cols ]); } - next if $col !~ /^(.*)\s+REFERENCES\s+(\w+) (?: \s* \( (.*) \) )? /ix; + next if $col !~ /^(.*\S)\s+REFERENCES\s+(\w+) (?: \s* \( (.*) \) )? /ix; my ($cols, $f_table, $f_cols) = ($1, $2, $3);
Fixed in 0.03008