Skip Menu |

This queue is for tickets about the SQL-Translator CPAN distribution.

Report information
The Basics
Id: 16412
Status: resolved
Priority: 0/
Queue: SQL-Translator

People
Owner: Nobody in particular
Requestors: GAISSMAI [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.07
Fixed in: 0.11011



Subject: SQLite Parser missing FOREIGN KEY /REFERENCES
gaissmai$ perl -MSQL::Translator -e 'print "$SQL::Translator::VERSION\n"' 0.07 gaissmai$ perl -MSQL::Translator::Parser::SQLite -e 'print "$SQL::Translator::Parser::SQLite::VERSION\n"' 1.06 SQLite 3.x recognizes FOREIGN KEY/REFERENCES contraints. Would be great if you could implement this for the SQLite parser too. Best Reagards and many thanks for your work Charly
From: perl [...] bereft.net
The sqlite grammar does indeed support foreign keys, now. See http://http://www.sqlite.org/foreignkeys.html I've attached a patch that seems to do the right thing, although the pod doesn't address this new functionality (or other current functionality, apparently).
Subject: sqlite.pm.diff
--- /home/zitz/Downloads/SQLite.pm 2010-11-11 11:51:58.085936002 -0600 +++ SQLite.pm 2010-11-11 11:42:32.215936002 -0600 @@ -433,6 +436,17 @@ on_conflict => $item[5][0], } } + | + FOREIGN_KEY parens_field_list REFERENCES ref_def + { + $return = { + supertype => 'constraint', + type => 'foreign_key', + fields => $item[2], + reference_table => $item[4]{'reference_table'}, + reference_fields => $item[4]{'reference_fields'}, + } + } ref_def : /(\w+)\s*\((\w+)\)/ { $return = { reference_table => $1, reference_fields => $2 } } @@ -573,6 +587,8 @@ PRIMARY_KEY : /primary key/i +FOREIGN_KEY : /foreign key/i + CHECK_C : /check/i DEFAULT : /default/i
Subject: Re: [rt.cpan.org #16412] SQLite Parser missing FOREIGN KEY /REFERENCES
Date: Thu, 11 Nov 2010 19:05:50 +0100
To: bug-SQL-Translator [...] rt.cpan.org, zitz [...] erf.net
From: Peter Rabbitson <rabbit [...] rabbit.us>
http://zitz@erf.net/ via RT wrote: Show quoted text
> Queue: SQL-Translator > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=16412 > > > The sqlite grammar does indeed support foreign keys, now. See > http://http://www.sqlite.org/foreignkeys.html > > I've attached a patch that seems to do the right thing, although the pod > doesn't address this new functionality (or other current functionality, > apparently). >
How about tests?
Show quoted text
> > I've attached a patch that seems to do the right thing, although the
pod Show quoted text
> > doesn't address this new functionality (or other current functionality, > > apparently). > >
> > How about tests?
Patch applied, working on tests now
This was applied as part of 0dbd236211c36acbb89774189389357f48631685.
Extra fixes to make this feature usable were applied in ea4a3ecc5de1c8f062fef3bab51e1cc7a2c23235. New release coming soon.