Firebird: mixed case support (wip)
[dbsrgits/DBIx-Class-Schema-Loader.git] / t / 18firebird_common.t
1 use strict;
2 use lib qw(t/lib);
3 use dbixcsl_common_tests;
4 use dbixcsl_firebird_extra_tests;
5
6 my $dsn      = $ENV{DBICTEST_FIREBIRD_DSN} || '';
7 my $user     = $ENV{DBICTEST_FIREBIRD_USER} || '';
8 my $password = $ENV{DBICTEST_FIREBIRD_PASS} || '';
9
10 my $tester = dbixcsl_common_tests->new(
11     vendor      => 'Firebird',
12     auto_inc_pk => 'INTEGER NOT NULL PRIMARY KEY',
13     auto_inc_cb => sub {
14         my ($table, $col) = @_;
15         return (
16             qq{ CREATE GENERATOR gen_${table}_${col} },
17             qq{
18                 CREATE TRIGGER ${table}_bi FOR $table
19                 ACTIVE BEFORE INSERT POSITION 0
20                 AS
21                 BEGIN
22                  IF (NEW.$col IS NULL) THEN
23                   NEW.$col = GEN_ID(gen_${table}_${col},1);
24                 END
25             }
26         );
27     },
28     auto_inc_drop_cb => sub {
29         my ($table, $col) = @_;
30         return (
31             qq{ DROP TRIGGER ${table}_bi },
32             qq{ DROP GENERATOR gen_${table}_${col} },
33         );
34     },
35     null        => '',
36     extra       => dbixcsl_firebird_extra_tests->extra,
37     uppercase_identifiers => 1,
38     dsn         => $dsn,
39     user        => $user,
40     password    => $password,
41     connect_info_opts => { on_connect_call => 'use_softcommit' },
42 );
43
44 if( !$dsn ) {
45     $tester->skip_tests('You need to set the DBICTEST_FIREBIRD_DSN, _USER, and _PASS environment variables');
46 }
47 else {
48     # get rid of stupid warning from InterBase/GetInfo.pm
49     {
50         local $SIG{__WARN__} = sub {};
51         require DBD::InterBase;
52         require DBD::InterBase::GetInfo;
53     }
54     $tester->run_tests();
55 }