From: Rafael Kitover Date: Tue, 23 Feb 2010 00:31:24 +0000 (+0000) Subject: don't use ib_softcommit by default X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dd2109ee53a85847717c2ca2ff1c170b0b52bb9d;p=dbsrgits%2FDBIx-Class-Historic.git don't use ib_softcommit by default --- diff --git a/lib/DBIx/Class/Storage/DBI/InterBase.pm b/lib/DBIx/Class/Storage/DBI/InterBase.pm index 085da6e..e11db5e 100644 --- a/lib/DBIx/Class/Storage/DBI/InterBase.pm +++ b/lib/DBIx/Class/Storage/DBI/InterBase.pm @@ -22,6 +22,11 @@ This class implements autoincrements for Firebird using C, sets the limit dialect to C and provides preliminary L support. +You need to use either the +L option or +L (see L) for your code to function +correctly with this driver. + For ODBC support, see L. To turn on L support, see @@ -160,13 +165,27 @@ sub _set_sql_dialect { } } -# softcommit makes savepoints work -sub _run_connection_actions { +=head2 connect_call_use_softcommit + +Used as: + + on_connect_call => 'use_softcommit' + +In L to set the +L C option. + +You need either this option or C<< disable_sth_caching => 1 >> for +L code to function correctly. + +The downside of using this option is that your process will B see UPDATEs, +INSERTs and DELETEs from other processes for already open statements. + +=cut + +sub connect_call_use_softcommit { my $self = shift; $self->_dbh->{ib_softcommit} = 1; - - $self->next::method(@_); } =head2 connect_call_datetime_setup @@ -267,6 +286,13 @@ sub format_date { =item * +with L, you will not be able to see changes made +to data in other processes. If this is an issue, use +L, this of +course adversely affects performance. + +=item * + C support only works for Firebird versions 2 or greater. To work with earlier versions, we'll need to figure out how to retrieve the bodies of C triggers and parse them for the C name. diff --git a/t/750firebird.t b/t/750firebird.t index 88899a7..4a9d35e 100644 --- a/t/750firebird.t +++ b/t/750firebird.t @@ -30,9 +30,10 @@ foreach my $conn_idx (0..$#info) { next unless $dsn; $schema = DBICTest::Schema->connect($dsn, $user, $pass, { - auto_savepoint => 1, - quote_char => q["], - name_sep => q[.], + auto_savepoint => 1, + quote_char => q["], + name_sep => q[.], + on_connect_call => 'use_softcommit', }); my $dbh = $schema->storage->dbh; @@ -126,11 +127,11 @@ EOF lives_and { $ars->search({ name => 'foo' })->update({ rank => 4 }); - is $ars->search({ name => 'foo' })->first->rank, 4; + is eval { $ars->search({ name => 'foo' })->first->rank }, 4; } 'Can update a column'; my ($updated) = $schema->resultset('Artist')->search({name => 'foo'}); - is $updated->rank, 4, 'and the update made it to the database'; + is eval { $updated->rank }, 4, 'and the update made it to the database'; # test LIMIT support @@ -146,8 +147,8 @@ EOF # test iterator $lim->reset; - is( $lim->next->artistid, 101, "iterator->next ok" ); - is( $lim->next->artistid, 102, "iterator->next ok" ); + is( eval { $lim->next->artistid }, 101, "iterator->next ok" ); + is( eval { $lim->next->artistid }, 102, "iterator->next ok" ); is( $lim->next, undef, "next past end of resultset ok" ); # test multiple executing cursors