From: Tina Mueller Date: Wed, 29 Jul 2015 14:36:28 +0000 (+0200) Subject: Fix ::Sybase::ASE incorrect attempt to retrieve an autoinc on blob inserts X-Git-Tag: v0.082840~11 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ce738b8d208c09815255bcd138d2fb108c3ba32f;p=dbsrgits%2FDBIx-Class.git Fix ::Sybase::ASE incorrect attempt to retrieve an autoinc on blob inserts ( cherry-pick of b8e92dac9 ) This is a temporary fixup, will be better taken care of with the lobwriter --ribasushi --- diff --git a/AUTHORS b/AUTHORS index 2d26034..94e3be2 100644 --- a/AUTHORS +++ b/AUTHORS @@ -201,6 +201,7 @@ teejay: Aaron Trevena theorbtwo: James Mastros Thomas Kratz timbunce: Tim Bunce +tinita: Tina Mueller Todd Lipcon Tom Hukins tommy: Tommy Butler diff --git a/Changes b/Changes index ba48d7d..36a4bb1 100644 --- a/Changes +++ b/Changes @@ -23,6 +23,8 @@ Revision history for DBIx::Class of a transaction with deferred FK checks: a guard is now inactivated immediately before the commit is attempted (RT#107159) - Fix spurious warning on MSSQL cursor invalidation retries (RT#102166) + - Fix the Sybase ASE storage incorrectly attempting to retrieve an + autoinc value when inserting rows containing blobs (GH#82) - Remove spurious exception warping in ::Replicated::execute_reliably (RT#113339) - Work around unreliable $sth->finish() on INSERT ... RETURNING within diff --git a/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm b/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm index fcbd0a7..4625d52 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm @@ -791,6 +791,11 @@ sub _insert_blobs { $self->throw_exception('Cannot update TEXT/IMAGE column(s) without primary key values') if ((grep { defined $row{$_} } @primary_cols) != @primary_cols); + # if we are 2-phase inserting a blob - there is nothing to retrieve anymore, + # regardless of the previous state of the flag + local $self->{_perform_autoinc_retrieval} + if $self->_perform_autoinc_retrieval; + for my $col (keys %$blob_cols) { my $blob = $blob_cols->{$col}; diff --git a/t/746sybase.t b/t/746sybase.t index 7e0b47f..b339517 100644 --- a/t/746sybase.t +++ b/t/746sybase.t @@ -503,6 +503,13 @@ SQL $rs->update({ blob => undef }); is((grep !defined($_->blob), $rs->all), 2); } 'blob update to NULL'; + + lives_ok { + $schema->txn_do(sub { + my $created = $rs->create( { clob => "some text" } ); + }); + } 'insert blob field in transaction'; + $ping_count-- if $@; # failure retry triggers a ping } # test MONEY column support (and some other misc. stuff)