X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F17sybase_asa_common.t;h=0b7a241585596e1e6b659e308cdc38bf78dd294b;hb=dd87d4c4612dbc0120da1e1826cb3f09c15fbcdb;hp=69236062bd7bbae717ad7616c236ac072f072723;hpb=5347f50139d7280c04bb48e2d693ef0909165328;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/t/17sybase_asa_common.t b/t/17sybase_asa_common.t index 6923606..0b7a241 100644 --- a/t/17sybase_asa_common.t +++ b/t/17sybase_asa_common.t @@ -5,6 +5,8 @@ use dbixcsl_common_tests; # The default max_cursor_count and max_statement_count settings of 50 are too # low to run this test. +# +# Setting them to zero is preferred. my $dbd_sqlanywhere_dsn = $ENV{DBICTEST_SYBASE_ASA_DSN} || ''; my $dbd_sqlanywhere_user = $ENV{DBICTEST_SYBASE_ASA_USER} || ''; @@ -17,7 +19,6 @@ my $odbc_password = $ENV{DBICTEST_SYBASE_ASA_ODBC_PASS} || ''; my $tester = dbixcsl_common_tests->new( vendor => 'SQLAnywhere', auto_inc_pk => 'INTEGER IDENTITY NOT NULL PRIMARY KEY', - default_function => 'current timestamp', connect_info => [ ($dbd_sqlanywhere_dsn ? { dsn => $dbd_sqlanywhere_dsn, user => $dbd_sqlanywhere_user, @@ -29,6 +30,106 @@ my $tester = dbixcsl_common_tests->new( password => $odbc_password, } : ()), ], + loader_options => { preserve_case => 1 }, + data_types => { + # http://infocenter.sybase.com/help/topic/com.sybase.help.sqlanywhere.11.0.1/dbreference_en11/rf-datatypes.html + # + # Numeric types + 'bit' => { data_type => 'bit' }, + 'tinyint' => { data_type => 'tinyint' }, + 'smallint' => { data_type => 'smallint' }, + 'int' => { data_type => 'integer' }, + 'integer' => { data_type => 'integer' }, + 'bigint' => { data_type => 'bigint' }, + 'float' => { data_type => 'real' }, + 'real' => { data_type => 'real' }, + 'double' => { data_type => 'double precision' }, + 'double precision' => + { data_type => 'double precision' }, + + 'float(2)' => { data_type => 'real' }, + 'float(24)' => { data_type => 'real' }, + 'float(25)' => { data_type => 'double precision' }, + 'float(53)' => { data_type => 'double precision' }, + + # This test only works with the default precision and scale options. + # + # They are preserved even for the default values, because the defaults + # can be changed. + 'decimal' => { data_type => 'decimal', size => [30,6] }, + 'dec' => { data_type => 'decimal', size => [30,6] }, + 'numeric' => { data_type => 'numeric', size => [30,6] }, + + 'decimal(3)' => { data_type => 'decimal', size => [3,0] }, + 'dec(3)' => { data_type => 'decimal', size => [3,0] }, + 'numeric(3)' => { data_type => 'numeric', size => [3,0] }, + + 'decimal(3,3)' => { data_type => 'decimal', size => [3,3] }, + 'dec(3,3)' => { data_type => 'decimal', size => [3,3] }, + 'numeric(3,3)' => { data_type => 'numeric', size => [3,3] }, + + 'decimal(18,18)' => { data_type => 'decimal', size => [18,18] }, + 'dec(18,18)' => { data_type => 'decimal', size => [18,18] }, + 'numeric(18,18)' => { data_type => 'numeric', size => [18,18] }, + + # money types + 'money' => { data_type => 'money' }, + 'smallmoney' => { data_type => 'smallmoney' }, + + # bit arrays + 'long varbit' => { data_type => 'long varbit' }, + 'long bit varying' + => { data_type => 'long varbit' }, + 'varbit' => { data_type => 'varbit', size => 1 }, + 'varbit(20)' => { data_type => 'varbit', size => 20 }, + 'bit varying' => { data_type => 'varbit', size => 1 }, + 'bit varying(20)' + => { data_type => 'varbit', size => 20 }, + + # Date and Time Types + 'date' => { data_type => 'date' }, + 'datetime' => { data_type => 'datetime' }, + 'smalldatetime' + => { data_type => 'smalldatetime' }, + 'timestamp' => { data_type => 'timestamp' }, + # rewrite 'current timestamp' as 'current_timestamp' + 'timestamp default current timestamp' + => { data_type => 'timestamp', default_value => \'current_timestamp' }, + 'time' => { data_type => 'time' }, + + # String Types + 'char' => { data_type => 'char', size => 1 }, + 'char(11)' => { data_type => 'char', size => 11 }, + 'nchar' => { data_type => 'nchar', size => 1 }, + 'nchar(11)' => { data_type => 'nchar', size => 11 }, + 'varchar' => { data_type => 'varchar', size => 1 }, + 'varchar(20)' => { data_type => 'varchar', size => 20 }, + 'char varying(20)' + => { data_type => 'varchar', size => 20 }, + 'character varying(20)' + => { data_type => 'varchar', size => 20 }, + 'nvarchar(20)' => { data_type => 'nvarchar', size => 20 }, + 'xml' => { data_type => 'xml' }, + 'uniqueidentifierstr' + => { data_type => 'uniqueidentifierstr' }, + + # Binary types + 'binary' => { data_type => 'binary', size => 1 }, + 'binary(20)' => { data_type => 'binary', size => 20 }, + 'varbinary' => { data_type => 'varbinary', size => 1 }, + 'varbinary(20)'=> { data_type => 'varbinary', size => 20 }, + 'uniqueidentifier' + => { data_type => 'uniqueidentifier' }, + + # Blob types + 'long binary' => { data_type => 'long binary' }, + 'image' => { data_type => 'image' }, + 'long varchar' => { data_type => 'long varchar' }, + 'text' => { data_type => 'text' }, + 'long nvarchar'=> { data_type => 'long nvarchar' }, + 'ntext' => { data_type => 'ntext' }, + }, + ); if (not ($dbd_sqlanywhere_dsn || $odbc_dsn)) {