Commit | Line | Data |
a78e3fed |
1 | use strict; |
c2849787 |
2 | use lib qw(t/lib); |
fbd83464 |
3 | use dbixcsl_common_tests; |
a78e3fed |
4 | |
9e978a19 |
5 | my $dsn = $ENV{DBICTEST_DB2_DSN} || ''; |
6 | my $user = $ENV{DBICTEST_DB2_USER} || ''; |
7 | my $password = $ENV{DBICTEST_DB2_PASS} || ''; |
a78e3fed |
8 | |
fbd83464 |
9 | my $tester = dbixcsl_common_tests->new( |
af96f52e |
10 | vendor => 'DB2', |
11 | auto_inc_pk => 'INTEGER GENERATED BY DEFAULT AS IDENTITY NOT NULL PRIMARY KEY', |
9e978a19 |
12 | dsn => $dsn, |
af96f52e |
13 | user => $user, |
14 | password => $password, |
0906d55b |
15 | null => '', |
b511f36e |
16 | preserve_case_mode_is_exclusive => 1, |
17 | quote_char => '"', |
8a64178e |
18 | data_types => { |
7640ef4b |
19 | # http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/admin/r0008483.htm |
20 | # |
21 | # Numeric Types |
22 | smallint => { data_type => 'smallint' }, |
23 | integer => { data_type => 'integer' }, |
24 | 'int' => { data_type => 'integer' }, |
25 | real => { data_type => 'real' }, |
26 | 'double precision' => { data_type => 'double precision' }, |
27 | double => { data_type => 'double precision' }, |
28 | float => { data_type => 'double precision' }, |
29 | 'float(24)' => { data_type => 'real' }, |
30 | 'float(25)' => { data_type => 'double precision' }, |
31 | 'float(53)' => { data_type => 'double precision' }, |
32 | numeric => { data_type => 'numeric' }, |
33 | decimal => { data_type => 'numeric' }, |
34 | 'numeric(6,3)' => { data_type => 'numeric', size => [6,3] }, |
35 | 'decimal(6,3)' => { data_type => 'numeric', size => [6,3] }, |
36 | |
37 | # Character String Types |
38 | char => { data_type => 'char', size => 1 }, |
39 | 'char(3)' => { data_type => 'char', size => 3 }, |
40 | 'varchar(3)' => { data_type => 'varchar', size => 3 }, |
41 | 'long varchar' => { data_type => 'long varchar' }, |
42 | 'clob' => { data_type => 'clob' }, |
43 | |
44 | # Graphic String Types (double-byte strings) |
45 | graphic => { data_type => 'graphic', size => 1 }, |
46 | 'graphic(3)' => { data_type => 'graphic', size => 3 }, |
47 | 'vargraphic(3)' => { data_type => 'vargraphic', size => 3 }, |
48 | 'long vargraphic' => { data_type => 'long vargraphic' }, |
49 | 'dbclob' => { data_type => 'dbclob' }, |
50 | |
51 | # Binary String Types |
52 | 'char for bit data'=> { data_type => 'binary', size => 1, original => { data_type => 'char for bit data' } }, |
53 | 'char(3) for bit data' |
54 | => { data_type => 'binary', size => 3, original => { data_type => 'char for bit data' } }, |
55 | 'varchar(3) for bit data' |
56 | => { data_type => 'varbinary', size => 3, original => { data_type => 'varchar for bit data' } }, |
57 | 'long varchar for bit data' |
58 | => { data_type => 'blob', original => { data_type => 'long varchar for bit data' } }, |
59 | blob => { data_type => 'blob' }, |
60 | |
61 | # DateTime Types |
62 | 'date' => { data_type => 'date' }, |
63 | 'date default current date' |
64 | => { data_type => 'date', default_value => \'current_timestamp', |
65 | original => { default_value => \'current date' } }, |
66 | 'time' => { data_type => 'time' }, |
67 | 'time default current time' |
68 | => { data_type => 'time', default_value => \'current_timestamp', |
69 | original => { default_value => \'current time' } }, |
70 | timestamp => { data_type => 'timestamp' }, |
71 | 'timestamp default current timestamp' |
72 | => { data_type => 'timestamp', default_value => \'current_timestamp', |
73 | original => { default_value => \'current timestamp' } }, |
74 | |
75 | # DATALINK Type |
76 | # XXX I don't know how to make these |
77 | # datalink => { data_type => 'datalink' }, |
8a64178e |
78 | }, |
a78e3fed |
79 | ); |
80 | |
9e978a19 |
81 | if( !$dsn || !$user ) { |
82 | $tester->skip_tests('You need to set the DBICTEST_DB2_DSN, _USER, and _PASS environment variables'); |
a78e3fed |
83 | } |
84 | else { |
85 | $tester->run_tests(); |
86 | } |
8a64178e |
87 | # vim:et sts=4 sw=4 tw=0: |