Skip to content

Commit

Permalink
Fix ::Sybase::ASE incorrect attempt to retrieve an autoinc on blob in…
Browse files Browse the repository at this point in the history
…serts

This is a temporary fixup, will be better taken care of with the lobwriter
  --ribasushi
  • Loading branch information
perlpunk authored and ribasushi committed Sep 10, 2015
1 parent 216f29d commit b8e92da
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ teejay: Aaron Trevena <teejay@cpan.org>
theorbtwo: James Mastros <james@mastros.biz>
Thomas Kratz <tomk@cpan.org>
timbunce: Tim Bunce <tim.bunce@pobox.com>
tinita: Tina Mueller <cpan2@tinita.de>
Todd Lipcon
Tom Hukins <tom@eborcom.com>
tommy: Tommy Butler <tbutler.cpan.org@internetalias.net>
Expand Down
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
5 changes: 5 additions & 0 deletions lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
7 changes: 7 additions & 0 deletions t/746sybase.t
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b8e92da

Please sign in to comment.