X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F73oracle.t;h=b8b0270bca73af6d22335ea42bca79f5d2cf6bfc;hb=f3f6c13a8ed810cce53141b462f372140e2ab2cd;hp=911fad589df32a254d73f348c40eb72ad9bcdd78;hpb=9d7d2f00fee8d3a531f45dcf0fa71f42134402b4;p=dbsrgits%2FDBIx-Class.git diff --git a/t/73oracle.t b/t/73oracle.t index 911fad5..b8b0270 100644 --- a/t/73oracle.t +++ b/t/73oracle.t @@ -238,6 +238,10 @@ SKIP: { skip 'buggy BLOB support in DBD::Oracle 1.23', 7; } + # disable BLOB mega-output + my $orig_debug = $schema->storage->debug; + $schema->storage->debug (0); + foreach my $type (qw( blob clob )) { foreach my $size (qw( small large )) { $id++; @@ -248,6 +252,8 @@ SKIP: { ok($rs->find($id)->$type eq $binstr{$size}, "verified inserted $size $type" ); } } + + $schema->storage->debug ($orig_debug); } @@ -670,15 +676,43 @@ SKIP: { $schema1_dbh->do("GRANT INSERT ON artist TO $user2"); $schema1_dbh->do("GRANT SELECT ON artist_seq TO $user2"); - my $rs = $schema2->resultset('Artist'); + my $rs = $schema2->resultset('ArtistFQN'); - # qualify table with schema - local $rs->result_source->{name} = "${user}.artist"; + # first test with unquoted (default) sequence name in trigger body lives_and { my $row = $rs->create({ name => 'From Different Schema' }); ok $row->artistid; } 'used autoinc sequence across schemas'; + + # now quote the sequence name + + $schema1_dbh->do(qq{ + CREATE OR REPLACE TRIGGER artist_insert_trg + BEFORE INSERT ON artist + FOR EACH ROW + BEGIN + IF :new.artistid IS NULL THEN + SELECT "ARTIST_SEQ".nextval + INTO :new.artistid + FROM DUAL; + END IF; + END; + }); + + # sequence is cached in the rsrc + delete $rs->result_source->column_info('artistid')->{sequence}; + + lives_and { + my $row = $rs->create({ name => 'From Different Schema With Quoted Sequence' }); + ok $row->artistid; + } 'used quoted autoinc sequence across schemas'; + + my $schema_name = uc $user; + + is $rs->result_source->column_info('artistid')->{sequence}, + qq[${schema_name}."ARTIST_SEQ"], + 'quoted sequence name correctly extracted'; } done_testing;