DBIx-Custom / t / next / common-postgresql.t /
Newer Older
105 lines | 3.35kb
added Next version
Yuki Kimoto authored on 2011-11-16
1
use strict;
2
use warnings;
3

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

            
removed DBIx::Custom::Next f...
Yuki Kimoto authored on 2011-11-16
10
use DBIx::Custom;
added Next version
Yuki Kimoto authored on 2011-11-16
11
{
removed DBIx::Custom::Next f...
Yuki Kimoto authored on 2011-11-16
12
    package DBIx::Custom;
added Next version
Yuki Kimoto authored on 2011-11-16
13
    no warnings 'redefine';
14

            
15
    my $table1 = 'table1';
16
    my $table2 = 'table2';
17
    my $table2_alias = 'table2_alias';
18
    my $table3 = 'table3';
19
    my $key1 = 'key1';
20
    my $key2 = 'key2';
21
    my $key3 = 'key3';
22
    my $key4 = 'key4';
23
    my $key5 = 'key5';
24
    my $key6 = 'key6';
25
    my $key7 = 'key7';
26
    my $key8 = 'key8';
27
    my $key9 = 'key9';
28
    my $key10 = 'key10';
29
    
30
    has table1 => $table1;
31
    has table2 => $table2;
32
    has table2_alias => $table2_alias;
33
    has table3 => $table3;
34
    has key1 => $key1;
35
    has key2 => $key2;
36
    has key3 => $key3;
37
    has key4 => $key4;
38
    has key5 => $key5;
39
    has key6 => $key6;
40
    has key7 => $key7;
41
    has key8 => $key8;
42
    has key9 => $key9;
43
    has key10 => $key10;
44

            
45
    my $date_typename = 'Date';
46
    my $datetime_typename = 'Timestamp';
47

            
48
    sub date_typename { lc $date_typename }
49
    sub datetime_typename { 'timestamp without time zone' }
50

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

            
54
    sub date_datatype { lc $date_datatype }
55
    sub datetime_datatype { lc $datetime_datatype }
56

            
57
    has dsn => "dbi:Pg:dbname=dbix_custom";
58
    has user  => 'dbix_custom';
59
    has password => 'dbix_custom';
60
    has exclude_table => sub {
61

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

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