From: Rafael Kitover Date: Wed, 9 Sep 2009 10:08:36 +0000 (+0000) Subject: test multi-row blob update X-Git-Tag: v0.08112~14^2~21 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bda35a4c8068f8e2e263ee09c581905297dd6974;p=dbsrgits%2FDBIx-Class.git test multi-row blob update --- diff --git a/lib/DBIx/Class/Storage/DBI/Sybase.pm b/lib/DBIx/Class/Storage/DBI/Sybase.pm index e649aa3..69cdc60 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase.pm @@ -10,6 +10,7 @@ use base qw/ use mro 'c3'; use Carp::Clan qw/^DBIx::Class/; use List::Util (); +use Sub::Name (); __PACKAGE__->mk_group_accessors('simple' => qw/_identity _blob_log_on_update _insert_dbh _identity_method/ @@ -317,7 +318,9 @@ sub insert { sub _insert { my ($self, $source, $to_insert, $blob_cols, $identity_col) = @_; - my $updated_cols = $self->next::method ($source, $to_insert); + my $updated_cols = + (Sub::Name::subname insert => + sub { $self->next::method ($source, $to_insert) })->(); my $final_row = { $identity_col => $self->last_insert_id($source, $identity_col), diff --git a/t/746sybase.t b/t/746sybase.t index b8a42e2..4594429 100644 --- a/t/746sybase.t +++ b/t/746sybase.t @@ -11,7 +11,7 @@ use DBIx::Class::Storage::DBI::Sybase::NoBindVars; my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_SYBASE_${_}" } qw/DSN USER PASS/}; -my $TESTS = 40 + 2; +my $TESTS = 41 + 2; if (not ($dsn && $user)) { plan skip_all => @@ -199,7 +199,7 @@ SQL # mostly stolen from the blob stuff Nniuq wrote for t/73oracle.t SKIP: { - skip 'TEXT/IMAGE support does not work with FreeTDS', 12 + skip 'TEXT/IMAGE support does not work with FreeTDS', 13 if $schema->storage->using_freetds; my $dbh = $schema->storage->_dbh; @@ -293,6 +293,14 @@ SQL }; diag $@ if $@; ok($got eq $new_str, "verified updated blob"); + + ## try multi-row blob update + # first insert some blobs + $rs->find(1)->delete; + $rs->create({ blob => $binstr{large} }) for (1..3); + $new_str = $binstr{large} . 'foo'; + $rs->update({ blob => $new_str }); + is((grep $_->blob eq $new_str, $rs->all), 3, 'multi-row blob update'); } # test MONEY column support