Skip to content

Commit b8e92da

Browse files
perlpunkribasushi
authored andcommitted
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
1 parent 216f29d commit b8e92da

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ teejay: Aaron Trevena <teejay@cpan.org>
200200
theorbtwo: James Mastros <james@mastros.biz>
201201
Thomas Kratz <tomk@cpan.org>
202202
timbunce: Tim Bunce <tim.bunce@pobox.com>
203+
tinita: Tina Mueller <cpan2@tinita.de>
203204
Todd Lipcon
204205
Tom Hukins <tom@eborcom.com>
205206
tommy: Tommy Butler <tbutler.cpan.org@internetalias.net>

Changes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Revision history for DBIx::Class
2525
- Fix t/52leaks.t failures on compilerless systems (RT#104429)
2626
- Fix t/storage/quote_names.t failures on systems with specified Oracle
2727
test credentials while missing the optional Math::Base36
28+
- Fix the Sybase ASE storage incorrectly attempting to retrieve an
29+
autoinc value when inserting rows containing blobs (GH#82)
2830
- Fix test failures when DBICTEST_SYBASE_DSN is set (unnoticed change
2931
in error message wording during 0.082800 and a bogus test)
3032

lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,11 @@ sub _insert_blobs {
763763
$self->throw_exception('Cannot update TEXT/IMAGE column(s) without primary key values')
764764
if grep { ! defined $row_data->{$_} } @primary_cols;
765765

766+
# if we are 2-phase inserting a blob - there is nothing to retrieve anymore,
767+
# regardless of the previous state of the flag
768+
local $self->{_perform_autoinc_retrieval}
769+
if $self->_perform_autoinc_retrieval;
770+
766771
my %where = map {( $_ => $row_data->{$_} )} @primary_cols;
767772

768773
for my $col (keys %$blob_cols) {

t/746sybase.t

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,13 @@ SQL
501501
$rs->update({ blob => undef });
502502
is((grep !defined($_->blob), $rs->all), 2);
503503
} 'blob update to NULL';
504+
505+
lives_ok {
506+
$schema->txn_do(sub {
507+
my $created = $rs->create( { clob => "some text" } );
508+
});
509+
} 'insert blob field in transaction';
510+
$ping_count-- if $@; # failure retry triggers a ping
504511
}
505512

506513
# test MONEY column support (and some other misc. stuff)

0 commit comments

Comments
 (0)