- Fix spurious ROLLBACK statements when a TxnScopeGuard fails a commit
of a transaction with deferred FK checks: a guard is now inactivated
immediately before the commit is attempted (RT#107159)
+ - Fix use of ::Schema::Versioned combined with a user-supplied
+ $dbh->{HandleError} (GH#101)
- Fix spurious warning on MSSQL cursor invalidation retries (RT#102166)
- Fix parsing of DSNs containing driver arguments (GH#99)
- Work around unreliable $sth->finish() on INSERT ... RETURNING within
weaken (my $w_storage = $self->storage );
- $self->{vschema} = DBIx::Class::Version->connect(sub { $w_storage->dbh });
+ $self->{vschema} = DBIx::Class::Version->connect(
+ sub { $w_storage->dbh },
+
+ # proxy some flags from the main storage
+ { map { $_ => $w_storage->$_ } qw( unsafe ) },
+ );
my $conn_attrs = $w_storage->_dbic_connect_attributes || {};
my $vtable = $self->{vschema}->resultset('Table');
), 3, "Expected number of connections at end of script"
;
+# Test custom HandleError setting on an in-memory instance
+{
+ my $custom_handler = sub { die $_[0] };
+
+ # try to setup a custom error handle without unsafe set -- should
+ # fail, same behavior as regular Schema
+ throws_ok {
+ DBICVersion::Schema->connect( 'dbi:SQLite::memory:', undef, undef, {
+ HandleError => $custom_handler,
+ ignore_version => 1,
+ })->deploy;
+ }
+ qr/Refusing clobbering of \{HandleError\} installed on externally supplied DBI handle/,
+ 'HandleError with unsafe not set causes an exception'
+ ;
+
+ # now try it with unsafe set -- should work (see RT #113741)
+ my $s = DBICVersion::Schema->connect( 'dbi:SQLite::memory:', undef, undef, {
+ unsafe => 1,
+ HandleError => $custom_handler,
+ ignore_version => 1,
+ });
+
+ $s->deploy;
+
+ is $s->storage->dbh->{HandleError}, $custom_handler, 'Handler properly set on main schema';
+ is $s->{vschema}->storage->dbh->{HandleError}, $custom_handler, 'Handler properly set on version subschema';
+}
+
END {
rm_rf $ddl_dir unless $ENV{DBICTEST_KEEP_VERSIONING_DDL};
}