DBIx-Custom / t / common-sqlite-fullqualified.t /
Newer Older
69 lines | 2.09kb
fixed relation full qualifie...
Yuki Kimoto authored on 2012-03-01
1
use strict;
2
use warnings;
3

            
4
use FindBin;
5
use lib "$FindBin::Bin/common";
6
$ENV{DBIX_CUSTOM_TEST_RUN} = 1;
7

            
8
use DBIx::Custom;
9
{
10
  package DBIx::Custom;
11
  no warnings 'redefine';
12
  
13
  my $table1 = 'main.table1';
14
  my $table2 = 'main.table2';
15
  my $table2_alias = 'main.table2_alias';
16
  my $table3 = 'main.table3';
17
  my $key1 = 'key1';
18
  my $key2 = 'key2';
19
  my $key3 = 'key3';
20
  my $key4 = 'key4';
21
  my $key5 = 'key5';
22
  my $key6 = 'key6';
23
  my $key7 = 'key7';
24
  my $key8 = 'key8';
25
  my $key9 = 'key9';
26
  my $key10 = 'key10';
27
  
28
  has table1 => $table1;
29
  has table2 => $table2;
30
  has table2_alias => $table2_alias;
31
  has table3 => $table3;
32
  has key1 => $key1;
33
  has key2 => $key2;
34
  has key3 => $key3;
35
  has key4 => $key4;
36
  has key5 => $key5;
37
  has key6 => $key6;
38
  has key7 => $key7;
39
  has key8 => $key8;
40
  has key9 => $key9;
41
  has key10 => $key10;
42
  
43
  my $date_typename = 'Date';
44
  my $datetime_typename = 'Datetime';
45
  
46
  sub date_typename { lc $date_typename }
47
  sub datetime_typename { lc $datetime_typename }
48

            
49
  my $date_datatype = 'Date';
50
  my $datetime_datatype = 'Datetime';
51
  
52
  sub date_datatype { lc $date_datatype }
53
  sub datetime_datatype { lc $datetime_datatype }
54

            
55
  has dsn => 'dbi:SQLite:dbname=:memory:';
56
  sub create_table1 { "create table $table1 ($key1 varchar, $key2 varchar)" }
57
  sub create_table1_2 {"create table $table1 ($key1 varchar, $key2 varchar, $key3 varchar, key4 varchar, key5 varchar)" }
58
  sub create_table1_type { "create table $table1 ($key1 $date_typename, $key2 $datetime_typename)" }
59
  
60
  sub create_table1_highperformance { "create table $table1 (key1 varchar, key2 varchar, key3 varchar, key4 varchar, key5 varchar, key6 varchar, key7 varchar)" }
61
  
62
  sub create_table2 { "create table $table2 ($key1 varchar, $key3 varchar)" }
63
  sub create_table2_2 { "create table $table2 ($key1 varchar, $key2 varchar, $key3 varchar)" }
64
  sub create_table3 { "create table $table3 ($key1 varchar, $key2 varchar, $key3 varchar)" }
65
  sub create_table_reserved { 'create table "table" ("select" varchar, "update" varchar)' }
66
  
67
}
68

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