3 use dbixcsl_common_tests;
6 use List::MoreUtils 'apply';
8 my $dsn = $ENV{DBICTEST_SYBASE_DSN} || '';
9 my $user = $ENV{DBICTEST_SYBASE_USER} || '';
10 my $password = $ENV{DBICTEST_SYBASE_PASS} || '';
12 my $tester = dbixcsl_common_tests->new(
14 auto_inc_pk => 'INTEGER IDENTITY NOT NULL PRIMARY KEY',
15 default_function => 'getdate()',
16 default_function_def => 'AS getdate()',
19 password => $password,
21 # http://ispirer.com/wiki/sqlways/sybase/data-types
24 'integer identity' => { data_type => 'integer', is_auto_increment => 1 },
25 int => { data_type => 'integer' },
26 integer => { data_type => 'integer' },
27 bigint => { data_type => 'bigint' },
28 smallint => { data_type => 'smallint' },
29 tinyint => { data_type => 'tinyint' },
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' },
44 money => { data_type => 'money' },
45 smallmoney => { data_type => 'smallmoney' },
48 'AS getdate()' => { data_type => undef, inflate_datetime => 1, default_value => \'getdate()' },
51 text => { data_type => 'text' },
52 unitext => { data_type => 'unitext' },
53 image => { data_type => 'image' },
56 date => { data_type => 'date' },
57 time => { data_type => 'time' },
58 datetime => { data_type => 'datetime' },
59 smalldatetime => { data_type => 'smalldatetime' },
62 timestamp => { data_type => 'timestamp', inflate_datetime => 0 },
65 'char' => { data_type => 'char', size => 1 },
66 'char(2)' => { data_type => 'char', size => 2 },
67 'nchar' => { data_type => 'nchar', size => 1 },
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 },
75 'binary' => { data_type => 'binary', size => 1 },
76 'binary(2)' => { data_type => 'binary', size => 2 },
77 'varbinary(2)' => { data_type => 'varbinary', size => 2 },
79 # test that named constraints aren't picked up as tables (I can't reproduce this on my machine)
80 failtrigger_warnings => [ qr/^Bad table or view 'sybase_loader_test2_ref_slt1'/ ],
84 CREATE TABLE sybase_loader_test1 (
85 id int identity primary key
89 CREATE TABLE sybase_loader_test2 (
90 id int identity primary key,
91 sybase_loader_test1_id int,
92 CONSTRAINT sybase_loader_test2_ref_slt1 FOREIGN KEY (sybase_loader_test1_id) REFERENCES sybase_loader_test1 (id)
96 drop => [ qw/sybase_loader_test1 sybase_loader_test2/ ],
100 if( !$dsn || !$user ) {
101 $tester->skip_tests('You need to set the DBICTEST_SYBASE_DSN, _USER, and _PASS environment variables');
104 $tester->run_tests();
107 # vim:et sts=4 sw=4 tw=0: