~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/user_var.test

  • Committer: Jay Pipes
  • Date: 2009-01-30 04:01:12 UTC
  • mto: This revision was merged to the branch mainline in revision 830.
  • Revision ID: jpipes@serialcoder-20090130040112-svbn774guj98pwi4
To remain in compatibility with MySQL, added ability to interpret
decimal arguments as datetime strings for temporal functions.

Fixed YEAR(), MONTH(), DAYOFMONTH(), DAYOFYEAR(), HOUR(), MINUTE(), SECOND(), and MICROSECOND()
to accept decimal parameters and interpret them the same way as MySQL.

Fixed an issue with the TemporalFormat::matches() method which was 
incorrectly assuming all microsecond arguments were specified as 6 digits.
Added power of 10 multiplier to usecond calculation. This fixes issues with
failures in type_date and func_sapdb test cases.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
drop table if exists t1,t2;
4
4
--enable_warnings
5
5
 
6
 
--error ER_BAD_FIELD_ERROR
 
6
--error 1054
7
7
set @a := foo;
8
8
set @a := connection_id() + 3;
9
9
select @a - connection_id();
77
77
drop table t1;
78
78
 
79
79
#
 
80
# Bug #2244: User variables didn't copy collation and derivation
 
81
# attributes from values they were initialized to.
 
82
#
 
83
 
 
84
set @a='test';
 
85
select collation(@a),coercibility(@a);
 
86
select @a='TEST';
 
87
select @a='TEST' collate utf8_bin;
 
88
 
 
89
set @a='test' collate utf8_general_ci;
 
90
select collation(@a),coercibility(@a);
 
91
select @a='TEST';
 
92
select @a='TEST' collate utf8_bin;
 
93
 
 
94
#
 
95
# Check the same invoking Item_set_user_var
 
96
#
 
97
select collation(@a:='test');
 
98
select coercibility(@a:='test');
 
99
select collation(@a:='test' collate utf8_bin);
 
100
select coercibility(@a:='test' collate utf8_bin);
 
101
select (@a:='test' collate utf8_bin) = 'TEST';
 
102
select collation(@a),coercibility(@a);
 
103
select (@a:='test' collate utf8_bin) = 'TEST' collate utf8_general_ci;
 
104
 
 
105
#
80
106
# Bug #6321 strange error:
81
107
#   string function FIELD(<uservariable content NULL>, ...)
82
108
#
84
110
select FIELD( @var,'1it','Hit') as my_column;
85
111
 
86
112
#
 
113
# Bug#9425 A user variable doesn't always have implicit coercibility
 
114
#
 
115
select @v, coercibility(@v);
 
116
set @v1=null, @v2=1, @v3=1.1, @v4=now();
 
117
select coercibility(@v1),coercibility(@v2),coercibility(@v3),coercibility(@v4);
 
118
 
 
119
#
87
120
# Bug #9286  SESSION/GLOBAL should be disallowed for user variables
88
121
#
89
 
--error ER_PARSE_ERROR
 
122
--error 1064
90
123
set session @honk=99;
91
124
 
92
125
#
115
148
 
116
149
set @first_var= NULL;
117
150
create table t1 select @first_var;
118
 
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
119
151
show create table t1;
120
152
drop table t1;
121
153
 
122
154
# This is not supported by Drizzle
123
 
--error ER_PARSE_ERROR
 
155
--error 1064
124
156
set @first_var= cast(NULL as integer);
125
157
#create table t1 select @first_var;
126
 
#--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
127
158
#show create table t1;
128
159
#drop table t1;
129
160
 
130
161
set @first_var= NULL;
131
162
create table t1 select @first_var;
132
 
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
133
163
show create table t1;
134
164
drop table t1;
135
165
set @first_var= concat(NULL);
136
166
create table t1 select @first_var;
137
 
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
138
167
show create table t1;
139
168
drop table t1;
140
169
set @first_var=1;
141
170
set @first_var= cast(NULL as CHAR);
142
171
create table t1 select @first_var;
143
 
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
144
172
show create table t1;
145
173
drop table t1;
146
174
 
193
221
#
194
222
# Bug#19024 - SHOW COUNT(*) WARNINGS not return Errors 
195
223
#
196
 
--error ER_PARSE_ERROR
 
224
--error 1064
197
225
insert into city 'blah';
198
226
SHOW COUNT(*) WARNINGS;
199
227
SHOW COUNT(*) ERRORS;