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 | |
637a5785 |
11 | my $dbd_sqlanywhere_dsn = $ENV{DBICTEST_SQLANYWHERE_DSN} || ''; |
12 | my $dbd_sqlanywhere_user = $ENV{DBICTEST_SQLANYWHERE_USER} || ''; |
13 | my $dbd_sqlanywhere_password = $ENV{DBICTEST_SQLANYWHERE_PASS} || ''; |
5347f501 |
14 | |
637a5785 |
15 | my $odbc_dsn = $ENV{DBICTEST_SQLANYWHERE_ODBC_DSN} || ''; |
16 | my $odbc_user = $ENV{DBICTEST_SQLANYWHERE_ODBC_USER} || ''; |
17 | my $odbc_password = $ENV{DBICTEST_SQLANYWHERE_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 | ], |
dd87d4c4 |
33 | loader_options => { preserve_case => 1 }, |
9dc968df |
34 | data_types => { |
35 | # http://infocenter.sybase.com/help/topic/com.sybase.help.sqlanywhere.11.0.1/dbreference_en11/rf-datatypes.html |
36 | # |
37 | # Numeric types |
38 | 'bit' => { data_type => 'bit' }, |
39 | 'tinyint' => { data_type => 'tinyint' }, |
40 | 'smallint' => { data_type => 'smallint' }, |
41 | 'int' => { data_type => 'integer' }, |
42 | 'integer' => { data_type => 'integer' }, |
43 | 'bigint' => { data_type => 'bigint' }, |
dd87d4c4 |
44 | 'float' => { data_type => 'real' }, |
45 | 'real' => { data_type => 'real' }, |
9dc968df |
46 | 'double' => { data_type => 'double precision' }, |
47 | 'double precision' => |
48 | { data_type => 'double precision' }, |
49 | |
dd87d4c4 |
50 | 'float(2)' => { data_type => 'real' }, |
51 | 'float(24)' => { data_type => 'real' }, |
9dc968df |
52 | 'float(25)' => { data_type => 'double precision' }, |
53 | 'float(53)' => { data_type => 'double precision' }, |
54 | |
55 | # This test only works with the default precision and scale options. |
56 | # |
57 | # They are preserved even for the default values, because the defaults |
58 | # can be changed. |
59 | 'decimal' => { data_type => 'decimal', size => [30,6] }, |
60 | 'dec' => { data_type => 'decimal', size => [30,6] }, |
61 | 'numeric' => { data_type => 'numeric', size => [30,6] }, |
62 | |
63 | 'decimal(3)' => { data_type => 'decimal', size => [3,0] }, |
64 | 'dec(3)' => { data_type => 'decimal', size => [3,0] }, |
65 | 'numeric(3)' => { data_type => 'numeric', size => [3,0] }, |
66 | |
67 | 'decimal(3,3)' => { data_type => 'decimal', size => [3,3] }, |
68 | 'dec(3,3)' => { data_type => 'decimal', size => [3,3] }, |
69 | 'numeric(3,3)' => { data_type => 'numeric', size => [3,3] }, |
70 | |
71 | 'decimal(18,18)' => { data_type => 'decimal', size => [18,18] }, |
72 | 'dec(18,18)' => { data_type => 'decimal', size => [18,18] }, |
73 | 'numeric(18,18)' => { data_type => 'numeric', size => [18,18] }, |
74 | |
75 | # money types |
76 | 'money' => { data_type => 'money' }, |
77 | 'smallmoney' => { data_type => 'smallmoney' }, |
78 | |
79 | # bit arrays |
80 | 'long varbit' => { data_type => 'long varbit' }, |
81 | 'long bit varying' |
82 | => { data_type => 'long varbit' }, |
83 | 'varbit' => { data_type => 'varbit', size => 1 }, |
84 | 'varbit(20)' => { data_type => 'varbit', size => 20 }, |
85 | 'bit varying' => { data_type => 'varbit', size => 1 }, |
86 | 'bit varying(20)' |
87 | => { data_type => 'varbit', size => 20 }, |
88 | |
89 | # Date and Time Types |
90 | 'date' => { data_type => 'date' }, |
91 | 'datetime' => { data_type => 'datetime' }, |
92 | 'smalldatetime' |
93 | => { data_type => 'smalldatetime' }, |
94 | 'timestamp' => { data_type => 'timestamp' }, |
6e566cc4 |
95 | # rewrite 'current timestamp' as 'current_timestamp' |
96 | 'timestamp default current timestamp' |
701cd3e3 |
97 | => { data_type => 'timestamp', default_value => \'current_timestamp', |
98 | original => { default_value => \'current timestamp' } }, |
9dc968df |
99 | 'time' => { data_type => 'time' }, |
100 | |
101 | # String Types |
102 | 'char' => { data_type => 'char', size => 1 }, |
103 | 'char(11)' => { data_type => 'char', size => 11 }, |
104 | 'nchar' => { data_type => 'nchar', size => 1 }, |
105 | 'nchar(11)' => { data_type => 'nchar', size => 11 }, |
106 | 'varchar' => { data_type => 'varchar', size => 1 }, |
107 | 'varchar(20)' => { data_type => 'varchar', size => 20 }, |
108 | 'char varying(20)' |
109 | => { data_type => 'varchar', size => 20 }, |
110 | 'character varying(20)' |
111 | => { data_type => 'varchar', size => 20 }, |
112 | 'nvarchar(20)' => { data_type => 'nvarchar', size => 20 }, |
113 | 'xml' => { data_type => 'xml' }, |
114 | 'uniqueidentifierstr' |
825c42a3 |
115 | => { data_type => 'uniqueidentifierstr' }, |
9dc968df |
116 | |
117 | # Binary types |
118 | 'binary' => { data_type => 'binary', size => 1 }, |
119 | 'binary(20)' => { data_type => 'binary', size => 20 }, |
120 | 'varbinary' => { data_type => 'varbinary', size => 1 }, |
121 | 'varbinary(20)'=> { data_type => 'varbinary', size => 20 }, |
122 | 'uniqueidentifier' |
825c42a3 |
123 | => { data_type => 'uniqueidentifier' }, |
9dc968df |
124 | |
125 | # Blob types |
126 | 'long binary' => { data_type => 'long binary' }, |
127 | 'image' => { data_type => 'image' }, |
128 | 'long varchar' => { data_type => 'long varchar' }, |
129 | 'text' => { data_type => 'text' }, |
130 | 'long nvarchar'=> { data_type => 'long nvarchar' }, |
131 | 'ntext' => { data_type => 'ntext' }, |
132 | }, |
133 | |
8793567f |
134 | ); |
135 | |
5347f501 |
136 | if (not ($dbd_sqlanywhere_dsn || $odbc_dsn)) { |
637a5785 |
137 | $tester->skip_tests('You need to set the DBICTEST_SQLANYWHERE_DSN, _USER and _PASS and/or the DBICTEST_SQLANYWHERE_ODBC_DSN, _USER and _PASS environment variables'); |
8793567f |
138 | } |
139 | else { |
140 | $tester->run_tests(); |
141 | } |
701cd3e3 |
142 | # vim:et sts=4 sw=4 tw=0: |