[Bast-commits] r7371 - DBIx-Class/0.08/branches/sybase/t
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Mon Aug 24 12:42:57 GMT 2009
Author: caelum
Date: 2009-08-24 12:42:57 +0000 (Mon, 24 Aug 2009)
New Revision: 7371
Modified:
DBIx-Class/0.08/branches/sybase/t/746sybase.t
Log:
add test for IDENTITY_INSERT
Modified: DBIx-Class/0.08/branches/sybase/t/746sybase.t
===================================================================
--- DBIx-Class/0.08/branches/sybase/t/746sybase.t 2009-08-24 11:21:51 UTC (rev 7370)
+++ DBIx-Class/0.08/branches/sybase/t/746sybase.t 2009-08-24 12:42:57 UTC (rev 7371)
@@ -9,7 +9,7 @@
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 @@
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
More information about the Bast-commits
mailing list