reorganize sybase data_type tests
[dbsrgits/DBIx-Class-Schema-Loader.git] / t / 15sybase_common.t
CommitLineData
fe67d343 1use strict;
2use lib qw(t/lib);
3use dbixcsl_common_tests;
804c115d 4use Test::More;
2d1dc6de 5use Test::Exception;
6ecee584 6use List::MoreUtils 'apply';
f9f65ded 7
fe67d343 8my $dsn = $ENV{DBICTEST_SYBASE_DSN} || '';
9my $user = $ENV{DBICTEST_SYBASE_USER} || '';
10my $password = $ENV{DBICTEST_SYBASE_PASS} || '';
11
12my $tester = dbixcsl_common_tests->new(
7cb9244f 13 vendor => 'sybase',
fe67d343 14 auto_inc_pk => 'INTEGER IDENTITY NOT NULL PRIMARY KEY',
41968729 15 default_function => 'getdate()',
16 default_function_def => 'AS getdate()',
fe67d343 17 dsn => $dsn,
18 user => $user,
19 password => $password,
5163dc4a 20 data_types => {
760fd65c 21 # http://ispirer.com/wiki/sqlways/sybase/data-types
6bbfc7ed 22 #
23 # Numeric Types
5163dc4a 24 'integer identity' => { data_type => 'integer', is_auto_increment => 1 },
5163dc4a 25 int => { data_type => 'integer' },
26 integer => { data_type => 'integer' },
6bbfc7ed 27 bigint => { data_type => 'bigint' },
5163dc4a 28 smallint => { data_type => 'smallint' },
29 tinyint => { data_type => 'tinyint' },
6bbfc7ed 30 'double precision' => { data_type => 'double precision' },
31 real => { data_type => 'real' },
32 float => { data_type => 'double precision' },
33 'float(14)' => { data_type => 'real' },
34 'float(15)' => { data_type => 'real' },
35 'float(16)' => { data_type => 'double precision' },
36 'float(48)' => { data_type => 'double precision' },
37 'numeric(6,3)' => { data_type => 'numeric', size => [6,3] },
38 'decimal(6,3)' => { data_type => 'numeric', size => [6,3] },
39 numeric => { data_type => 'numeric' },
40 decimal => { data_type => 'numeric' },
41 bit => { data_type => 'bit' },
42
43 # Money Types
44 money => { data_type => 'money' },
45 smallmoney => { data_type => 'smallmoney' },
46
47 # Computed Column
48 'AS getdate()' => { data_type => undef, inflate_datetime => 1, default_value => \'getdate()' },
49
50 # Blob Types
51 text => { data_type => 'text' },
52 unitext => { data_type => 'unitext' },
53 image => { data_type => 'image' },
54
55 # DateTime Types
5163dc4a 56 date => { data_type => 'date' },
57 time => { data_type => 'time' },
58 datetime => { data_type => 'datetime' },
59 smalldatetime => { data_type => 'smalldatetime' },
6bbfc7ed 60
61 # Timestamp column
5163dc4a 62 timestamp => { data_type => 'timestamp', inflate_datetime => 0 },
6bbfc7ed 63
64 # String Types
65 'char' => { data_type => 'char', size => 1 },
5163dc4a 66 'char(2)' => { data_type => 'char', size => 2 },
6bbfc7ed 67 'nchar' => { data_type => 'nchar', size => 1 },
5163dc4a 68 'nchar(2)' => { data_type => 'nchar', size => 2 },
69 'unichar(2)' => { data_type => 'unichar', size => 2 },
70 'varchar(2)' => { data_type => 'varchar', size => 2 },
71 'nvarchar(2)' => { data_type => 'nvarchar', size => 2 },
72 'univarchar(2)' => { data_type => 'univarchar', size => 2 },
6bbfc7ed 73
74 # Binary Types
75 'binary' => { data_type => 'binary', size => 1 },
5163dc4a 76 'binary(2)' => { data_type => 'binary', size => 2 },
77 'varbinary(2)' => { data_type => 'varbinary', size => 2 },
804c115d 78 },
fe67d343 79);
80
81if( !$dsn || !$user ) {
82 $tester->skip_tests('You need to set the DBICTEST_SYBASE_DSN, _USER, and _PASS environment variables');
83}
84else {
85 $tester->run_tests();
86}