[Bast-commits] r8800 - in
DBIx-Class/0.08/branches/storage-interbase:
lib/DBIx/Class/Storage/DBI t
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Tue Feb 23 00:31:24 GMT 2010
Author: caelum
Date: 2010-02-23 00:31:24 +0000 (Tue, 23 Feb 2010)
New Revision: 8800
Modified:
DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/Storage/DBI/InterBase.pm
DBIx-Class/0.08/branches/storage-interbase/t/750firebird.t
Log:
don't use ib_softcommit by default
Modified: DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/Storage/DBI/InterBase.pm
===================================================================
--- DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/Storage/DBI/InterBase.pm 2010-02-22 22:09:40 UTC (rev 8799)
+++ DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/Storage/DBI/InterBase.pm 2010-02-23 00:31:24 UTC (rev 8800)
@@ -22,6 +22,11 @@
limit dialect to C<FIRST X SKIP X> and provides preliminary
L<DBIx::Class::InflateColumn::DateTime> support.
+You need to use either the
+L<disable_sth_caching|DBIx::Class::Storage::DBI/disable_sth_caching> option or
+L</connect_call_use_softcommit> (see L</CAVEATS>) for your code to function
+correctly with this driver.
+
For ODBC support, see L<DBIx::Class::Storage::DBI::ODBC::Firebird>.
To turn on L<DBIx::Class::InflateColumn::DateTime> support, see
@@ -160,13 +165,27 @@
}
}
-# softcommit makes savepoints work
-sub _run_connection_actions {
+=head2 connect_call_use_softcommit
+
+Used as:
+
+ on_connect_call => 'use_softcommit'
+
+In L<connect_info|DBIx::Class::Storage::DBI/connect_info> to set the
+L<DBD::InterBase> C<ib_softcommit> option.
+
+You need either this option or C<< disable_sth_caching => 1 >> for
+L<DBIx::Class> code to function correctly.
+
+The downside of using this option is that your process will B<NOT> 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 @@
=item *
+with L</connect_call_use_softcommit>, you will not be able to see changes made
+to data in other processes. If this is an issue, use
+L<disable_sth_caching|DBIx::Class::Storage::DBI/disable_sth_caching>, this of
+course adversely affects performance.
+
+=item *
+
C<last_insert_id> 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<BEFORE INSERT> triggers and parse them for the C<GENERATOR> name.
Modified: DBIx-Class/0.08/branches/storage-interbase/t/750firebird.t
===================================================================
--- DBIx-Class/0.08/branches/storage-interbase/t/750firebird.t 2010-02-22 22:09:40 UTC (rev 8799)
+++ DBIx-Class/0.08/branches/storage-interbase/t/750firebird.t 2010-02-23 00:31:24 UTC (rev 8800)
@@ -30,9 +30,10 @@
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 @@
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 @@
# 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
More information about the Bast-commits
mailing list