Subject: | Feature Request: Add Explicit Foreign Key Support |
Date: | Mon, 19 Oct 2009 10:17:02 -0700 |
To: | bug-DBD-SQLite [...] rt.cpan.org |
From: | "David E. Wheeler" <dwheeler [...] cpan.org> |
In the short term, I suggest you add something to the documentation
showing how to always enable this using a callback. Something like
my $enable_fks = sub { shift->do('PRAGMA foreign_keys = ON') };
my $dbh = DBI->connect($dsn, '', '', {
Callbacks => { connect => $enable_fks, },
});
If the user uses connect_cached, she should use this instead:
Callbacks => { 'connect_cached.reused' => $enable_fks, },
Longer term, it'd be ideal if there was a database handle attribute
one could set to turn this on:
$dbh->{sqlite_foreign_keys} = 1;
It's be useable in connect() too, of course. Is there a C api call to
do this, so you could bypass the PRAGMA SQL call?
Best,
David