Firebird passes common tests
[dbsrgits/DBIx-Class-Schema-Loader.git] / t / 18firebird_common.t
CommitLineData
4cbddf8d 1use strict;
2use lib qw(t/lib);
3use dbixcsl_common_tests;
4
5my $dsn = $ENV{DBICTEST_FIREBIRD_DSN} || '';
6my $user = $ENV{DBICTEST_FIREBIRD_USER} || '';
7my $password = $ENV{DBICTEST_FIREBIRD_PASS} || '';
8
9my $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 => '',
4cbddf8d 35 dsn => $dsn,
36 user => $user,
37 password => $password,
38 connect_info_opts => { on_connect_call => 'use_softcommit' },
39);
40
41if( !$dsn ) {
42 $tester->skip_tests('You need to set the DBICTEST_FIREBIRD_DSN, _USER, and _PASS environment variables');
43}
44else {
4145a6f3 45 # get rid of stupid warning from InterBase/GetInfo.pm
46 {
47 local $SIG{__WARN__} = sub {};
48 require DBD::InterBase;
49 require DBD::InterBase::GetInfo;
50 }
4cbddf8d 51 $tester->run_tests();
52}