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-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b8e92dac9f2f65895700dbd0d0606f75b900a8e0;p=dbsrgits%2FDBIx-Class.git Fix ::Sybase::ASE incorrect attempt to retrieve an autoinc on blob inserts This is a temporary fixup, will be better taken care of with the lobwriter --ribasushi --- diff --git a/AUTHORS b/AUTHORS index 83632ef..5db3279 100644 --- a/AUTHORS +++ b/AUTHORS @@ -200,6 +200,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 7508778..1077208 100644 --- a/Changes +++ b/Changes @@ -25,6 +25,8 @@ Revision history for DBIx::Class - Fix t/52leaks.t failures on compilerless systems (RT#104429) - Fix t/storage/quote_names.t failures on systems with specified Oracle test credentials while missing the optional Math::Base36 + - Fix the Sybase ASE storage incorrectly attempting to retrieve an + autoinc value when inserting rows containing blobs (GH#82) - Fix test failures when DBICTEST_SYBASE_DSN is set (unnoticed change in error message wording during 0.082800 and a bogus test) diff --git a/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm b/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm index 5ec7e79..c471bf8 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm @@ -763,6 +763,11 @@ sub _insert_blobs { $self->throw_exception('Cannot update TEXT/IMAGE column(s) without primary key values') if grep { ! defined $row_data->{$_} } @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; + my %where = map {( $_ => $row_data->{$_} )} @primary_cols; for my $col (keys %$blob_cols) { diff --git a/t/746sybase.t b/t/746sybase.t index 2536bcd..0b8406c 100644 --- a/t/746sybase.t +++ b/t/746sybase.t @@ -501,6 +501,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)