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. |
8 | |
5347f501 |
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} || ''; |
12 | |
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} || ''; |
8793567f |
16 | |
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', |
5347f501 |
21 | connect_info => [ ($dbd_sqlanywhere_dsn ? { |
22 | dsn => $dbd_sqlanywhere_dsn, |
23 | user => $dbd_sqlanywhere_user, |
24 | password => $dbd_sqlanywhere_password, |
25 | } : ()), |
26 | ($odbc_dsn ? { |
27 | dsn => $odbc_dsn, |
28 | user => $odbc_user, |
29 | password => $odbc_password, |
30 | } : ()), |
31 | ], |
9dc968df |
32 | data_types => { |
33 | # http://infocenter.sybase.com/help/topic/com.sybase.help.sqlanywhere.11.0.1/dbreference_en11/rf-datatypes.html |
34 | # |
35 | # Numeric types |
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' }, |
45 | 'double precision' => |
46 | { data_type => 'double precision' }, |
47 | |
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' }, |
52 | |
53 | # This test only works with the default precision and scale options. |
54 | # |
55 | # They are preserved even for the default values, because the defaults |
56 | # can be changed. |
57 | 'decimal' => { data_type => 'decimal', size => [30,6] }, |
58 | 'dec' => { data_type => 'decimal', size => [30,6] }, |
59 | 'numeric' => { data_type => 'numeric', size => [30,6] }, |
60 | |
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] }, |
64 | |
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] }, |
68 | |
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] }, |
72 | |
73 | # money types |
74 | 'money' => { data_type => 'money' }, |
75 | 'smallmoney' => { data_type => 'smallmoney' }, |
76 | |
77 | # bit arrays |
78 | 'long varbit' => { data_type => 'long varbit' }, |
79 | 'long bit varying' |
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 }, |
84 | 'bit varying(20)' |
85 | => { data_type => 'varbit', size => 20 }, |
86 | |
87 | # Date and Time Types |
88 | 'date' => { data_type => 'date' }, |
89 | 'datetime' => { data_type => 'datetime' }, |
90 | 'smalldatetime' |
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' }, |
96 | |
97 | # String Types |
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 }, |
104 | 'char varying(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' }, |
112 | |
113 | # Binary types |
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 }, |
118 | 'uniqueidentifier' |
119 | => { data_type => 'uniqueidentifier' }, |
120 | |
121 | # Blob types |
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' }, |
128 | }, |
129 | |
8793567f |
130 | ); |
131 | |
5347f501 |
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'); |
8793567f |
134 | } |
135 | else { |
136 | $tester->run_tests(); |
137 | } |