Firebird: mixed case support (wip)
[dbsrgits/DBIx-Class-Schema-Loader.git] / t / 18firebird_common.t
CommitLineData
4cbddf8d 1use strict;
2use lib qw(t/lib);
3use dbixcsl_common_tests;
243c6ebc 4use dbixcsl_firebird_extra_tests;
4cbddf8d 5
6my $dsn = $ENV{DBICTEST_FIREBIRD_DSN} || '';
7my $user = $ENV{DBICTEST_FIREBIRD_USER} || '';
8my $password = $ENV{DBICTEST_FIREBIRD_PASS} || '';
9
10my $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 => '',
243c6ebc 36 extra => dbixcsl_firebird_extra_tests->extra,
37 uppercase_identifiers => 1,
4cbddf8d 38 dsn => $dsn,
39 user => $user,
40 password => $password,
41 connect_info_opts => { on_connect_call => 'use_softcommit' },
42);
43
44if( !$dsn ) {
45 $tester->skip_tests('You need to set the DBICTEST_FIREBIRD_DSN, _USER, and _PASS environment variables');
46}
47else {
4145a6f3 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 }
4cbddf8d 54 $tester->run_tests();
55}