Commit | Line | Data |
e7262300 |
1 | use strict; |
2 | use lib qw(t/lib); |
3 | use dbixcsl_common_tests; |
6b0e47fc |
4 | use Test::More; |
5 | use Test::Exception; |
e7262300 |
6 | |
7 | my $dsn = $ENV{DBICTEST_ORA_DSN} || ''; |
8 | my $user = $ENV{DBICTEST_ORA_USER} || ''; |
9 | my $password = $ENV{DBICTEST_ORA_PASS} || ''; |
10 | |
11 | my $tester = dbixcsl_common_tests->new( |
12 | vendor => 'Oracle', |
c1ac681d |
13 | auto_inc_pk => 'INTEGER NOT NULL PRIMARY KEY', |
14 | auto_inc_cb => sub { |
15 | my ($table, $col) = @_; |
16 | return ( |
17 | qq{ CREATE SEQUENCE ${table}_${col}_seq START WITH 1 INCREMENT BY 1}, |
18 | qq{ |
19 | CREATE OR REPLACE TRIGGER ${table}_${col}_trigger |
20 | BEFORE INSERT ON ${table} |
21 | FOR EACH ROW |
22 | BEGIN |
23 | SELECT ${table}_${col}_seq.nextval INTO :NEW.${col} FROM dual; |
24 | END; |
25 | } |
26 | ); |
27 | }, |
28 | auto_inc_drop_cb => sub { |
29 | my ($table, $col) = @_; |
30 | return qq{ DROP SEQUENCE ${table}_${col}_seq }; |
31 | }, |
e7262300 |
32 | dsn => $dsn, |
33 | user => $user, |
34 | password => $password, |
35 | ); |
36 | |
37 | if( !$dsn || !$user ) { |
38 | $tester->skip_tests('You need to set the DBICTEST_ORA_DSN, _USER, and _PASS environment variables'); |
39 | } |
40 | else { |
41 | $tester->run_tests(); |
42 | } |