DBIx-Custom / t / common-oracle.t /
Newer Older
106 lines | 3.371kb
prepare oracle test
Yuki Kimoto authored on 2011-08-15
1
use strict;
2
use warnings;
3

            
4
use FindBin;
5
$ENV{DBIX_CUSTOM_TEST_RUN} = 1
6
  if -f "$FindBin::Bin/run/common-oracle.run";
7
$ENV{DBIX_CUSTOM_SKIP_MESSAGE} = 'oracle private test';
8

            
9
use DBIx::Custom;
10
{
11
    package DBIx::Custom;
12
    no warnings 'redefine';
13

            
cleanup test
Yuki Kimoto authored on 2011-08-15
14
    my $table1 = 'TABLE1';
15
    my $table2 = 'TABLE2';
16
    my $table2_alias = 'TABLE2_ALIAS';
17
    my $table3 = 'TABLE3';
18
    my $key1 = 'KEY1';
19
    my $key2 = 'KEY2';
20
    my $key3 = 'KEY3';
21
    my $key4 = 'KEY4';
22
    my $key5 = 'KEY5';
23
    my $key6 = 'KEY6';
24
    my $key7 = 'KEY7';
25
    my $key8 = 'KEY8';
26
    my $key9 = 'KEY9';
27
    my $key10 = 'KEY10';
28
    
29
    has table1 => $table1;
30
    has table2 => $table2;
31
    has table2_alias => $table2_alias;
32
    has table3 => $table3;
33
    has key1 => $key1;
34
    has key2 => $key2;
35
    has key3 => $key3;
36
    has key4 => $key4;
37
    has key5 => $key5;
38
    has key6 => $key6;
39
    has key7 => $key7;
40
    has key8 => $key8;
41
    has key9 => $key9;
42
    has key10 => $key10;
43

            
prepare oracle test
Yuki Kimoto authored on 2011-08-15
44
    my $date_typename = 'CHAR(10)';
45
    my $datetime_typename = 'DATE';
46

            
47
    sub date_typename { lc 'CHAR' }
48
    sub datetime_typename { lc $datetime_typename }
49

            
50
    my $date_datatype = 91;
51
    my $datetime_datatype = 11;
52

            
53
    sub date_datatype { lc $date_datatype }
54
    sub datetime_datatype { lc $datetime_datatype }
55
    
56
    has datetime_suffix => '';
57

            
58
    has dsn => 'dbi:Oracle:host=localhost;port=1521;sid=XE';
59
    has user  => 'dbix_custom';
60
    has password => 'dbix_custom';
61
    has exclude_table => sub {
62

            
63
        return qr/^(
64
            pg_|column_|role_|view_|sql_
65
            |applicable_roles
66
            |check_constraints
67
            |columns
68
            |constraint_column_usage
69
            |constraint_table_usage
70
            |data_type_privileges
71
            |domain_constraints
72
            |domain_udt_usage
73
            |domains
74
            |element_types
75
            |enabled_roles
76
            |information_schema
77
            |information_schema_catalog_name
78
            |key_column_usage
79
            |parameters
80
            |referential_constraints
81
            |routine_privileges
82
            |routines
83
            |schemata
84
            |table_constraints
85
            |table_privileges
86
            |tables
87
            |triggered_update_columns
88
            |triggers
89
            |usage_privileges
90
            |views
91
        )/x
92
    };
93
    
cleanup test
Yuki Kimoto authored on 2011-08-15
94
    sub create_table1 { "create table $table1 ($key1 varchar2(255), $key2 varchar2(255))" }
95
    sub create_table1_2 { "create table $table1 ($key1 varchar2(255), $key2 varchar2(255), "
96
     . "$key3 varchar2(255), $key4 varchar2(255), $key5 varchar2(255))" }
97
    sub create_table1_type { "create table $table1 ($key1 $date_typename, $key2 $datetime_typename)" }
98
    sub create_table1_highperformance { "create table $table1 ($key1 varchar2(255), $key2 varchar2(255), "
99
      . "$key3 varchar2(255), $key4 varchar2(255), $key5 varchar2(255), $key6 varchar2(255), $key7 varchar2(255))" }
100
    sub create_table2 { "create table $table2 ($key1 varchar2(255), $key3 varchar2(255))" }
101
    sub create_table2_2 { "create table $table2 ($key1 varchar2(255), $key2 varchar2(255), $key3 varchar2(255))" }
102
    sub create_table3 { "create table $table3 ($key1 varchar2(255), $key2 varchar2(255), $key3 varchar2(255))" }
prepare oracle test
Yuki Kimoto authored on 2011-08-15
103
    sub create_table_reserved { 'create table "table" ("select" varchar2(255), "update" varchar2(255))' }
104
}
105

            
106
require "$FindBin::Bin/common.t";