Skip Menu |

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

Report information
The Basics
Id: 16128
Status: new
Priority: 0/
Queue: Class-DBI-Loader

People
Owner: Nobody in particular
Requestors: lyon.lemmens [...] redlemon.nl
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.22
Fixed in: (no value)



Subject: Class::DBI::Loader::SQLite fails to set up FOREIGN KEY relations (patch included)
The foreign key syntax is FOREIGN KEY (local_key) REFERENCES foreign_table(foreign_key) CDBI::L:SQLite reduces this on line 80 to '(local_key) REFERENCES ...' and tries to match it with: /^(\w+).*REFERENCES\s+(\w+)/i Which you can see won't work on account of the braces. I think the correct regexp should be: /^\((\w+)\).*REFERENCES\s+(\w+)/i This for me correctly produces the right relationships -- Lyon Lemmens --[patch]-- @@ -77,7 +77,7 @@ $col =~ s/^\s+//gs; # Grab reference - if ( $col =~ /^(\w+).*REFERENCES\s+(\w+)/i ) { + if ( $col =~ /^\((\w+)\).*REFERENCES\s+(\w+)/i ) { warn qq/Found foreign key definition "$col"/ if $self->debug; eval { $self->_has_a_many( $table, $1, $2 ) }; warn qq/has_a_many failed "$@"/ if $@ && $self->debug;