fix with_deferred_fk_checks exception propagation
authorRafael Kitover <rkitover@cpan.org>
Thu, 24 Nov 2011 17:27:10 +0000 (12:27 -0500)
committerRafael Kitover <rkitover@cpan.org>
Sun, 26 Aug 2012 16:08:08 +0000 (12:08 -0400)
commit26d54a1d1c51e7e852360b5179ca834a7323c8ee
treefc1e96633a1c0b23b6e1b2e05f5323141285b7ee
parentcde2e82bc03fe9fc3eb5c25fecda7b91542c4fcd
fix with_deferred_fk_checks exception propagation

The general case of a SET CONSTRAINTS ALL DEFERRED statement affecting
the current transaction has been implemented in ::Storage::DBI, with
specific storage drivers only having to implement
_set_constraints_deferred and _set_constraints_immediate to run the
necessary queries.

For DBDs that do not allow a ROLLBACK after a failed COMMIT, setting the
unsatisifed_deferred_constraints_autorollback inherited accessor flag
will take care of not issuing the ROLLBACK and decrementing the
transaction_depth.

The MySQL implementation has been changed to use a transaction as well,
so that before COMMIT the FOREIGN_KEY_CHECKS variable is set back to
1 so that (in theory) the COMMIT will run with FK checks enabled and
throw an error if they are unsatisfied. This is not currently
tested, we need innodb tests in t/71mysql.t, at some point.

Also work around buggy $dbh->commit behavior in DBD::Informix, an RT
will be forthcoming.
Changes
lib/DBIx/Class/Storage/DBI.pm
lib/DBIx/Class/Storage/DBI/Informix.pm
lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
lib/DBIx/Class/Storage/DBI/Pg.pm
lib/DBIx/Class/Storage/DBI/mysql.pm
t/748informix.t