Commit | Line | Data |
8793567f |
1 | use strict; |
5347f501 |
2 | use warnings; |
8793567f |
3 | use lib qw(t/lib); |
4 | use dbixcsl_common_tests; |
5 | |
6 | # The default max_cursor_count and max_statement_count settings of 50 are too |
7 | # low to run this test. |
8a64178e |
8 | # |
9 | # Setting them to zero is preferred. |
8793567f |
10 | |
5347f501 |
11 | my $dbd_sqlanywhere_dsn = $ENV{DBICTEST_SYBASE_ASA_DSN} || ''; |
12 | my $dbd_sqlanywhere_user = $ENV{DBICTEST_SYBASE_ASA_USER} || ''; |
13 | my $dbd_sqlanywhere_password = $ENV{DBICTEST_SYBASE_ASA_PASS} || ''; |
14 | |
15 | my $odbc_dsn = $ENV{DBICTEST_SYBASE_ASA_ODBC_DSN} || ''; |
16 | my $odbc_user = $ENV{DBICTEST_SYBASE_ASA_ODBC_USER} || ''; |
17 | my $odbc_password = $ENV{DBICTEST_SYBASE_ASA_ODBC_PASS} || ''; |
8793567f |
18 | |
19 | my $tester = dbixcsl_common_tests->new( |
20 | vendor => 'SQLAnywhere', |
21 | auto_inc_pk => 'INTEGER IDENTITY NOT NULL PRIMARY KEY', |
5347f501 |
22 | connect_info => [ ($dbd_sqlanywhere_dsn ? { |
23 | dsn => $dbd_sqlanywhere_dsn, |
24 | user => $dbd_sqlanywhere_user, |
25 | password => $dbd_sqlanywhere_password, |
26 | } : ()), |
27 | ($odbc_dsn ? { |
28 | dsn => $odbc_dsn, |
29 | user => $odbc_user, |
30 | password => $odbc_password, |
31 | } : ()), |
32 | ], |
9dc968df |
33 | data_types => { |
34 | # http://infocenter.sybase.com/help/topic/com.sybase.help.sqlanywhere.11.0.1/dbreference_en11/rf-datatypes.html |
35 | # |
36 | # Numeric types |
37 | 'bit' => { data_type => 'bit' }, |
38 | 'tinyint' => { data_type => 'tinyint' }, |
39 | 'smallint' => { data_type => 'smallint' }, |
40 | 'int' => { data_type => 'integer' }, |
41 | 'integer' => { data_type => 'integer' }, |
42 | 'bigint' => { data_type => 'bigint' }, |
43 | 'float' => { data_type => 'float' }, |
44 | 'real' => { data_type => 'float' }, |
45 | 'double' => { data_type => 'double precision' }, |
46 | 'double precision' => |
47 | { data_type => 'double precision' }, |
48 | |
49 | 'float(2)' => { data_type => 'float' }, |
50 | 'float(24)' => { data_type => 'float' }, |
51 | 'float(25)' => { data_type => 'double precision' }, |
52 | 'float(53)' => { data_type => 'double precision' }, |
53 | |
54 | # This test only works with the default precision and scale options. |
55 | # |
56 | # They are preserved even for the default values, because the defaults |
57 | # can be changed. |
58 | 'decimal' => { data_type => 'decimal', size => [30,6] }, |
59 | 'dec' => { data_type => 'decimal', size => [30,6] }, |
60 | 'numeric' => { data_type => 'numeric', size => [30,6] }, |
61 | |
62 | 'decimal(3)' => { data_type => 'decimal', size => [3,0] }, |
63 | 'dec(3)' => { data_type => 'decimal', size => [3,0] }, |
64 | 'numeric(3)' => { data_type => 'numeric', size => [3,0] }, |
65 | |
66 | 'decimal(3,3)' => { data_type => 'decimal', size => [3,3] }, |
67 | 'dec(3,3)' => { data_type => 'decimal', size => [3,3] }, |
68 | 'numeric(3,3)' => { data_type => 'numeric', size => [3,3] }, |
69 | |
70 | 'decimal(18,18)' => { data_type => 'decimal', size => [18,18] }, |
71 | 'dec(18,18)' => { data_type => 'decimal', size => [18,18] }, |
72 | 'numeric(18,18)' => { data_type => 'numeric', size => [18,18] }, |
73 | |
74 | # money types |
75 | 'money' => { data_type => 'money' }, |
76 | 'smallmoney' => { data_type => 'smallmoney' }, |
77 | |
78 | # bit arrays |
79 | 'long varbit' => { data_type => 'long varbit' }, |
80 | 'long bit varying' |
81 | => { data_type => 'long varbit' }, |
82 | 'varbit' => { data_type => 'varbit', size => 1 }, |
83 | 'varbit(20)' => { data_type => 'varbit', size => 20 }, |
84 | 'bit varying' => { data_type => 'varbit', size => 1 }, |
85 | 'bit varying(20)' |
86 | => { data_type => 'varbit', size => 20 }, |
87 | |
88 | # Date and Time Types |
89 | 'date' => { data_type => 'date' }, |
90 | 'datetime' => { data_type => 'datetime' }, |
91 | 'smalldatetime' |
92 | => { data_type => 'smalldatetime' }, |
93 | 'timestamp' => { data_type => 'timestamp' }, |
8a64178e |
94 | # rewrite 'current timestamp' as 'CURRENT_TIMESTAMP' |
9dc968df |
95 | 'timestamp DEFAULT current timestamp' |
8a64178e |
96 | => { data_type => 'timestamp', default_value => \"CURRENT_TIMESTAMP" }, |
9dc968df |
97 | 'time' => { data_type => 'time' }, |
98 | |
99 | # String Types |
100 | 'char' => { data_type => 'char', size => 1 }, |
101 | 'char(11)' => { data_type => 'char', size => 11 }, |
102 | 'nchar' => { data_type => 'nchar', size => 1 }, |
103 | 'nchar(11)' => { data_type => 'nchar', size => 11 }, |
104 | 'varchar' => { data_type => 'varchar', size => 1 }, |
105 | 'varchar(20)' => { data_type => 'varchar', size => 20 }, |
106 | 'char varying(20)' |
107 | => { data_type => 'varchar', size => 20 }, |
108 | 'character varying(20)' |
109 | => { data_type => 'varchar', size => 20 }, |
110 | 'nvarchar(20)' => { data_type => 'nvarchar', size => 20 }, |
111 | 'xml' => { data_type => 'xml' }, |
112 | 'uniqueidentifierstr' |
113 | => { data_type => 'uniqueidentifierstr' }, |
114 | |
115 | # Binary types |
116 | 'binary' => { data_type => 'binary', size => 1 }, |
117 | 'binary(20)' => { data_type => 'binary', size => 20 }, |
118 | 'varbinary' => { data_type => 'varbinary', size => 1 }, |
119 | 'varbinary(20)'=> { data_type => 'varbinary', size => 20 }, |
120 | 'uniqueidentifier' |
121 | => { data_type => 'uniqueidentifier' }, |
122 | |
123 | # Blob types |
124 | 'long binary' => { data_type => 'long binary' }, |
125 | 'image' => { data_type => 'image' }, |
126 | 'long varchar' => { data_type => 'long varchar' }, |
127 | 'text' => { data_type => 'text' }, |
128 | 'long nvarchar'=> { data_type => 'long nvarchar' }, |
129 | 'ntext' => { data_type => 'ntext' }, |
130 | }, |
131 | |
8793567f |
132 | ); |
133 | |
5347f501 |
134 | if (not ($dbd_sqlanywhere_dsn || $odbc_dsn)) { |
135 | $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'); |
8793567f |
136 | } |
137 | else { |
138 | $tester->run_tests(); |
139 | } |