Commit | Line | Data |
4cbddf8d |
1 | use strict; |
2 | use lib qw(t/lib); |
3 | use dbixcsl_common_tests; |
4 | |
5 | my $dsn = $ENV{DBICTEST_FIREBIRD_DSN} || ''; |
6 | my $user = $ENV{DBICTEST_FIREBIRD_USER} || ''; |
7 | my $password = $ENV{DBICTEST_FIREBIRD_PASS} || ''; |
8 | |
9 | my $tester = dbixcsl_common_tests->new( |
10 | vendor => 'Firebird', |
11 | auto_inc_pk => 'INTEGER NOT NULL PRIMARY KEY', |
12 | auto_inc_cb => sub { |
13 | my ($table, $col) = @_; |
14 | return ( |
15 | qq{ CREATE GENERATOR gen_${table}_${col} }, |
16 | qq{ |
17 | CREATE TRIGGER ${table}_bi FOR $table |
18 | ACTIVE BEFORE INSERT POSITION 0 |
19 | AS |
20 | BEGIN |
21 | IF (NEW.$col IS NULL) THEN |
22 | NEW.$col = GEN_ID(gen_${table}_${col},1); |
23 | END |
24 | } |
25 | ); |
26 | }, |
27 | auto_inc_drop_cb => sub { |
28 | my ($table, $col) = @_; |
29 | return ( |
30 | qq{ DROP TRIGGER ${table}_bi }, |
31 | qq{ DROP GENERATOR gen_${table}_${col} }, |
32 | ); |
33 | }, |
34 | null => '', |
35 | date_datatype => 'TIMESTAMP', |
36 | dsn => $dsn, |
37 | user => $user, |
38 | password => $password, |
39 | connect_info_opts => { on_connect_call => 'use_softcommit' }, |
40 | ); |
41 | |
42 | if( !$dsn ) { |
43 | $tester->skip_tests('You need to set the DBICTEST_FIREBIRD_DSN, _USER, and _PASS environment variables'); |
44 | } |
45 | else { |
46 | $tester->run_tests(); |
47 | } |