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