3 use dbixcsl_common_tests;
7 my $dsn = $ENV{DBICTEST_ORA_DSN} || '';
8 my $user = $ENV{DBICTEST_ORA_USER} || '';
9 my $password = $ENV{DBICTEST_ORA_PASS} || '';
11 my $tester = dbixcsl_common_tests->new(
13 auto_inc_pk => 'INTEGER NOT NULL PRIMARY KEY',
15 my ($table, $col) = @_;
17 qq{ CREATE SEQUENCE ${table}_${col}_seq START WITH 1 INCREMENT BY 1},
19 CREATE OR REPLACE TRIGGER ${table}_${col}_trigger
20 BEFORE INSERT ON ${table}
23 SELECT ${table}_${col}_seq.nextval INTO :NEW.${col} FROM dual;
28 auto_inc_drop_cb => sub {
29 my ($table, $col) = @_;
30 return qq{ DROP SEQUENCE ${table}_${col}_seq };
34 password => $password,
37 # http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements001.htm#i54330
39 # These tests require at least Oracle 9.2, because of the VARCHAR to
43 'char' => { data_type => 'char', size => 1 },
44 'char(11)' => { data_type => 'char', size => 11 },
45 'nchar' => { data_type => 'nchar', size => 1 },
46 'nchar(11)' => { data_type => 'nchar', size => 11 },
47 'varchar(20)' => { data_type => 'varchar2', size => 20 },
48 'varchar2(20)' => { data_type => 'varchar2', size => 20 },
49 'nvarchar2(20)'=> { data_type => 'nvarchar2', size => 20 },
53 # everything is alised to NUMBER
55 'decimal' => { data_type => 'integer' },
56 'dec' => { data_type => 'integer' },
57 'numeric' => { data_type => 'integer' },
59 'decimal(3)' => { data_type => 'numeric', size => [3,0] },
60 'dec(3)' => { data_type => 'numeric', size => [3,0] },
61 'numeric(3)' => { data_type => 'numeric', size => [3,0] },
63 'decimal(3,3)' => { data_type => 'numeric', size => [3,3] },
64 'dec(3,3)' => { data_type => 'numeric', size => [3,3] },
65 'numeric(3,3)' => { data_type => 'numeric', size => [3,3] },
67 'integer' => { data_type => 'integer' },
68 'int' => { data_type => 'integer' },
69 'smallint' => { data_type => 'integer' },
71 'binary_float' => { data_type => 'binary_float' },
72 'binary_double' => { data_type => 'binary_double' },
75 'raw(50)' => { data_type => 'raw', size => 50 },
76 'clob' => { data_type => 'clob' },
77 'nclob' => { data_type => 'nclob' },
78 'blob' => { data_type => 'blob' },
79 'bfile' => { data_type => 'bfile' },
80 # these must be tested one at a time, can't have 2 longs in one table
81 # XXX add overrides to type tester to handle this
82 # 'long' => { data_type => 'long' },
83 'long raw' => { data_type => 'long raw' },
86 'date' => { data_type => 'date' },
87 'date default sysdate'
88 => { data_type => 'date', default_value => \'current_timestamp' },
89 'timestamp' => { data_type => 'timestamp' },
90 'timestamp default current_timestamp'
91 => { data_type => 'timestamp', default_value => \'current_timestamp' },
92 'timestamp(3)' => { data_type => 'timestamp', size => 3 },
93 'timestamp with time zone'
94 => { data_type => 'timestamp with time zone' },
95 'timestamp(3) with time zone'
96 => { data_type => 'timestamp with time zone', size => 3 },
97 'timestamp with local time zone'
98 => { data_type => 'timestamp with local time zone' },
99 'timestamp(3) with local time zone'
100 => { data_type => 'timestamp with local time zone', size => 3 },
101 'interval year to month'
102 => { data_type => 'interval year to month' },
103 'interval year(3) to month'
104 => { data_type => 'interval year to month', size => 3 },
105 'interval day to second'
106 => { data_type => 'interval day to second' },
107 'interval day(3) to second'
108 => { data_type => 'interval day to second', size => [3,6] },
109 'interval day to second(3)'
110 => { data_type => 'interval day to second', size => [2,3] },
111 'interval day(3) to second(3)'
112 => { data_type => 'interval day to second', size => [3,3] },
115 'rowid' => { data_type => 'rowid' },
116 'urowid' => { data_type => 'urowid' },
117 'urowid(3333)' => { data_type => 'urowid', size => 3333 },
121 if( !$dsn || !$user ) {
122 $tester->skip_tests('You need to set the DBICTEST_ORA_DSN, _USER, and _PASS environment variables');
125 $tester->run_tests();
127 # vim:et sw=4 sts=4 tw=0: