4 use dbixcsl_common_tests;
6 # The default max_cursor_count and max_statement_count settings of 50 are too
7 # low to run this test.
9 my $dbd_sqlanywhere_dsn = $ENV{DBICTEST_SYBASE_ASA_DSN} || '';
10 my $dbd_sqlanywhere_user = $ENV{DBICTEST_SYBASE_ASA_USER} || '';
11 my $dbd_sqlanywhere_password = $ENV{DBICTEST_SYBASE_ASA_PASS} || '';
13 my $odbc_dsn = $ENV{DBICTEST_SYBASE_ASA_ODBC_DSN} || '';
14 my $odbc_user = $ENV{DBICTEST_SYBASE_ASA_ODBC_USER} || '';
15 my $odbc_password = $ENV{DBICTEST_SYBASE_ASA_ODBC_PASS} || '';
17 my $tester = dbixcsl_common_tests->new(
18 vendor => 'SQLAnywhere',
19 auto_inc_pk => 'INTEGER IDENTITY NOT NULL PRIMARY KEY',
20 default_function => 'current timestamp',
21 connect_info => [ ($dbd_sqlanywhere_dsn ? {
22 dsn => $dbd_sqlanywhere_dsn,
23 user => $dbd_sqlanywhere_user,
24 password => $dbd_sqlanywhere_password,
29 password => $odbc_password,
33 # http://infocenter.sybase.com/help/topic/com.sybase.help.sqlanywhere.11.0.1/dbreference_en11/rf-datatypes.html
36 'bit' => { data_type => 'bit' },
37 'tinyint' => { data_type => 'tinyint' },
38 'smallint' => { data_type => 'smallint' },
39 'int' => { data_type => 'integer' },
40 'integer' => { data_type => 'integer' },
41 'bigint' => { data_type => 'bigint' },
42 'float' => { data_type => 'float' },
43 'real' => { data_type => 'float' },
44 'double' => { data_type => 'double precision' },
46 { data_type => 'double precision' },
48 'float(2)' => { data_type => 'float' },
49 'float(24)' => { data_type => 'float' },
50 'float(25)' => { data_type => 'double precision' },
51 'float(53)' => { data_type => 'double precision' },
53 # This test only works with the default precision and scale options.
55 # They are preserved even for the default values, because the defaults
57 'decimal' => { data_type => 'decimal', size => [30,6] },
58 'dec' => { data_type => 'decimal', size => [30,6] },
59 'numeric' => { data_type => 'numeric', size => [30,6] },
61 'decimal(3)' => { data_type => 'decimal', size => [3,0] },
62 'dec(3)' => { data_type => 'decimal', size => [3,0] },
63 'numeric(3)' => { data_type => 'numeric', size => [3,0] },
65 'decimal(3,3)' => { data_type => 'decimal', size => [3,3] },
66 'dec(3,3)' => { data_type => 'decimal', size => [3,3] },
67 'numeric(3,3)' => { data_type => 'numeric', size => [3,3] },
69 'decimal(18,18)' => { data_type => 'decimal', size => [18,18] },
70 'dec(18,18)' => { data_type => 'decimal', size => [18,18] },
71 'numeric(18,18)' => { data_type => 'numeric', size => [18,18] },
74 'money' => { data_type => 'money' },
75 'smallmoney' => { data_type => 'smallmoney' },
78 'long varbit' => { data_type => 'long varbit' },
80 => { data_type => 'long varbit' },
81 'varbit' => { data_type => 'varbit', size => 1 },
82 'varbit(20)' => { data_type => 'varbit', size => 20 },
83 'bit varying' => { data_type => 'varbit', size => 1 },
85 => { data_type => 'varbit', size => 20 },
88 'date' => { data_type => 'date' },
89 'datetime' => { data_type => 'datetime' },
91 => { data_type => 'smalldatetime' },
92 'timestamp' => { data_type => 'timestamp' },
93 'timestamp DEFAULT current timestamp'
94 => { data_type => 'timestamp', default_value => \"current timestamp" },
95 'time' => { data_type => 'time' },
98 'char' => { data_type => 'char', size => 1 },
99 'char(11)' => { data_type => 'char', size => 11 },
100 'nchar' => { data_type => 'nchar', size => 1 },
101 'nchar(11)' => { data_type => 'nchar', size => 11 },
102 'varchar' => { data_type => 'varchar', size => 1 },
103 'varchar(20)' => { data_type => 'varchar', size => 20 },
105 => { data_type => 'varchar', size => 20 },
106 'character varying(20)'
107 => { data_type => 'varchar', size => 20 },
108 'nvarchar(20)' => { data_type => 'nvarchar', size => 20 },
109 'xml' => { data_type => 'xml' },
110 'uniqueidentifierstr'
111 => { data_type => 'uniqueidentifierstr' },
114 'binary' => { data_type => 'binary', size => 1 },
115 'binary(20)' => { data_type => 'binary', size => 20 },
116 'varbinary' => { data_type => 'varbinary', size => 1 },
117 'varbinary(20)'=> { data_type => 'varbinary', size => 20 },
119 => { data_type => 'uniqueidentifier' },
122 'long binary' => { data_type => 'long binary' },
123 'image' => { data_type => 'image' },
124 'long varchar' => { data_type => 'long varchar' },
125 'text' => { data_type => 'text' },
126 'long nvarchar'=> { data_type => 'long nvarchar' },
127 'ntext' => { data_type => 'ntext' },
132 if (not ($dbd_sqlanywhere_dsn || $odbc_dsn)) {
133 $tester->skip_tests('You need to set the DBICTEST_SYBASE_ASA_DSN, _USER and _PASS and/or the DBICTEST_SYBASE_ASA_ODBC_DSN, _USER and _PASS environment variables');
136 $tester->run_tests();