6 my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_ORA_${_}" } qw/DSN USER PASS/};
8 plan skip_all, 'Set $ENV{DBICTEST_ORA_DSN}, _USER and _PASS to run this test. ' .
9 'Warning: This test drops and creates a table called \'artist\''
10 unless ($dsn && $user && $pass);
14 DBICTest::Schema->compose_connection('OraTest' => $dsn, $user, $pass);
16 my $dbh = OraTest::Artist->storage->dbh;
19 $dbh->do("DROP SEQUENCE artist_seq");
20 $dbh->do("DROP TABLE artist");
22 $dbh->do("CREATE SEQUENCE artist_seq START WITH 1 MAXVALUE 999999 MINVALUE 0");
23 $dbh->do("CREATE TABLE artist (artistid NUMBER(12), name VARCHAR(255))");
24 $dbh->do("ALTER TABLE artist ADD (CONSTRAINT artist_pk PRIMARY KEY (artistid))");
26 CREATE OR REPLACE TRIGGER artist_insert_trg
27 BEFORE INSERT ON artist
30 IF :new.artistid IS NULL THEN
31 SELECT artist_seq.nextval
38 OraTest::Artist->load_components('PK::Auto::Oracle');
40 my $new = OraTest::Artist->create({ name => 'foo' });
42 ok($new->artistid, "Oracle Auto-PK worked");
44 $dbh->do("DROP SEQUENCE artist_seq");
45 $dbh->do("DROP TABLE artist");