[Bast-commits] r7444 - in DBIx-Class/0.08/branches/sybase:
lib/DBIx/Class/Storage/DBI lib/DBIx/Class/Storage/DBI/Sybase t
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Sun Aug 30 16:56:44 GMT 2009
Author: ribasushi
Date: 2009-08-30 16:56:43 +0000 (Sun, 30 Aug 2009)
New Revision: 7444
Modified:
DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm
DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm
DBIx-Class/0.08/branches/sybase/t/746sybase.t
Log:
Rename insert_txn to unsafe_insert
Modified: DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm 2009-08-30 16:19:46 UTC (rev 7443)
+++ DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm 2009-08-30 16:56:43 UTC (rev 7444)
@@ -11,7 +11,9 @@
sub _rebless {
my $self = shift;
$self->disable_sth_caching(1);
- $self->insert_txn(0);
+ $self->unsafe_insert(1); # there is nothing unsafe as the
+ # last_insert_id mechanism is different
+ # without bindvars
}
# this works when NOT using placeholders
Modified: DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm 2009-08-30 16:19:46 UTC (rev 7443)
+++ DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm 2009-08-30 16:56:43 UTC (rev 7444)
@@ -12,7 +12,7 @@
use List::Util ();
__PACKAGE__->mk_group_accessors('simple' =>
- qw/_identity _blob_log_on_update insert_txn/
+ qw/_identity _blob_log_on_update unsafe_insert/
);
=head1 NAME
@@ -65,10 +65,6 @@
} else { # real Sybase
my $no_bind_vars = 'DBIx::Class::Storage::DBI::Sybase::NoBindVars';
-# This is reset to 0 in ::NoBindVars, only necessary because we use max(col) to
-# get the identity.
- $self->insert_txn(1);
-
if ($self->using_freetds) {
carp <<'EOF' unless $ENV{DBIC_SYBASE_FREETDS_NOWARN};
@@ -181,13 +177,13 @@
To manipulate this setting at runtime, use:
- $schema->storage->insert_txn(0); # 1 to re-enable
+ $schema->storage->unsafe_insert(0|1);
=cut
sub connect_call_unsafe_insert {
my $self = shift;
- $self->insert_txn(0);
+ $self->unsafe_insert(1);
}
sub _is_lob_type {
@@ -313,8 +309,9 @@
# We have to do the insert in a transaction to avoid race conditions with the
# SELECT MAX(COL) identity method used when placeholders are enabled.
my $updated_cols = do {
- if ($need_last_insert_id && $self->insert_txn &&
- (not $self->{transaction_depth})) {
+ if (
+ $need_last_insert_id && !$self->unsafe_insert && !$self->{transaction_depth}
+ ) {
my $guard = $self->txn_scope_guard;
my $upd_cols = $self->next::method (@_);
$guard->commit;
@@ -631,7 +628,7 @@
=over 4
-=item * set C<< $schema->storage->insert_txn(0) >> temporarily (see
+=item * set C<< $schema->storage->unsafe_insert(1) >> temporarily (see
L</connect_call_unsafe_insert>)
=item * use L<DBIx::Class::Storage::DBI::Replicated>
Modified: DBIx-Class/0.08/branches/sybase/t/746sybase.t
===================================================================
--- DBIx-Class/0.08/branches/sybase/t/746sybase.t 2009-08-30 16:19:46 UTC (rev 7443)
+++ DBIx-Class/0.08/branches/sybase/t/746sybase.t 2009-08-30 16:56:43 UTC (rev 7444)
@@ -312,8 +312,8 @@
local $TODO = 'not supported yet or possibly ever';
SKIP: {
- skip 'not testing insert with active cursor unless using insert_txn', 1
- unless $schema->storage->insert_txn;
+ skip 'not testing insert with active cursor if using unsafe_insert', 1
+ if $schema->storage->unsafe_insert;
my $artist_rs = $schema->resultset('Artist');
$artist_rs->first;
More information about the Bast-commits
mailing list