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 # Setting them to zero is preferred.
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} || '';
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} || '';
19 my $tester = dbixcsl_common_tests->new(
20 vendor => 'SQLAnywhere',
21 auto_inc_pk => 'INTEGER IDENTITY NOT NULL PRIMARY KEY',
22 connect_info => [ ($dbd_sqlanywhere_dsn ? {
23 dsn => $dbd_sqlanywhere_dsn,
24 user => $dbd_sqlanywhere_user,
25 password => $dbd_sqlanywhere_password,
30 password => $odbc_password,
33 loader_options => { preserve_case => 1 },
35 # http://infocenter.sybase.com/help/topic/com.sybase.help.sqlanywhere.11.0.1/dbreference_en11/rf-datatypes.html
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' },
44 'float' => { data_type => 'real' },
45 'real' => { data_type => 'real' },
46 'double' => { data_type => 'double precision' },
48 { data_type => 'double precision' },
50 'float(2)' => { data_type => 'real' },
51 'float(24)' => { data_type => 'real' },
52 'float(25)' => { data_type => 'double precision' },
53 'float(53)' => { data_type => 'double precision' },
55 # This test only works with the default precision and scale options.
57 # They are preserved even for the default values, because the defaults
59 'decimal' => { data_type => 'decimal', size => [30,6] },
60 'dec' => { data_type => 'decimal', size => [30,6] },
61 'numeric' => { data_type => 'numeric', size => [30,6] },
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] },
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] },
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] },
76 'money' => { data_type => 'money' },
77 'smallmoney' => { data_type => 'smallmoney' },
80 'long varbit' => { data_type => 'long varbit' },
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 },
87 => { data_type => 'varbit', size => 20 },
90 'date' => { data_type => 'date' },
91 'datetime' => { data_type => 'datetime' },
93 => { data_type => 'smalldatetime' },
94 'timestamp' => { data_type => 'timestamp' },
95 # rewrite 'current timestamp' as 'current_timestamp'
96 'timestamp default current timestamp'
97 => { data_type => 'timestamp', default_value => \'current_timestamp',
98 original => { default_value => \'current timestamp' } },
99 'time' => { data_type => 'time' },
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 },
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'
115 => { data_type => 'uniqueidentifierstr' },
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 },
123 => { data_type => 'uniqueidentifier' },
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' },
136 if (not ($dbd_sqlanywhere_dsn || $odbc_dsn)) {
137 $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');
140 $tester->run_tests();
142 # vim:et sts=4 sw=4 tw=0: