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 # integer/decimal/numeric is alised to NUMBER
55 'integer' => { data_type => 'integer', original => { data_type => 'number', size => [38,0] } },
56 'int' => { data_type => 'integer', original => { data_type => 'number', size => [38,0] } },
57 'smallint' => { data_type => 'integer', original => { data_type => 'number', size => [38,0] } },
59 'decimal' => { data_type => 'integer', original => { data_type => 'number', size => [38,0] } },
60 'dec' => { data_type => 'integer', original => { data_type => 'number', size => [38,0] } },
61 'numeric' => { data_type => 'integer', original => { data_type => 'number', size => [38,0] } },
63 'decimal(3)' => { data_type => 'numeric', size => [3,0], original => { data_type => 'number' } },
64 'dec(3)' => { data_type => 'numeric', size => [3,0], original => { data_type => 'number' } },
65 'numeric(3)' => { data_type => 'numeric', size => [3,0], original => { data_type => 'number' } },
67 'decimal(3,3)' => { data_type => 'numeric', size => [3,3], original => { data_type => 'number' } },
68 'dec(3,3)' => { data_type => 'numeric', size => [3,3], original => { data_type => 'number' } },
69 'numeric(3,3)' => { data_type => 'numeric', size => [3,3], original => { data_type => 'number' } },
71 'binary_float' => { data_type => 'real', original => { data_type => 'binary_float' } },
72 'binary_double' => { data_type => 'double precision', original => { data_type => 'binary_double' } },
74 # these are not mentioned in the summary chart, must be aliased
75 real => { data_type => 'real', original => { data_type => 'float', size => 63 } },
76 'float(63)' => { data_type => 'real', original => { data_type => 'float', size => 63 } },
77 'float(64)' => { data_type => 'double precision', original => { data_type => 'float', size => 64 } },
78 'float(126)' => { data_type => 'double precision', original => { data_type => 'float', size => 126 } },
79 float => { data_type => 'double precision', original => { data_type => 'float', size => 126 } },
82 'raw(50)' => { data_type => 'raw', size => 50 },
83 'clob' => { data_type => 'clob' },
84 'nclob' => { data_type => 'nclob' },
85 'blob' => { data_type => 'blob' },
86 'bfile' => { data_type => 'bfile' },
87 'long' => { data_type => 'long' },
88 'long raw' => { data_type => 'long raw' },
91 'date' => { data_type => 'datetime', original => { data_type => 'date' } },
92 'date default sysdate'
93 => { data_type => 'datetime', default_value => \'current_timestamp',
94 original => { data_type => 'date', default_value => \'sysdate' } },
95 'timestamp' => { data_type => 'timestamp' },
96 'timestamp default current_timestamp'
97 => { data_type => 'timestamp', default_value => \'current_timestamp' },
98 'timestamp(3)' => { data_type => 'timestamp', size => 3 },
99 'timestamp with time zone'
100 => { data_type => 'timestamp with time zone' },
101 'timestamp(3) with time zone'
102 => { data_type => 'timestamp with time zone', size => 3 },
103 'timestamp with local time zone'
104 => { data_type => 'timestamp with local time zone' },
105 'timestamp(3) with local time zone'
106 => { data_type => 'timestamp with local time zone', size => 3 },
107 'interval year to month'
108 => { data_type => 'interval year to month' },
109 'interval year(3) to month'
110 => { data_type => 'interval year to month', size => 3 },
111 'interval day to second'
112 => { data_type => 'interval day to second' },
113 'interval day(3) to second'
114 => { data_type => 'interval day to second', size => [3,6] },
115 'interval day to second(3)'
116 => { data_type => 'interval day to second', size => [2,3] },
117 'interval day(3) to second(3)'
118 => { data_type => 'interval day to second', size => [3,3] },
121 'rowid' => { data_type => 'rowid' },
122 'urowid' => { data_type => 'urowid' },
123 'urowid(3333)' => { data_type => 'urowid', size => 3333 },
127 if( !$dsn || !$user ) {
128 $tester->skip_tests('You need to set the DBICTEST_ORA_DSN, _USER, and _PASS environment variables');
131 $tester->run_tests();
133 # vim:et sw=4 sts=4 tw=0: