From: Rafael Kitover Date: Mon, 24 Aug 2009 12:42:57 +0000 (+0000) Subject: add test for IDENTITY_INSERT X-Git-Tag: v0.08112~14^2~51 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1713a57a217727fbc49bd1728dc300db73102ab9;p=dbsrgits%2FDBIx-Class.git add test for IDENTITY_INSERT --- diff --git a/t/746sybase.t b/t/746sybase.t index 34ca2e1..6f6f3aa 100644 --- a/t/746sybase.t +++ b/t/746sybase.t @@ -9,7 +9,7 @@ use DBICTest; my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_SYBASE_${_}" } qw/DSN USER PASS/}; -my $TESTS = 35 + 2; +my $TESTS = 37 + 2; if (not ($dsn && $user)) { plan skip_all => @@ -146,6 +146,35 @@ SQL is( $it->count, 7, 'COUNT of GROUP_BY ok' ); +# do an identity insert (which should happen with no txn when using +# placeholders.) + { + no warnings 'redefine'; + my @debug_out; + local *DBIx::Class::Storage::DBI::_query_start = sub { + push @debug_out, $_[1]; + }; + + my $txn_used = 0; + my $txn_commit = \&DBIx::Class::Storage::DBI::txn_commit; + local *DBIx::Class::Storage::DBI::txn_commit = sub { + $txn_used = 1; + goto &$txn_commit; + }; + + $schema->resultset('Artist') + ->create({ artistid => 999, name => 'mtfnpy' }); + + ok((grep /IDENTITY_INSERT/i, @debug_out), 'IDENTITY_INSERT'); + + SKIP: { + skip 'not testing lack of txn on IDENTITY_INSERT with NoBindVars', 1 + if $storage_type =~ /NoBindVars/i; + + is $txn_used, 0, 'no txn on insert with IDENTITY_INSERT'; + } + } + # mostly stolen from the blob stuff Nniuq wrote for t/73oracle.t SKIP: { skip 'TEXT/IMAGE support does not work with FreeTDS', 12