better type info for DB2
[dbsrgits/DBIx-Class-Schema-Loader.git] / t / 14ora_common.t
index d239569..294b1e5 100644 (file)
@@ -29,6 +29,8 @@ my $tester = dbixcsl_common_tests->new(
         my ($table, $col) = @_;
         return qq{ DROP SEQUENCE ${table}_${col}_seq };
     },
+    preserve_case_mode_is_exclusive => 1,
+    quote_char                      => '"',
     dsn         => $dsn,
     user        => $user,
     password    => $password,
@@ -50,26 +52,33 @@ my $tester = dbixcsl_common_tests->new(
 
         # Numeric Types
         #
-        # everything is alised to NUMBER
+        # integer/decimal/numeric is alised to NUMBER
         #
-        'decimal'      => { data_type => 'integer' },
-        'dec'          => { data_type => 'integer' },
-        'numeric'      => { data_type => 'integer' },
+        'integer'      => { data_type => 'integer', original => { data_type => 'number', size => [38,0] } },
+        'int'          => { data_type => 'integer', original => { data_type => 'number', size => [38,0] } },
+        'smallint'     => { data_type => 'integer', original => { data_type => 'number', size => [38,0] } },
 
-        'decimal(3)'   => { data_type => 'numeric', size => [3,0] },
-        'dec(3)'       => { data_type => 'numeric', size => [3,0] },
-        'numeric(3)'   => { data_type => 'numeric', size => [3,0] },
+        'decimal'      => { data_type => 'integer', original => { data_type => 'number', size => [38,0] } },
+        'dec'          => { data_type => 'integer', original => { data_type => 'number', size => [38,0] } },
+        'numeric'      => { data_type => 'integer', original => { data_type => 'number', size => [38,0] } },
 
-        'decimal(3,3)' => { data_type => 'numeric', size => [3,3] },
-        'dec(3,3)'     => { data_type => 'numeric', size => [3,3] },
-        'numeric(3,3)' => { data_type => 'numeric', size => [3,3] },
+        'decimal(3)'   => { data_type => 'numeric', size => [3,0], original => { data_type => 'number' } },
+        'dec(3)'       => { data_type => 'numeric', size => [3,0], original => { data_type => 'number' } },
+        'numeric(3)'   => { data_type => 'numeric', size => [3,0], original => { data_type => 'number' } },
 
-        'integer'      => { data_type => 'integer' },
-        'int'          => { data_type => 'integer' },
-        'smallint'     => { data_type => 'integer' },
+        'decimal(3,3)' => { data_type => 'numeric', size => [3,3], original => { data_type => 'number' } },
+        'dec(3,3)'     => { data_type => 'numeric', size => [3,3], original => { data_type => 'number' } },
+        'numeric(3,3)' => { data_type => 'numeric', size => [3,3], original => { data_type => 'number' } },
 
-        'binary_float'  => { data_type => 'binary_float' },
-        'binary_double' => { data_type => 'binary_double' },
+        'binary_float'  => { data_type => 'real',             original => { data_type => 'binary_float'  } },
+        'binary_double' => { data_type => 'double precision', original => { data_type => 'binary_double' } },
+
+        # these are not mentioned in the summary chart, must be aliased
+       real            => { data_type => 'real',             original => { data_type => 'float', size => 63  } },
+        'float(63)'     => { data_type => 'real',             original => { data_type => 'float', size => 63  } },
+        'float(64)'     => { data_type => 'double precision', original => { data_type => 'float', size => 64  } },
+        'float(126)'    => { data_type => 'double precision', original => { data_type => 'float', size => 126 } },
+        float           => { data_type => 'double precision', original => { data_type => 'float', size => 126 } },
 
         # Blob Types
         'raw(50)'      => { data_type => 'raw', size => 50 },
@@ -77,15 +86,14 @@ my $tester = dbixcsl_common_tests->new(
         'nclob'        => { data_type => 'nclob' },
         'blob'         => { data_type => 'blob' },
         'bfile'        => { data_type => 'bfile' },
-        # these must be tested one at a time, can't have 2 longs in one table
-        # XXX add overrides to type tester to handle this
-#        'long'         => { data_type => 'long' },
+        'long'         => { data_type => 'long' },
         'long raw'     => { data_type => 'long raw' },
 
         # Datetime Types
-        'date'         => { data_type => 'date' },
+        'date'         => { data_type => 'datetime', original => { data_type => 'date' } },
         'date default sysdate'
-                       => { data_type => 'date', default_value => \'current_timestamp' },
+                       => { data_type => 'datetime', default_value => \'current_timestamp',
+                            original  => { data_type => 'date', default_value => \'sysdate' } },
         'timestamp'    => { data_type => 'timestamp' },
         'timestamp default current_timestamp'
                        => { data_type => 'timestamp', default_value => \'current_timestamp' },
@@ -116,6 +124,23 @@ my $tester = dbixcsl_common_tests->new(
         'urowid'       => { data_type => 'urowid' },
         'urowid(3333)' => { data_type => 'urowid', size => 3333 },
     },
+    extra => {
+        count => 1,
+        run   => sub {
+            my ($schema, $monikers, $classes) = @_;
+
+            SKIP: {
+                if (my $source = $monikers->{loader_test1s}) {
+                    is $schema->source($source)->column_info('id')->{sequence},
+                        'loader_test1s_id_seq',
+                        'Oracle sequence detection';
+                }
+                else {
+                    skip 'not running common tests', 1;
+                }
+            }
+        },
+    },
 );
 
 if( !$dsn || !$user ) {