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 => 'datetime', original => { data_type => 'date' } },
87 'date default sysdate'
88 => { data_type => 'datetime', default_value => \'current_timestamp',
89 original => { data_type => 'date', default_value => \'sysdate' } },
90 'timestamp' => { data_type => 'timestamp' },
91 'timestamp default current_timestamp'
92 => { data_type => 'timestamp', default_value => \'current_timestamp' },
93 'timestamp(3)' => { data_type => 'timestamp', size => 3 },
94 'timestamp with time zone'
95 => { data_type => 'timestamp with time zone' },
96 'timestamp(3) with time zone'
97 => { data_type => 'timestamp with time zone', size => 3 },
98 'timestamp with local time zone'
99 => { data_type => 'timestamp with local time zone' },
100 'timestamp(3) with local time zone'
101 => { data_type => 'timestamp with local time zone', size => 3 },
102 'interval year to month'
103 => { data_type => 'interval year to month' },
104 'interval year(3) to month'
105 => { data_type => 'interval year to month', size => 3 },
106 'interval day to second'
107 => { data_type => 'interval day to second' },
108 'interval day(3) to second'
109 => { data_type => 'interval day to second', size => [3,6] },
110 'interval day to second(3)'
111 => { data_type => 'interval day to second', size => [2,3] },
112 'interval day(3) to second(3)'
113 => { data_type => 'interval day to second', size => [3,3] },
116 'rowid' => { data_type => 'rowid' },
117 'urowid' => { data_type => 'urowid' },
118 'urowid(3333)' => { data_type => 'urowid', size => 3333 },
122 if( !$dsn || !$user ) {
123 $tester->skip_tests('You need to set the DBICTEST_ORA_DSN, _USER, and _PASS environment variables');
126 $tester->run_tests();
128 # vim:et sw=4 sts=4 tw=0: