1
by brian
clean slate |
1 |
/* Copyright (C) 2000-2003 MySQL AB |
2 |
||
3 |
This program is free software; you can redistribute it and/or modify |
|
4 |
it under the terms of the GNU General Public License as published by |
|
5 |
the Free Software Foundation; version 2 of the License. |
|
6 |
||
7 |
This program is distributed in the hope that it will be useful, |
|
8 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
10 |
GNU General Public License for more details. |
|
11 |
||
12 |
You should have received a copy of the GNU General Public License |
|
13 |
along with this program; if not, write to the Free Software |
|
14 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ |
|
15 |
||
16 |
/* sql_yacc.yy */ |
|
17 |
||
18 |
/**
|
|
19 |
@defgroup Parser Parser |
|
20 |
@{
|
|
21 |
*/
|
|
22 |
||
23 |
%{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
24 |
/* session is passed as an argument to yyparse(), and subsequently to yylex().
|
25 |
** The type will be void*, so it must be cast to (Session*) when used.
|
|
26 |
** Use the YYSession macro for this.
|
|
1
by brian
clean slate |
27 |
*/
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
28 |
#define YYPARSE_PARAM yysession
|
29 |
#define YYLEX_PARAM yysession
|
|
30 |
#define YYSession ((Session *)yysession)
|
|
1
by brian
clean slate |
31 |
|
77.1.45
by Monty Taylor
Warning fixes. |
32 |
#define YYENABLE_NLS 0
|
33 |
#define YYLTYPE_IS_TRIVIAL 0
|
|
34 |
||
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
35 |
#define DRIZZLE_YACC
|
1
by brian
clean slate |
36 |
#define YYINITDEPTH 100
|
37 |
#define YYMAXDEPTH 3200 /* Because of 64K stack */
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
38 |
#define Lex (YYSession->lex)
|
1
by brian
clean slate |
39 |
#define Select Lex->current_select
|
243.1.17
by Jay Pipes
FINAL PHASE removal of mysql_priv.h (Bye, bye my friend.) |
40 |
#include <drizzled/server_includes.h>
|
584.4.7
by Monty Taylor
Removed a big bank of includes from item.h. |
41 |
#include <drizzled/lex_symbol.h>
|
492.3.18
by Lee
need to include functions/locate.h |
42 |
#include <drizzled/functions/locate.h>
|
549
by Monty Taylor
Took gettext.h out of header files. |
43 |
#include <drizzled/error.h>
|
553.1.3
by Monty Taylor
Split out nested_join.h. |
44 |
#include <drizzled/nested_join.h>
|
520.8.2
by Monty Taylor
Moved sql_parse.h and sql_error.h out of common_includes. |
45 |
#include <drizzled/sql_parse.h>
|
584.4.7
by Monty Taylor
Removed a big bank of includes from item.h. |
46 |
#include <drizzled/item/cmpfunc.h>
|
47 |
#include <drizzled/item/timefunc.h>
|
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
48 |
#include <drizzled/virtual_column_info.h>
|
584.1.15
by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes. |
49 |
#include <drizzled/session.h>
|
50 |
#include <drizzled/item/func.h>
|
|
51 |
#include <drizzled/sql_base.h>
|
|
52 |
#include <drizzled/item/create.h>
|
|
53 |
#include <drizzled/lex_string.h>
|
|
54 |
||
55 |
class Table_ident;
|
|
56 |
class Item;
|
|
57 |
class Item_num;
|
|
1
by brian
clean slate |
58 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
59 |
int yylex(void *yylval, void *yysession);
|
1
by brian
clean slate |
60 |
|
61 |
#define yyoverflow(A,B,C,D,E,F) \
|
|
62 |
{ \
|
|
63 |
ulong val= *(F); \
|
|
64 |
if (my_yyoverflow((B), (D), &val)) \
|
|
65 |
{ \
|
|
66 |
yyerror((char*) (A)); \
|
|
67 |
return 2; \
|
|
68 |
} \
|
|
69 |
else \
|
|
70 |
{ \
|
|
71 |
*(F)= (YYSIZE_T)val; \
|
|
72 |
} \
|
|
73 |
}
|
|
74 |
||
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
75 |
#define DRIZZLE_YYABORT \
|
1
by brian
clean slate |
76 |
do \
|
77 |
{ \
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
78 |
LEX::cleanup_lex_after_parse_error(YYSession);\
|
1
by brian
clean slate |
79 |
YYABORT; \
|
80 |
} while (0)
|
|
81 |
||
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
82 |
#define DRIZZLE_YYABORT_UNLESS(A) \
|
1
by brian
clean slate |
83 |
if (!(A)) \
|
84 |
{ \
|
|
85 |
my_parse_error(ER(ER_SYNTAX_ERROR));\
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
86 |
DRIZZLE_YYABORT; \
|
1
by brian
clean slate |
87 |
}
|
88 |
||
89 |
/*
|
|
90 |
Work around for broken code generated by bison 1.875.
|
|
91 |
||
92 |
The code generated by bison 1.875a and later, bison 2.1 and bison 2.2 is ok.
|
|
93 |
With bison 1.875 however, the generated code contains:
|
|
94 |
<pre>
|
|
95 |
yyerrlab1:
|
|
96 |
#if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
|
|
97 |
__attribute__ ((__unused__))
|
|
98 |
#endif
|
|
99 |
</pre>
|
|
100 |
This usage of __attribute__ is illegal, so we remove it.
|
|
101 |
See the following references for details:
|
|
102 |
http://lists.gnu.org/archive/html/bug-bison/2004-02/msg00014.html
|
|
103 |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14273
|
|
104 |
*/
|
|
105 |
||
106 |
#if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
|
|
107 |
#undef __attribute__
|
|
108 |
#define __attribute__(X)
|
|
109 |
#endif
|
|
110 |
||
111 |
#define YYDEBUG 0
|
|
112 |
||
113 |
/**
|
|
114 |
@brief Push an error message into MySQL error stack with line
|
|
115 |
and position information.
|
|
116 |
||
117 |
This function provides semantic action implementers with a way
|
|
118 |
to push the famous "You have a syntax error near..." error
|
|
119 |
message into the error stack, which is normally produced only if
|
|
120 |
a parse error is discovered internally by the Bison generated
|
|
121 |
parser.
|
|
122 |
*/
|
|
123 |
||
124 |
void my_parse_error(const char *s)
|
|
125 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
126 |
Session *session= current_session;
|
127 |
Lex_input_stream *lip= session->m_lip;
|
|
1
by brian
clean slate |
128 |
|
129 |
const char *yytext= lip->get_tok_start();
|
|
130 |
/* Push an error into the error stack */
|
|
131 |
my_printf_error(ER_PARSE_ERROR, ER(ER_PARSE_ERROR), MYF(0), s,
|
|
132 |
(yytext ? yytext : ""),
|
|
133 |
lip->yylineno);
|
|
134 |
}
|
|
135 |
||
136 |
/**
|
|
137 |
@brief Bison callback to report a syntax/OOM error
|
|
138 |
||
139 |
This function is invoked by the bison-generated parser
|
|
140 |
when a syntax error, a parse error or an out-of-memory
|
|
141 |
condition occurs. This function is not invoked when the
|
|
142 |
parser is requested to abort by semantic action code
|
|
143 |
by means of YYABORT or YYACCEPT macros. This is why these
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
144 |
macros should not be used (use DRIZZLE_YYABORT/DRIZZLE_YYACCEPT
|
1
by brian
clean slate |
145 |
instead).
|
146 |
||
147 |
The parser will abort immediately after invoking this callback.
|
|
148 |
||
149 |
This function is not for use in semantic actions and is internal to
|
|
150 |
the parser, as it performs some pre-return cleanup.
|
|
151 |
In semantic actions, please use my_parse_error or my_error to
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
152 |
push an error into the error stack and DRIZZLE_YYABORT
|
1
by brian
clean slate |
153 |
to abort from the parser.
|
154 |
*/
|
|
155 |
||
520.4.50
by Monty Taylor
Finish changing the bison namespace argument from MYSQL to DRIZZLE |
156 |
void DRIZZLEerror(const char *s)
|
1
by brian
clean slate |
157 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
158 |
Session *session= current_session;
|
1
by brian
clean slate |
159 |
|
160 |
/*
|
|
161 |
Restore the original LEX if it was replaced when parsing
|
|
162 |
a stored procedure. We must ensure that a parsing error
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
163 |
does not leave any side effects in the Session.
|
1
by brian
clean slate |
164 |
*/
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
165 |
LEX::cleanup_lex_after_parse_error(session);
|
1
by brian
clean slate |
166 |
|
167 |
/* "parse error" changed into "syntax error" between bison 1.75 and 1.875 */
|
|
168 |
if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0)
|
|
169 |
s= ER(ER_SYNTAX_ERROR);
|
|
170 |
my_parse_error(s);
|
|
171 |
}
|
|
172 |
||
173 |
/**
|
|
174 |
Helper to resolve the SQL:2003 Syntax exception 1) in <in predicate>.
|
|
175 |
See SQL:2003, Part 2, section 8.4 <in predicate>, Note 184, page 383.
|
|
176 |
This function returns the proper item for the SQL expression
|
|
177 |
<code>left [NOT] IN ( expr )</code>
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
178 |
@param session the current thread
|
1
by brian
clean slate |
179 |
@param left the in predicand
|
180 |
@param equal true for IN predicates, false for NOT IN predicates
|
|
181 |
@param expr first and only expression of the in value list
|
|
182 |
@return an expression representing the IN predicate.
|
|
183 |
*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
184 |
Item* handle_sql2003_note184_exception(Session *session, Item* left, bool equal,
|
1
by brian
clean slate |
185 |
Item *expr)
|
186 |
{
|
|
187 |
/*
|
|
188 |
Relevant references for this issue:
|
|
189 |
- SQL:2003, Part 2, section 8.4 <in predicate>, page 383,
|
|
190 |
- SQL:2003, Part 2, section 7.2 <row value expression>, page 296,
|
|
191 |
- SQL:2003, Part 2, section 6.3 <value expression primary>, page 174,
|
|
192 |
- SQL:2003, Part 2, section 7.15 <subquery>, page 370,
|
|
193 |
- SQL:2003 Feature F561, "Full value expressions".
|
|
194 |
||
195 |
The exception in SQL:2003 Note 184 means:
|
|
196 |
Item_singlerow_subselect, which corresponds to a <scalar subquery>,
|
|
197 |
should be re-interpreted as an Item_in_subselect, which corresponds
|
|
198 |
to a <table subquery> when used inside an <in predicate>.
|
|
199 |
||
200 |
Our reading of Note 184 is reccursive, so that all:
|
|
201 |
- IN (( <subquery> ))
|
|
202 |
- IN ((( <subquery> )))
|
|
203 |
- IN '('^N <subquery> ')'^N
|
|
204 |
- etc
|
|
205 |
should be interpreted as a <table subquery>, no matter how deep in the
|
|
206 |
expression the <subquery> is.
|
|
207 |
*/
|
|
208 |
||
209 |
Item *result;
|
|
210 |
||
211 |
if (expr->type() == Item::SUBSELECT_ITEM)
|
|
212 |
{
|
|
213 |
Item_subselect *expr2 = (Item_subselect*) expr;
|
|
214 |
||
215 |
if (expr2->substype() == Item_subselect::SINGLEROW_SUBS)
|
|
216 |
{
|
|
217 |
Item_singlerow_subselect *expr3 = (Item_singlerow_subselect*) expr2;
|
|
218 |
st_select_lex *subselect;
|
|
219 |
||
220 |
/*
|
|
221 |
Implement the mandated change, by altering the semantic tree:
|
|
222 |
left IN Item_singlerow_subselect(subselect)
|
|
223 |
is modified to
|
|
224 |
left IN (subselect)
|
|
225 |
which is represented as
|
|
226 |
Item_in_subselect(left, subselect)
|
|
227 |
*/
|
|
228 |
subselect= expr3->invalidate_and_restore_select_lex();
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
229 |
result= new (session->mem_root) Item_in_subselect(left, subselect);
|
1
by brian
clean slate |
230 |
|
231 |
if (! equal)
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
232 |
result = negate_expression(session, result);
|
1
by brian
clean slate |
233 |
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
234 |
return(result);
|
1
by brian
clean slate |
235 |
}
|
236 |
}
|
|
237 |
||
238 |
if (equal)
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
239 |
result= new (session->mem_root) Item_func_eq(left, expr);
|
1
by brian
clean slate |
240 |
else
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
241 |
result= new (session->mem_root) Item_func_ne(left, expr);
|
1
by brian
clean slate |
242 |
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
243 |
return(result);
|
1
by brian
clean slate |
244 |
}
|
245 |
||
246 |
/**
|
|
247 |
@brief Creates a new SELECT_LEX for a UNION branch.
|
|
248 |
||
249 |
Sets up and initializes a SELECT_LEX structure for a query once the parser
|
|
250 |
discovers a UNION token. The current SELECT_LEX is pushed on the stack and
|
|
251 |
the new SELECT_LEX becomes the current one..=
|
|
252 |
||
253 |
@lex The parser state.
|
|
254 |
||
255 |
@is_union_distinct True if the union preceding the new select statement
|
|
256 |
uses UNION DISTINCT.
|
|
257 |
||
258 |
@return <code>false</code> if successful, <code>true</code> if an error was
|
|
259 |
reported. In the latter case parsing should stop.
|
|
260 |
*/
|
|
261 |
bool add_select_to_union_list(LEX *lex, bool is_union_distinct)
|
|
262 |
{
|
|
263 |
if (lex->result)
|
|
264 |
{
|
|
265 |
/* Only the last SELECT can have INTO...... */
|
|
266 |
my_error(ER_WRONG_USAGE, MYF(0), "UNION", "INTO");
|
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
267 |
return true;
|
1
by brian
clean slate |
268 |
}
|
269 |
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
|
|
270 |
{
|
|
271 |
my_parse_error(ER(ER_SYNTAX_ERROR));
|
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
272 |
return true;
|
1
by brian
clean slate |
273 |
}
|
274 |
/* This counter shouldn't be incremented for UNION parts */
|
|
275 |
lex->nest_level--;
|
|
276 |
if (mysql_new_select(lex, 0))
|
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
277 |
return true;
|
1
by brian
clean slate |
278 |
mysql_init_select(lex);
|
279 |
lex->current_select->linkage=UNION_TYPE;
|
|
280 |
if (is_union_distinct) /* UNION DISTINCT - remember position */
|
|
281 |
lex->current_select->master_unit()->union_distinct=
|
|
282 |
lex->current_select;
|
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
283 |
return false;
|
1
by brian
clean slate |
284 |
}
|
285 |
||
286 |
/**
|
|
287 |
@brief Initializes a SELECT_LEX for a query within parentheses (aka
|
|
288 |
braces).
|
|
289 |
||
290 |
@return false if successful, true if an error was reported. In the latter
|
|
291 |
case parsing should stop.
|
|
292 |
*/
|
|
293 |
bool setup_select_in_parentheses(LEX *lex)
|
|
294 |
{
|
|
295 |
SELECT_LEX * sel= lex->current_select;
|
|
296 |
if (sel->set_braces(1))
|
|
297 |
{
|
|
298 |
my_parse_error(ER(ER_SYNTAX_ERROR));
|
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
299 |
return true;
|
1
by brian
clean slate |
300 |
}
|
301 |
if (sel->linkage == UNION_TYPE &&
|
|
302 |
!sel->master_unit()->first_select()->braces &&
|
|
303 |
sel->master_unit()->first_select()->linkage ==
|
|
304 |
UNION_TYPE)
|
|
305 |
{
|
|
306 |
my_parse_error(ER(ER_SYNTAX_ERROR));
|
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
307 |
return true;
|
1
by brian
clean slate |
308 |
}
|
309 |
if (sel->linkage == UNION_TYPE &&
|
|
310 |
sel->olap != UNSPECIFIED_OLAP_TYPE &&
|
|
311 |
sel->master_unit()->fake_select_lex)
|
|
312 |
{
|
|
313 |
my_error(ER_WRONG_USAGE, MYF(0), "CUBE/ROLLUP", "ORDER BY");
|
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
314 |
return true;
|
1
by brian
clean slate |
315 |
}
|
316 |
/* select in braces, can't contain global parameters */
|
|
317 |
if (sel->master_unit()->fake_select_lex)
|
|
318 |
sel->master_unit()->global_parameters=
|
|
319 |
sel->master_unit()->fake_select_lex;
|
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
320 |
return false;
|
1
by brian
clean slate |
321 |
}
|
322 |
||
323 |
%}
|
|
324 |
%union {
|
|
325 |
int num; |
|
326 |
ulong ulong_num; |
|
151
by Brian Aker
Ulonglong to uint64_t |
327 |
uint64_t ulonglong_number; |
154
by Brian Aker
Removed oddball types in my_global.h |
328 |
int64_t longlong_number; |
1
by brian
clean slate |
329 |
LEX_STRING lex_str; |
330 |
LEX_STRING *lex_str_ptr; |
|
331 |
LEX_SYMBOL symbol; |
|
332 |
Table_ident *table; |
|
333 |
char *simple_string; |
|
334 |
Item *item; |
|
335 |
Item_num *item_num; |
|
336 |
List<Item> *item_list; |
|
337 |
List<String> *string_list; |
|
338 |
String *string; |
|
339 |
Key_part_spec *key_part; |
|
327.2.5
by Brian Aker
Refactoring show command |
340 |
TableList *table_list; |
1
by brian
clean slate |
341 |
udf_func *udf; |
342 |
LEX_USER *lex_user; |
|
343 |
struct sys_var_with_base variable; |
|
344 |
enum enum_var_type var_type; |
|
345 |
Key::Keytype key_type; |
|
346 |
enum ha_key_alg key_alg; |
|
347 |
handlerton *db_type; |
|
348 |
enum row_type row_type; |
|
349 |
enum column_format_type column_format_type; |
|
350 |
enum ha_rkey_function ha_rkey_mode; |
|
351 |
enum enum_tx_isolation tx_isolation; |
|
352 |
enum Cast_target cast_type; |
|
353 |
enum ha_choice choice; |
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
354 |
const CHARSET_INFO *charset; |
1
by brian
clean slate |
355 |
thr_lock_type lock_type; |
356 |
struct st_table_lock_info table_lock_info; |
|
357 |
interval_type interval, interval_time_st; |
|
398.1.3
by Monty Taylor
Fixed one more enum enum_drizzle_timestamp_type timestamp_type; |
358 |
enum enum_drizzle_timestamp_type date_time_type; |
1
by brian
clean slate |
359 |
st_select_lex *select_lex; |
360 |
chooser_compare_func_creator boolfunc2creator; |
|
361 |
struct sp_cond_type *spcondtype; |
|
362 |
struct { int vars, conds, hndlrs, curs; } spblock; |
|
363 |
struct st_lex *lex; |
|
364 |
struct p_elem_val *p_elem_value; |
|
365 |
enum index_hint_type index_hint; |
|
366 |
enum enum_filetype filetype; |
|
367 |
enum ha_build_method build_method; |
|
368 |
enum Foreign_key::fk_option m_fk_option; |
|
369 |
}
|
|
370 |
||
371 |
%{
|
|
372 |
bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
|
|
373 |
%}
|
|
374 |
||
375 |
%pure_parser /* We have threads */
|
|
376 |
/*
|
|
383.1.23
by Brian Aker
Parser scrapping for UTF-8 |
377 |
Currently there are 93 shift/reduce conflicts. |
1
by brian
clean slate |
378 |
We should not introduce new conflicts any more. |
379 |
*/
|
|
383.1.23
by Brian Aker
Parser scrapping for UTF-8 |
380 |
%expect 93
|
1
by brian
clean slate |
381 |
|
382 |
/*
|
|
383 |
Comments for TOKENS. |
|
384 |
For each token, please include in the same line a comment that contains |
|
385 |
the following tags: |
|
386 |
SQL-2003-R : Reserved keyword as per SQL-2003 |
|
387 |
SQL-2003-N : Non Reserved keyword as per SQL-2003 |
|
388 |
SQL-1999-R : Reserved keyword as per SQL-1999 |
|
389 |
SQL-1999-N : Non Reserved keyword as per SQL-1999 |
|
390 |
MYSQL : MySQL extention (unspecified) |
|
391 |
MYSQL-FUNC : MySQL extention, function |
|
392 |
INTERNAL : Not a real token, lex optimization |
|
393 |
OPERATOR : SQL operator |
|
394 |
FUTURE-USE : Reserved for futur use |
|
395 |
||
396 |
This makes the code grep-able, and helps maintenance. |
|
397 |
*/
|
|
398 |
||
399 |
%token ABORT_SYM /* INTERNAL (used in lex) */
|
|
400 |
%token ACCESSIBLE_SYM
|
|
401 |
%token ACTION /* SQL-2003-N */
|
|
402 |
%token ADD /* SQL-2003-R */
|
|
403 |
%token ADDDATE_SYM /* MYSQL-FUNC */
|
|
404 |
%token AFTER_SYM /* SQL-2003-N */
|
|
405 |
%token AGGREGATE_SYM
|
|
406 |
%token ALGORITHM_SYM
|
|
407 |
%token ALL /* SQL-2003-R */
|
|
408 |
%token ALTER /* SQL-2003-R */
|
|
409 |
%token ANALYZE_SYM
|
|
410 |
%token AND_SYM /* SQL-2003-R */
|
|
411 |
%token ANY_SYM /* SQL-2003-R */
|
|
412 |
%token AS /* SQL-2003-R */
|
|
413 |
%token ASC /* SQL-2003-N */
|
|
414 |
%token ASCII_SYM /* MYSQL-FUNC */
|
|
415 |
%token ASENSITIVE_SYM /* FUTURE-USE */
|
|
416 |
%token AT_SYM /* SQL-2003-R */
|
|
417 |
%token AUTHORS_SYM
|
|
418 |
%token AUTOEXTEND_SIZE_SYM
|
|
419 |
%token AUTO_INC
|
|
420 |
%token AVG_ROW_LENGTH
|
|
421 |
%token AVG_SYM /* SQL-2003-N */
|
|
422 |
%token BEFORE_SYM /* SQL-2003-N */
|
|
423 |
%token BEGIN_SYM /* SQL-2003-R */
|
|
424 |
%token BETWEEN_SYM /* SQL-2003-R */
|
|
425 |
%token BIGINT /* SQL-2003-R */
|
|
426 |
%token BINARY /* SQL-2003-R */
|
|
427 |
%token BINLOG_SYM
|
|
428 |
%token BIN_NUM
|
|
429 |
%token BIT_SYM /* MYSQL-FUNC */
|
|
430 |
%token BLOB_SYM /* SQL-2003-R */
|
|
244.1.1
by Harrison Fisk
Port Ebay/Google memory storage engine variable width columns. |
431 |
%token BLOCK_SIZE_SYM
|
1
by brian
clean slate |
432 |
%token BLOCK_SYM
|
433 |
%token BOOLEAN_SYM /* SQL-2003-R */
|
|
434 |
%token BOOL_SYM
|
|
435 |
%token BOTH /* SQL-2003-R */
|
|
436 |
%token BTREE_SYM
|
|
437 |
%token BY /* SQL-2003-R */
|
|
438 |
%token BYTE_SYM
|
|
439 |
%token CACHE_SYM
|
|
440 |
%token CALL_SYM /* SQL-2003-R */
|
|
441 |
%token CASCADE /* SQL-2003-N */
|
|
442 |
%token CASCADED /* SQL-2003-R */
|
|
443 |
%token CASE_SYM /* SQL-2003-R */
|
|
444 |
%token CAST_SYM /* SQL-2003-R */
|
|
445 |
%token CHAIN_SYM /* SQL-2003-N */
|
|
446 |
%token CHANGE
|
|
447 |
%token CHANGED
|
|
448 |
%token CHARSET
|
|
449 |
%token CHAR_SYM /* SQL-2003-R */
|
|
450 |
%token CHECKSUM_SYM
|
|
451 |
%token CHECK_SYM /* SQL-2003-R */
|
|
452 |
%token CLOSE_SYM /* SQL-2003-R */
|
|
453 |
%token COALESCE /* SQL-2003-N */
|
|
454 |
%token COLLATE_SYM /* SQL-2003-R */
|
|
455 |
%token COLLATION_SYM /* SQL-2003-N */
|
|
456 |
%token COLUMNS
|
|
457 |
%token COLUMN_SYM /* SQL-2003-R */
|
|
458 |
%token COMMENT_SYM
|
|
459 |
%token COMMITTED_SYM /* SQL-2003-N */
|
|
460 |
%token COMMIT_SYM /* SQL-2003-R */
|
|
461 |
%token COMPACT_SYM
|
|
462 |
%token COMPLETION_SYM
|
|
463 |
%token COMPRESSED_SYM
|
|
464 |
%token CONCURRENT
|
|
465 |
%token CONDITION_SYM /* SQL-2003-N */
|
|
466 |
%token CONNECTION_SYM
|
|
467 |
%token CONSISTENT_SYM
|
|
468 |
%token CONSTRAINT /* SQL-2003-R */
|
|
469 |
%token CONTAINS_SYM /* SQL-2003-N */
|
|
470 |
%token CONTEXT_SYM
|
|
471 |
%token CONTINUE_SYM /* SQL-2003-R */
|
|
472 |
%token CONVERT_SYM /* SQL-2003-N */
|
|
473 |
%token COUNT_SYM /* SQL-2003-N */
|
|
474 |
%token CREATE /* SQL-2003-R */
|
|
475 |
%token CROSS /* SQL-2003-R */
|
|
476 |
%token CUBE_SYM /* SQL-2003-R */
|
|
477 |
%token CURDATE /* MYSQL-FUNC */
|
|
478 |
%token CURRENT_USER /* SQL-2003-R */
|
|
479 |
%token CURSOR_SYM /* SQL-2003-R */
|
|
480 |
%token CURTIME /* MYSQL-FUNC */
|
|
481 |
%token DATABASE
|
|
482 |
%token DATABASES
|
|
483 |
%token DATAFILE_SYM
|
|
484 |
%token DATA_SYM /* SQL-2003-N */
|
|
485 |
%token DATETIME
|
|
486 |
%token DATE_ADD_INTERVAL /* MYSQL-FUNC */
|
|
487 |
%token DATE_SUB_INTERVAL /* MYSQL-FUNC */
|
|
488 |
%token DATE_SYM /* SQL-2003-R */
|
|
489 |
%token DAY_HOUR_SYM
|
|
490 |
%token DAY_MICROSECOND_SYM
|
|
491 |
%token DAY_MINUTE_SYM
|
|
492 |
%token DAY_SECOND_SYM
|
|
493 |
%token DAY_SYM /* SQL-2003-R */
|
|
494 |
%token DEALLOCATE_SYM /* SQL-2003-R */
|
|
495 |
%token DECIMAL_NUM
|
|
496 |
%token DECIMAL_SYM /* SQL-2003-R */
|
|
497 |
%token DECLARE_SYM /* SQL-2003-R */
|
|
498 |
%token DEFAULT /* SQL-2003-R */
|
|
499 |
%token DELAYED_SYM
|
|
500 |
%token DELAY_KEY_WRITE_SYM
|
|
501 |
%token DELETE_SYM /* SQL-2003-R */
|
|
502 |
%token DESC /* SQL-2003-N */
|
|
503 |
%token DESCRIBE /* SQL-2003-R */
|
|
504 |
%token DETERMINISTIC_SYM /* SQL-2003-R */
|
|
505 |
%token DIRECTORY_SYM
|
|
506 |
%token DISABLE_SYM
|
|
507 |
%token DISCARD
|
|
508 |
%token DISTINCT /* SQL-2003-R */
|
|
509 |
%token DIV_SYM
|
|
510 |
%token DOUBLE_SYM /* SQL-2003-R */
|
|
511 |
%token DROP /* SQL-2003-R */
|
|
512 |
%token DUMPFILE
|
|
513 |
%token DUPLICATE_SYM
|
|
514 |
%token DYNAMIC_SYM /* SQL-2003-R */
|
|
515 |
%token EACH_SYM /* SQL-2003-R */
|
|
516 |
%token ELSE /* SQL-2003-R */
|
|
517 |
%token ELSEIF_SYM
|
|
518 |
%token ENABLE_SYM
|
|
519 |
%token ENCLOSED
|
|
520 |
%token END /* SQL-2003-R */
|
|
521 |
%token ENDS_SYM
|
|
522 |
%token END_OF_INPUT /* INTERNAL */
|
|
523 |
%token ENGINE_SYM
|
|
524 |
%token ENUM
|
|
525 |
%token EQ /* OPERATOR */
|
|
526 |
%token EQUAL_SYM /* OPERATOR */
|
|
527 |
%token ERRORS
|
|
528 |
%token ESCAPED
|
|
529 |
%token ESCAPE_SYM /* SQL-2003-R */
|
|
530 |
%token EXCLUSIVE_SYM
|
|
531 |
%token EXISTS /* SQL-2003-R */
|
|
532 |
%token EXIT_SYM
|
|
533 |
%token EXTENDED_SYM
|
|
534 |
%token EXTENT_SIZE_SYM
|
|
535 |
%token EXTRACT_SYM /* SQL-2003-N */
|
|
536 |
%token FALSE_SYM /* SQL-2003-R */
|
|
537 |
%token FAST_SYM
|
|
538 |
%token FAULTS_SYM
|
|
539 |
%token FETCH_SYM /* SQL-2003-R */
|
|
540 |
%token COLUMN_FORMAT_SYM
|
|
541 |
%token FILE_SYM
|
|
542 |
%token FIRST_SYM /* SQL-2003-N */
|
|
543 |
%token FIXED_SYM
|
|
544 |
%token FLOAT_NUM
|
|
545 |
%token FLUSH_SYM
|
|
546 |
%token FORCE_SYM
|
|
547 |
%token FOREIGN /* SQL-2003-R */
|
|
548 |
%token FOR_SYM /* SQL-2003-R */
|
|
549 |
%token FOUND_SYM /* SQL-2003-R */
|
|
550 |
%token FRAC_SECOND_SYM
|
|
551 |
%token FROM
|
|
552 |
%token FULL /* SQL-2003-R */
|
|
553 |
%token GE
|
|
554 |
%token GET_FORMAT /* MYSQL-FUNC */
|
|
555 |
%token GLOBAL_SYM /* SQL-2003-R */
|
|
556 |
%token GROUP_SYM /* SQL-2003-R */
|
|
557 |
%token GROUP_CONCAT_SYM
|
|
558 |
%token GT_SYM /* OPERATOR */
|
|
559 |
%token HANDLER_SYM
|
|
560 |
%token HASH_SYM
|
|
561 |
%token HAVING /* SQL-2003-R */
|
|
562 |
%token HEX_NUM
|
|
563 |
%token HIGH_PRIORITY
|
|
564 |
%token HOST_SYM
|
|
565 |
%token HOSTS_SYM
|
|
566 |
%token HOUR_MICROSECOND_SYM
|
|
567 |
%token HOUR_MINUTE_SYM
|
|
568 |
%token HOUR_SECOND_SYM
|
|
569 |
%token HOUR_SYM /* SQL-2003-R */
|
|
570 |
%token IDENT
|
|
571 |
%token IDENTIFIED_SYM
|
|
572 |
%token IDENT_QUOTED
|
|
573 |
%token IF
|
|
574 |
%token IGNORE_SYM
|
|
575 |
%token IMPORT
|
|
576 |
%token INDEXES
|
|
577 |
%token INDEX_SYM
|
|
578 |
%token INFILE
|
|
579 |
%token INITIAL_SIZE_SYM
|
|
580 |
%token INNER_SYM /* SQL-2003-R */
|
|
581 |
%token INOUT_SYM /* SQL-2003-R */
|
|
582 |
%token INSENSITIVE_SYM /* SQL-2003-R */
|
|
583 |
%token INSERT /* SQL-2003-R */
|
|
584 |
%token INSERT_METHOD
|
|
585 |
%token INSTALL_SYM
|
|
586 |
%token INTERVAL_SYM /* SQL-2003-R */
|
|
587 |
%token INTO /* SQL-2003-R */
|
|
588 |
%token INT_SYM /* SQL-2003-R */
|
|
589 |
%token IN_SYM /* SQL-2003-R */
|
|
590 |
%token IS /* SQL-2003-R */
|
|
591 |
%token ISOLATION /* SQL-2003-R */
|
|
592 |
%token ITERATE_SYM
|
|
593 |
%token JOIN_SYM /* SQL-2003-R */
|
|
594 |
%token KEYS
|
|
595 |
%token KEY_BLOCK_SIZE
|
|
596 |
%token KEY_SYM /* SQL-2003-N */
|
|
597 |
%token KILL_SYM
|
|
598 |
%token LAST_SYM /* SQL-2003-N */
|
|
599 |
%token LE /* OPERATOR */
|
|
600 |
%token LEADING /* SQL-2003-R */
|
|
601 |
%token LEAVES
|
|
602 |
%token LEFT /* SQL-2003-R */
|
|
603 |
%token LEVEL_SYM
|
|
604 |
%token LEX_HOSTNAME
|
|
605 |
%token LIKE /* SQL-2003-R */
|
|
606 |
%token LIMIT
|
|
607 |
%token LINEAR_SYM
|
|
608 |
%token LINES
|
|
609 |
%token LINESTRING
|
|
610 |
%token LIST_SYM
|
|
611 |
%token LOAD
|
|
612 |
%token LOCAL_SYM /* SQL-2003-R */
|
|
613 |
%token LOCATOR_SYM /* SQL-2003-N */
|
|
614 |
%token LOCKS_SYM
|
|
615 |
%token LOCK_SYM
|
|
616 |
%token LOGFILE_SYM
|
|
617 |
%token LOGS_SYM
|
|
618 |
%token LONG_NUM
|
|
619 |
%token LONG_SYM
|
|
620 |
%token LOOP_SYM
|
|
621 |
%token LOW_PRIORITY
|
|
622 |
%token LT /* OPERATOR */
|
|
623 |
%token MASTER_CONNECT_RETRY_SYM
|
|
624 |
%token MASTER_HOST_SYM
|
|
625 |
%token MASTER_LOG_FILE_SYM
|
|
626 |
%token MASTER_LOG_POS_SYM
|
|
627 |
%token MASTER_PASSWORD_SYM
|
|
628 |
%token MASTER_PORT_SYM
|
|
629 |
%token MASTER_SERVER_ID_SYM
|
|
630 |
%token MASTER_SYM
|
|
631 |
%token MASTER_USER_SYM
|
|
632 |
%token MASTER_HEARTBEAT_PERIOD_SYM
|
|
633 |
%token MATCH /* SQL-2003-R */
|
|
634 |
%token MAX_CONNECTIONS_PER_HOUR
|
|
635 |
%token MAX_QUERIES_PER_HOUR
|
|
636 |
%token MAX_ROWS
|
|
637 |
%token MAX_SIZE_SYM
|
|
638 |
%token MAX_SYM /* SQL-2003-N */
|
|
639 |
%token MAX_UPDATES_PER_HOUR
|
|
640 |
%token MAX_USER_CONNECTIONS_SYM
|
|
641 |
%token MAX_VALUE_SYM /* SQL-2003-N */
|
|
642 |
%token MEDIUM_SYM
|
|
643 |
%token MERGE_SYM /* SQL-2003-R */
|
|
644 |
%token MICROSECOND_SYM /* MYSQL-FUNC */
|
|
645 |
%token MIGRATE_SYM
|
|
646 |
%token MINUTE_MICROSECOND_SYM
|
|
647 |
%token MINUTE_SECOND_SYM
|
|
648 |
%token MINUTE_SYM /* SQL-2003-R */
|
|
649 |
%token MIN_ROWS
|
|
650 |
%token MIN_SYM /* SQL-2003-N */
|
|
651 |
%token MODE_SYM
|
|
652 |
%token MODIFIES_SYM /* SQL-2003-R */
|
|
653 |
%token MODIFY_SYM
|
|
654 |
%token MOD_SYM /* SQL-2003-N */
|
|
655 |
%token MONTH_SYM /* SQL-2003-R */
|
|
656 |
%token NAMES_SYM /* SQL-2003-N */
|
|
657 |
%token NAME_SYM /* SQL-2003-N */
|
|
658 |
%token NATIONAL_SYM /* SQL-2003-R */
|
|
659 |
%token NATURAL /* SQL-2003-R */
|
|
660 |
%token NE /* OPERATOR */
|
|
661 |
%token NEG
|
|
662 |
%token NEW_SYM /* SQL-2003-R */
|
|
663 |
%token NEXT_SYM /* SQL-2003-N */
|
|
664 |
%token NODEGROUP_SYM
|
|
665 |
%token NONE_SYM /* SQL-2003-R */
|
|
666 |
%token NOT_SYM /* SQL-2003-R */
|
|
667 |
%token NOW_SYM
|
|
668 |
%token NOWAIT_SYM
|
|
669 |
%token NO_SYM /* SQL-2003-R */
|
|
670 |
%token NO_WAIT_SYM
|
|
671 |
%token NO_WRITE_TO_BINLOG
|
|
672 |
%token NULL_SYM /* SQL-2003-R */
|
|
673 |
%token NUM
|
|
674 |
%token NUMERIC_SYM /* SQL-2003-R */
|
|
675 |
%token OFFLINE_SYM
|
|
676 |
%token OFFSET_SYM
|
|
677 |
%token ON /* SQL-2003-R */
|
|
678 |
%token ONE_SHOT_SYM
|
|
679 |
%token ONE_SYM
|
|
680 |
%token ONLINE_SYM
|
|
681 |
%token OPEN_SYM /* SQL-2003-R */
|
|
682 |
%token OPTIMIZE
|
|
683 |
%token OPTIONS_SYM
|
|
684 |
%token OPTION /* SQL-2003-N */
|
|
685 |
%token OPTIONALLY
|
|
686 |
%token ORDER_SYM /* SQL-2003-R */
|
|
687 |
%token OR_SYM /* SQL-2003-R */
|
|
688 |
%token OUTER
|
|
689 |
%token OUTFILE
|
|
690 |
%token OUT_SYM /* SQL-2003-R */
|
|
691 |
%token PACK_KEYS_SYM
|
|
692 |
%token PAGE_SYM
|
|
693 |
%token PAGE_CHECKSUM_SYM
|
|
694 |
%token PARAM_MARKER
|
|
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
695 |
%token PARSE_VCOL_EXPR_SYM
|
1
by brian
clean slate |
696 |
%token PARTIAL /* SQL-2003-N */
|
697 |
%token PHASE_SYM
|
|
698 |
%token PLUGINS_SYM
|
|
699 |
%token PLUGIN_SYM
|
|
700 |
%token POINT_SYM
|
|
701 |
%token PORT_SYM
|
|
702 |
%token POSITION_SYM /* SQL-2003-N */
|
|
703 |
%token PRECISION /* SQL-2003-R */
|
|
704 |
%token PREV_SYM
|
|
705 |
%token PRIMARY_SYM /* SQL-2003-R */
|
|
706 |
%token PROCESS
|
|
707 |
%token PROCESSLIST_SYM
|
|
708 |
%token PURGE
|
|
709 |
%token QUARTER_SYM
|
|
710 |
%token QUERY_SYM
|
|
711 |
%token QUICK
|
|
712 |
%token RANGE_SYM /* SQL-2003-R */
|
|
713 |
%token READS_SYM /* SQL-2003-R */
|
|
714 |
%token READ_ONLY_SYM
|
|
715 |
%token READ_SYM /* SQL-2003-N */
|
|
716 |
%token READ_WRITE_SYM
|
|
717 |
%token REAL /* SQL-2003-R */
|
|
718 |
%token REBUILD_SYM
|
|
719 |
%token RECOVER_SYM
|
|
720 |
%token REDOFILE_SYM
|
|
721 |
%token REDO_BUFFER_SIZE_SYM
|
|
722 |
%token REDUNDANT_SYM
|
|
723 |
%token REFERENCES /* SQL-2003-R */
|
|
724 |
%token RELAY_LOG_FILE_SYM
|
|
725 |
%token RELAY_LOG_POS_SYM
|
|
726 |
%token RELAY_THREAD
|
|
727 |
%token RELEASE_SYM /* SQL-2003-R */
|
|
728 |
%token RELOAD
|
|
729 |
%token REMOVE_SYM
|
|
730 |
%token RENAME
|
|
731 |
%token REORGANIZE_SYM
|
|
732 |
%token REPAIR
|
|
733 |
%token REPEATABLE_SYM /* SQL-2003-N */
|
|
734 |
%token REPEAT_SYM /* MYSQL-FUNC */
|
|
735 |
%token REPLACE /* MYSQL-FUNC */
|
|
736 |
%token REPLICATION
|
|
737 |
%token REQUIRE_SYM
|
|
738 |
%token RESET_SYM
|
|
739 |
%token RESOURCES
|
|
740 |
%token RESTRICT
|
|
741 |
%token RESUME_SYM
|
|
742 |
%token RETURNS_SYM /* SQL-2003-R */
|
|
743 |
%token RETURN_SYM /* SQL-2003-R */
|
|
744 |
%token REVERSE_SYM
|
|
745 |
%token REVOKE /* SQL-2003-R */
|
|
746 |
%token RIGHT /* SQL-2003-R */
|
|
747 |
%token ROLLBACK_SYM /* SQL-2003-R */
|
|
748 |
%token ROLLUP_SYM /* SQL-2003-R */
|
|
749 |
%token ROUTINE_SYM /* SQL-2003-N */
|
|
750 |
%token ROWS_SYM /* SQL-2003-R */
|
|
751 |
%token ROW_FORMAT_SYM
|
|
752 |
%token ROW_SYM /* SQL-2003-R */
|
|
753 |
%token SAVEPOINT_SYM /* SQL-2003-R */
|
|
754 |
%token SECOND_MICROSECOND_SYM
|
|
755 |
%token SECOND_SYM /* SQL-2003-R */
|
|
756 |
%token SECURITY_SYM /* SQL-2003-N */
|
|
757 |
%token SELECT_SYM /* SQL-2003-R */
|
|
758 |
%token SENSITIVE_SYM /* FUTURE-USE */
|
|
759 |
%token SEPARATOR_SYM
|
|
760 |
%token SERIALIZABLE_SYM /* SQL-2003-N */
|
|
761 |
%token SERIAL_SYM
|
|
762 |
%token SESSION_SYM /* SQL-2003-N */
|
|
763 |
%token SERVER_SYM
|
|
764 |
%token SERVER_OPTIONS
|
|
765 |
%token SET /* SQL-2003-R */
|
|
766 |
%token SET_VAR
|
|
767 |
%token SHARE_SYM
|
|
768 |
%token SHOW
|
|
769 |
%token SHUTDOWN
|
|
770 |
%token SIMPLE_SYM /* SQL-2003-N */
|
|
771 |
%token SLAVE
|
|
772 |
%token SNAPSHOT_SYM
|
|
773 |
%token SOCKET_SYM
|
|
774 |
%token SONAME_SYM
|
|
775 |
%token SOURCE_SYM
|
|
776 |
%token SPECIFIC_SYM /* SQL-2003-R */
|
|
777 |
%token SQLEXCEPTION_SYM /* SQL-2003-R */
|
|
778 |
%token SQLSTATE_SYM /* SQL-2003-R */
|
|
779 |
%token SQLWARNING_SYM /* SQL-2003-R */
|
|
780 |
%token SQL_BIG_RESULT
|
|
781 |
%token SQL_BUFFER_RESULT
|
|
782 |
%token SQL_CALC_FOUND_ROWS
|
|
783 |
%token SQL_SMALL_RESULT
|
|
784 |
%token SQL_SYM /* SQL-2003-R */
|
|
785 |
%token SQL_THREAD
|
|
786 |
%token STARTING
|
|
787 |
%token STARTS_SYM
|
|
788 |
%token START_SYM /* SQL-2003-R */
|
|
789 |
%token STATUS_SYM
|
|
790 |
%token STDDEV_SAMP_SYM /* SQL-2003-N */
|
|
791 |
%token STD_SYM
|
|
792 |
%token STOP_SYM
|
|
793 |
%token STORAGE_SYM
|
|
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
794 |
%token STORED_SYM
|
1
by brian
clean slate |
795 |
%token STRAIGHT_JOIN
|
796 |
%token STRING_SYM
|
|
797 |
%token SUBDATE_SYM
|
|
798 |
%token SUBJECT_SYM
|
|
799 |
%token SUBSTRING /* SQL-2003-N */
|
|
800 |
%token SUM_SYM /* SQL-2003-N */
|
|
801 |
%token SUPER_SYM
|
|
802 |
%token SUSPEND_SYM
|
|
803 |
%token SWAPS_SYM
|
|
804 |
%token SWITCHES_SYM
|
|
805 |
%token SYSDATE
|
|
806 |
%token TABLES
|
|
108
by Brian Aker
Removed unwanted ALTER TABLESPACE, left in valuable bits. |
807 |
%token TABLESPACE
|
1
by brian
clean slate |
808 |
%token TABLE_REF_PRIORITY
|
809 |
%token TABLE_SYM /* SQL-2003-R */
|
|
810 |
%token TABLE_CHECKSUM_SYM
|
|
811 |
%token TEMPORARY /* SQL-2003-N */
|
|
812 |
%token TEMPTABLE_SYM
|
|
813 |
%token TERMINATED
|
|
814 |
%token TEXT_STRING
|
|
815 |
%token TEXT_SYM
|
|
816 |
%token THAN_SYM
|
|
817 |
%token THEN_SYM /* SQL-2003-R */
|
|
818 |
%token TIMESTAMP /* SQL-2003-R */
|
|
819 |
%token TIMESTAMP_ADD
|
|
820 |
%token TIMESTAMP_DIFF
|
|
821 |
%token TIME_SYM /* SQL-2003-R */
|
|
822 |
%token TO_SYM /* SQL-2003-R */
|
|
823 |
%token TRAILING /* SQL-2003-R */
|
|
824 |
%token TRANSACTION_SYM
|
|
825 |
%token TRANSACTIONAL_SYM
|
|
826 |
%token TRIM /* SQL-2003-N */
|
|
827 |
%token TRUE_SYM /* SQL-2003-R */
|
|
828 |
%token TRUNCATE_SYM
|
|
829 |
%token TYPES_SYM
|
|
830 |
%token TYPE_SYM /* SQL-2003-N */
|
|
831 |
%token ULONGLONG_NUM
|
|
832 |
%token UNCOMMITTED_SYM /* SQL-2003-N */
|
|
833 |
%token UNDEFINED_SYM
|
|
834 |
%token UNDERSCORE_CHARSET
|
|
835 |
%token UNDOFILE_SYM
|
|
836 |
%token UNDO_SYM /* FUTURE-USE */
|
|
837 |
%token UNION_SYM /* SQL-2003-R */
|
|
838 |
%token UNIQUE_SYM
|
|
839 |
%token UNKNOWN_SYM /* SQL-2003-R */
|
|
840 |
%token UNLOCK_SYM
|
|
841 |
%token UNTIL_SYM
|
|
842 |
%token UPDATE_SYM /* SQL-2003-R */
|
|
843 |
%token UPGRADE_SYM
|
|
844 |
%token USAGE /* SQL-2003-N */
|
|
845 |
%token USER /* SQL-2003-R */
|
|
846 |
%token USE_FRM
|
|
847 |
%token USE_SYM
|
|
848 |
%token USING /* SQL-2003-R */
|
|
849 |
%token UTC_DATE_SYM
|
|
850 |
%token UTC_TIMESTAMP_SYM
|
|
851 |
%token UTC_TIME_SYM
|
|
852 |
%token VALUES /* SQL-2003-R */
|
|
853 |
%token VALUE_SYM /* SQL-2003-R */
|
|
854 |
%token VARBINARY
|
|
855 |
%token VARCHAR /* SQL-2003-R */
|
|
856 |
%token VARIABLES
|
|
857 |
%token VARIANCE_SYM
|
|
858 |
%token VARYING /* SQL-2003-R */
|
|
859 |
%token VAR_SAMP_SYM
|
|
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
860 |
%token VIRTUAL_SYM
|
1
by brian
clean slate |
861 |
%token WAIT_SYM
|
862 |
%token WARNINGS
|
|
863 |
%token WEEK_SYM
|
|
864 |
%token WEIGHT_STRING_SYM
|
|
865 |
%token WHEN_SYM /* SQL-2003-R */
|
|
866 |
%token WHERE /* SQL-2003-R */
|
|
867 |
%token WITH /* SQL-2003-R */
|
|
868 |
%token WITH_ROLLUP_SYM /* INTERNAL */
|
|
869 |
%token WORK_SYM /* SQL-2003-N */
|
|
870 |
%token WRITE_SYM /* SQL-2003-N */
|
|
871 |
%token XOR
|
|
872 |
%token YEAR_MONTH_SYM
|
|
873 |
%token YEAR_SYM /* SQL-2003-R */
|
|
874 |
||
875 |
%left JOIN_SYM INNER_SYM STRAIGHT_JOIN CROSS LEFT RIGHT
|
|
876 |
/* A dummy token to force the priority of table_ref production in a join. */ |
|
877 |
%left TABLE_REF_PRIORITY
|
|
878 |
%left SET_VAR
|
|
879 |
%left OR_SYM
|
|
880 |
%left XOR
|
|
256
by Brian Aker
Remove BIT operations, replace with functions. |
881 |
%left AND_SYM
|
1
by brian
clean slate |
882 |
%left BETWEEN_SYM CASE_SYM WHEN_SYM THEN_SYM ELSE
|
883 |
%left EQ EQUAL_SYM GE GT_SYM LE LT NE IS LIKE IN_SYM
|
|
884 |
%left '-' '+'
|
|
885 |
%left '*' '/' '%' DIV_SYM MOD_SYM
|
|
256
by Brian Aker
Remove BIT operations, replace with functions. |
886 |
%left NEG
|
1
by brian
clean slate |
887 |
%right NOT_SYM
|
888 |
%right BINARY COLLATE_SYM
|
|
889 |
%left INTERVAL_SYM
|
|
890 |
||
891 |
%type <lex_str>
|
|
892 |
IDENT IDENT_QUOTED TEXT_STRING DECIMAL_NUM FLOAT_NUM NUM LONG_NUM HEX_NUM |
|
893 |
LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident ident_or_text |
|
894 |
IDENT_sys TEXT_STRING_sys TEXT_STRING_literal |
|
235
by Brian Aker
Final bit of NCHAR removed. |
895 |
opt_component key_cache_name |
1
by brian
clean slate |
896 |
BIN_NUM TEXT_STRING_filesystem ident_or_empty |
897 |
opt_constraint constraint opt_ident |
|
898 |
||
899 |
%type <lex_str_ptr>
|
|
900 |
opt_table_alias
|
|
901 |
||
902 |
%type <table> |
|
903 |
table_ident references |
|
904 |
||
905 |
%type <simple_string>
|
|
906 |
remember_name remember_end opt_db |
|
907 |
||
908 |
%type <string>
|
|
909 |
text_string opt_gconcat_separator |
|
910 |
||
911 |
%type <num>
|
|
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
912 |
type int_type real_type order_dir field_def |
1
by brian
clean slate |
913 |
if_exists opt_local opt_table_options table_options |
383.1.26
by Brian Aker
Removed option for single command replication and have now left disable of |
914 |
table_option opt_if_not_exists |
1
by brian
clean slate |
915 |
opt_temporary all_or_any opt_distinct |
59
by Brian Aker
Removed preload from parser. |
916 |
union_option
|
1
by brian
clean slate |
917 |
start_transaction_opts opt_chain opt_release |
918 |
union_opt select_derived_init option_type2 |
|
919 |
opt_transactional_lock_timeout
|
|
920 |
/* opt_lock_timeout_value */ |
|
921 |
||
922 |
%type <m_fk_option>
|
|
923 |
delete_option
|
|
924 |
||
925 |
%type <ulong_num> |
|
926 |
ulong_num real_ulong_num |
|
927 |
ws_nweights
|
|
928 |
ws_level_flag_desc ws_level_flag_reverse ws_level_flags |
|
929 |
opt_ws_levels ws_level_list ws_level_list_item ws_level_number |
|
930 |
ws_level_range ws_level_list_or_range |
|
931 |
||
932 |
%type <ulonglong_number>
|
|
933 |
ulonglong_num
|
|
934 |
||
935 |
%type <choice> choice |
|
936 |
||
937 |
%type <lock_type>
|
|
938 |
replace_lock_option opt_low_priority insert_lock_option load_data_lock |
|
939 |
transactional_lock_mode
|
|
940 |
||
941 |
%type <table_lock_info> |
|
942 |
table_lock_info
|
|
943 |
||
944 |
%type <item> |
|
945 |
literal text_literal insert_ident order_ident |
|
946 |
simple_ident expr opt_expr opt_else sum_expr in_sum_expr |
|
947 |
variable variable_aux bool_pri |
|
948 |
predicate bit_expr |
|
949 |
table_wild simple_expr udf_expr |
|
950 |
expr_or_default set_expr_or_default |
|
951 |
signed_literal now_or_signed_literal opt_escape |
|
952 |
simple_ident_nospvar simple_ident_q |
|
953 |
field_or_var limit_option |
|
954 |
function_call_keyword
|
|
955 |
function_call_nonkeyword
|
|
956 |
function_call_generic
|
|
957 |
function_call_conflict
|
|
958 |
||
959 |
%type <item_num>
|
|
960 |
NUM_literal
|
|
961 |
||
962 |
%type <item_list> |
|
963 |
expr_list opt_udf_expr_list udf_expr_list when_list |
|
964 |
||
965 |
%type <var_type>
|
|
966 |
option_type opt_var_type opt_var_ident_type |
|
967 |
||
968 |
%type <key_type>
|
|
969 |
key_type opt_unique constraint_key_type |
|
970 |
||
971 |
%type <key_alg>
|
|
972 |
btree_or_rtree
|
|
973 |
||
974 |
%type <string_list> |
|
975 |
using_list
|
|
976 |
||
977 |
%type <key_part> |
|
978 |
key_part
|
|
979 |
||
980 |
%type <table_list> |
|
981 |
join_table_list join_table |
|
982 |
table_factor table_ref esc_table_ref |
|
983 |
select_derived derived_table_list |
|
984 |
select_derived_union
|
|
985 |
||
986 |
%type <date_time_type> date_time_type; |
|
987 |
%type <interval> interval
|
|
988 |
||
989 |
%type <interval_time_st> interval_time_st
|
|
990 |
||
991 |
%type <interval_time_st> interval_time_stamp
|
|
992 |
||
993 |
%type <db_type> storage_engines known_storage_engines
|
|
994 |
||
995 |
%type <row_type> row_types
|
|
996 |
||
997 |
%type <column_format_type> column_format_types
|
|
998 |
||
999 |
%type <tx_isolation> isolation_types
|
|
1000 |
||
1001 |
%type <cast_type> cast_type
|
|
1002 |
||
1003 |
%type <symbol> keyword keyword_sp
|
|
1004 |
||
1005 |
%type <charset>
|
|
1006 |
collation_name
|
|
1007 |
collation_name_or_default
|
|
1008 |
UNDERSCORE_CHARSET
|
|
1009 |
||
1010 |
%type <variable> internal_variable_name |
|
1011 |
||
1012 |
%type <select_lex> subselect
|
|
1013 |
get_select_lex query_specification |
|
1014 |
query_expression_body
|
|
1015 |
||
1016 |
%type <boolfunc2creator> comp_op |
|
1017 |
||
1018 |
%type <build_method> build_method
|
|
1019 |
||
1020 |
%type <NONE>
|
|
1021 |
query verb_clause create change select drop insert replace insert2 |
|
1022 |
insert_values update delete truncate rename |
|
59
by Brian Aker
Removed preload from parser. |
1023 |
show describe load alter optimize keycache flush |
1
by brian
clean slate |
1024 |
reset purge begin commit rollback savepoint release |
1025 |
slave master_def master_defs master_file_def slave_until_opts |
|
1026 |
repair analyze check start checksum |
|
1027 |
field_list field_list_item field_spec kill column_def key_def |
|
59
by Brian Aker
Removed preload from parser. |
1028 |
keycache_list assign_to_keycache |
1
by brian
clean slate |
1029 |
select_item_list select_item values_list no_braces |
1030 |
opt_limit_clause delete_limit_clause fields opt_values values |
|
184
by Brian Aker
Dead debug code removal (and a compatible "never used") bit in the |
1031 |
opt_precision opt_ignore opt_column |
413.2.2
by Brian Aker
Removed UNSIGNED from parser. |
1032 |
set lock unlock string_list |
1033 |
opt_binary table_lock_list table_lock |
|
1
by brian
clean slate |
1034 |
ref_list opt_match_clause opt_on_update_delete use |
234
by Brian Aker
More National gone. |
1035 |
opt_delete_options opt_delete_option varchar |
1
by brian
clean slate |
1036 |
opt_outer table_list table_name table_alias_ref_list table_alias_ref |
1037 |
opt_option opt_place |
|
1038 |
opt_attribute opt_attribute_list attribute |
|
1039 |
flush_options flush_option |
|
1040 |
equal optional_braces |
|
1041 |
opt_mi_check_type opt_to mi_check_types normal_join |
|
1042 |
table_to_table_list table_to_table opt_table_list opt_as |
|
1043 |
single_multi table_wild_list table_wild_one opt_wild |
|
1044 |
union_clause union_list |
|
520.1.1
by Brian Aker
Removed dead variables/dead parser piece. |
1045 |
precision subselect_start |
1
by brian
clean slate |
1046 |
subselect_end select_var_list select_var_list_init opt_len |
1047 |
opt_extended_describe
|
|
1048 |
statement
|
|
1049 |
opt_field_or_var_spec fields_or_vars opt_load_data_set_spec |
|
1050 |
binlog_base64_event
|
|
1051 |
init_key_options key_options key_opts key_opt key_using_alg |
|
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
1052 |
parse_vcol_expr vcol_opt_attribute vcol_opt_attribute_list |
1053 |
vcol_attribute
|
|
1
by brian
clean slate |
1054 |
END_OF_INPUT
|
1055 |
||
1056 |
%type <index_hint> index_hint_type
|
|
1057 |
%type <num> index_hint_clause
|
|
266.1.23
by Monty Taylor
Removed load xml infile. Hope nobody liked it. Now the only thing we need xml.c |
1058 |
%type <filetype> data_file
|
1
by brian
clean slate |
1059 |
|
1060 |
%type <NONE>
|
|
1061 |
'-' '+' '*' '/' '%' '(' ')' |
|
256
by Brian Aker
Remove BIT operations, replace with functions. |
1062 |
',' '!' '{' '}' AND_SYM OR_SYM BETWEEN_SYM CASE_SYM |
1063 |
THEN_SYM WHEN_SYM DIV_SYM MOD_SYM DELETE_SYM |
|
1
by brian
clean slate |
1064 |
%%
|
1065 |
||
1066 |
/*
|
|
1067 |
Indentation of grammar rules: |
|
1068 |
||
1069 |
rule: <-- starts at col 1 |
|
1070 |
rule1a rule1b rule1c <-- starts at col 11 |
|
1071 |
{ <-- starts at col 11 |
|
1072 |
code <-- starts at col 13, indentation is 2 spaces |
|
1073 |
}
|
|
1074 |
| rule2a rule2b |
|
1075 |
{
|
|
1076 |
code
|
|
1077 |
}
|
|
1078 |
; <-- on a line by itself, starts at col 9 |
|
1079 |
||
1080 |
Also, please do not use any <TAB>, but spaces. |
|
1081 |
Having a uniform indentation in this file helps |
|
1082 |
code reviews, patches, merges, and make maintenance easier. |
|
1083 |
Tip: grep [[:cntrl:]] sql_yacc.yy |
|
1084 |
Thanks. |
|
1085 |
*/
|
|
1086 |
||
1087 |
query: |
|
1088 |
END_OF_INPUT
|
|
1089 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1090 |
Session *session= YYSession; |
1091 |
if (!(session->lex->select_lex.options & OPTION_FOUND_COMMENT)) |
|
1
by brian
clean slate |
1092 |
{
|
1093 |
my_message(ER_EMPTY_QUERY, ER(ER_EMPTY_QUERY), MYF(0)); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
1094 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
1095 |
}
|
1096 |
else
|
|
1097 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1098 |
session->lex->sql_command= SQLCOM_EMPTY_QUERY; |
1
by brian
clean slate |
1099 |
}
|
1100 |
}
|
|
1101 |
| verb_clause END_OF_INPUT {} |
|
1102 |
;
|
|
1103 |
||
1104 |
verb_clause: |
|
1105 |
statement
|
|
1106 |
| begin |
|
1107 |
;
|
|
1108 |
||
1109 |
/* Verb clauses, except begin */ |
|
1110 |
statement: |
|
1111 |
alter
|
|
1112 |
| analyze |
|
1113 |
| binlog_base64_event |
|
1114 |
| change |
|
1115 |
| check |
|
1116 |
| checksum |
|
1117 |
| commit |
|
1118 |
| create |
|
1119 |
| delete |
|
1120 |
| describe |
|
1121 |
| drop |
|
1122 |
| flush |
|
1123 |
| insert |
|
1124 |
| kill |
|
1125 |
| load |
|
1126 |
| lock |
|
1127 |
| optimize |
|
1128 |
| keycache |
|
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
1129 |
| parse_vcol_expr |
1
by brian
clean slate |
1130 |
| purge |
1131 |
| release |
|
1132 |
| rename |
|
1133 |
| repair |
|
1134 |
| replace |
|
1135 |
| reset |
|
1136 |
| rollback |
|
1137 |
| savepoint |
|
1138 |
| select |
|
1139 |
| set |
|
1140 |
| show |
|
1141 |
| slave |
|
1142 |
| start |
|
1143 |
| truncate |
|
1144 |
| unlock |
|
1145 |
| update |
|
1146 |
| use |
|
1147 |
;
|
|
1148 |
||
1149 |
||
1150 |
/* change master */ |
|
1151 |
||
1152 |
change: |
|
1153 |
CHANGE MASTER_SYM TO_SYM |
|
1154 |
{
|
|
1155 |
LEX *lex = Lex; |
|
1156 |
lex->sql_command = SQLCOM_CHANGE_MASTER; |
|
212.6.6
by Mats Kindahl
Removing redundant use of casts in drizzled/ for memcmp(), memcpy(), memset(), and memmove(). |
1157 |
memset(&lex->mi, 0, sizeof(lex->mi)); |
1
by brian
clean slate |
1158 |
}
|
1159 |
master_defs
|
|
1160 |
{}
|
|
1161 |
;
|
|
1162 |
||
1163 |
master_defs: |
|
1164 |
master_def
|
|
1165 |
| master_defs ',' master_def |
|
1166 |
;
|
|
1167 |
||
1168 |
master_def: |
|
1169 |
MASTER_HOST_SYM EQ TEXT_STRING_sys |
|
1170 |
{
|
|
1171 |
Lex->mi.host = $3.str; |
|
1172 |
}
|
|
1173 |
| MASTER_USER_SYM EQ TEXT_STRING_sys |
|
1174 |
{
|
|
1175 |
Lex->mi.user = $3.str; |
|
1176 |
}
|
|
1177 |
| MASTER_PASSWORD_SYM EQ TEXT_STRING_sys |
|
1178 |
{
|
|
1179 |
Lex->mi.password = $3.str; |
|
1180 |
}
|
|
1181 |
| MASTER_PORT_SYM EQ ulong_num |
|
1182 |
{
|
|
1183 |
Lex->mi.port = $3; |
|
1184 |
}
|
|
1185 |
| MASTER_CONNECT_RETRY_SYM EQ ulong_num |
|
1186 |
{
|
|
1187 |
Lex->mi.connect_retry = $3; |
|
1188 |
}
|
|
1189 |
| MASTER_HEARTBEAT_PERIOD_SYM EQ NUM_literal |
|
1190 |
{
|
|
1191 |
Lex->mi.heartbeat_period= (float) $3->val_real(); |
|
1192 |
if (Lex->mi.heartbeat_period > SLAVE_MAX_HEARTBEAT_PERIOD || |
|
1193 |
Lex->mi.heartbeat_period < 0.0) |
|
1194 |
{
|
|
1195 |
char buf[sizeof(SLAVE_MAX_HEARTBEAT_PERIOD*4)]; |
|
171.1.1
by Patrick Galbraith
Dar, I forgot to commit this earlier. |
1196 |
sprintf(buf, "%d seconds", SLAVE_MAX_HEARTBEAT_PERIOD); |
1
by brian
clean slate |
1197 |
my_error(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE, |
1198 |
MYF(0), |
|
1199 |
" is negative or exceeds the maximum ", |
|
1200 |
buf); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
1201 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
1202 |
}
|
1203 |
if (Lex->mi.heartbeat_period > slave_net_timeout) |
|
1204 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1205 |
push_warning_printf(YYSession, DRIZZLE_ERROR::WARN_LEVEL_WARN, |
1
by brian
clean slate |
1206 |
ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE, |
1207 |
ER(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE), |
|
1208 |
" exceeds the value of `slave_net_timeout' sec.", |
|
1209 |
" A sensible value for the period should be"
|
|
1210 |
" less than the timeout."); |
|
1211 |
}
|
|
1212 |
if (Lex->mi.heartbeat_period < 0.001) |
|
1213 |
{
|
|
1214 |
if (Lex->mi.heartbeat_period != 0.0) |
|
1215 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1216 |
push_warning_printf(YYSession, DRIZZLE_ERROR::WARN_LEVEL_WARN, |
1
by brian
clean slate |
1217 |
ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE, |
1218 |
ER(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE), |
|
1219 |
" is less than 1 msec.", |
|
1220 |
" The period is reset to zero which means"
|
|
1221 |
" no heartbeats will be sending"); |
|
1222 |
Lex->mi.heartbeat_period= 0.0; |
|
1223 |
}
|
|
1224 |
Lex->mi.heartbeat_opt= LEX_MASTER_INFO::LEX_MI_DISABLE; |
|
1225 |
}
|
|
1226 |
Lex->mi.heartbeat_opt= LEX_MASTER_INFO::LEX_MI_ENABLE; |
|
1227 |
}
|
|
1228 |
|
|
|
1229 |
master_file_def
|
|
1230 |
;
|
|
1231 |
||
1232 |
master_file_def: |
|
1233 |
MASTER_LOG_FILE_SYM EQ TEXT_STRING_sys |
|
1234 |
{
|
|
1235 |
Lex->mi.log_file_name = $3.str; |
|
1236 |
}
|
|
1237 |
| MASTER_LOG_POS_SYM EQ ulonglong_num |
|
1238 |
{
|
|
1239 |
Lex->mi.pos = $3; |
|
1240 |
/*
|
|
1241 |
If the user specified a value < BIN_LOG_HEADER_SIZE, adjust it |
|
1242 |
instead of causing subsequent errors. |
|
1243 |
We need to do it in this file, because only there we know that |
|
1244 |
MASTER_LOG_POS has been explicitely specified. On the contrary |
|
1245 |
in change_master() (sql_repl.cc) we cannot distinguish between 0 |
|
1246 |
(MASTER_LOG_POS explicitely specified as 0) and 0 (unspecified), |
|
1247 |
whereas we want to distinguish (specified 0 means "read the binlog |
|
1248 |
from 0" (4 in fact), unspecified means "don't change the position |
|
1249 |
(keep the preceding value)").
|
|
1250 |
*/
|
|
398.1.4
by Monty Taylor
Renamed max/min. |
1251 |
Lex->mi.pos = cmax((uint64_t)BIN_LOG_HEADER_SIZE, Lex->mi.pos);
|
1
by brian
clean slate |
1252 |
}
|
1253 |
| RELAY_LOG_FILE_SYM EQ TEXT_STRING_sys
|
|
1254 |
{
|
|
1255 |
Lex->mi.relay_log_name = $3.str;
|
|
1256 |
}
|
|
1257 |
| RELAY_LOG_POS_SYM EQ ulong_num
|
|
1258 |
{
|
|
1259 |
Lex->mi.relay_log_pos = $3;
|
|
1260 |
/* Adjust if < BIN_LOG_HEADER_SIZE (same comment as Lex->mi.pos) */
|
|
398.1.4
by Monty Taylor
Renamed max/min. |
1261 |
Lex->mi.relay_log_pos = cmax((uint32_t)BIN_LOG_HEADER_SIZE, Lex->mi.relay_log_pos);
|
1
by brian
clean slate |
1262 |
}
|
1263 |
;
|
|
1264 |
||
1265 |
/* create a table */
|
|
1266 |
||
1267 |
create:
|
|
1268 |
CREATE opt_table_options TABLE_SYM opt_if_not_exists table_ident
|
|
1269 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1270 |
Session *session= YYSession;
|
1271 |
LEX *lex= session->lex;
|
|
1
by brian
clean slate |
1272 |
lex->sql_command= SQLCOM_CREATE_TABLE;
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1273 |
if (!lex->select_lex.add_table_to_list(session, $5, NULL,
|
1
by brian
clean slate |
1274 |
TL_OPTION_UPDATING,
|
1275 |
TL_WRITE))
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
1276 |
DRIZZLE_YYABORT;
|
1
by brian
clean slate |
1277 |
lex->alter_info.reset();
|
1278 |
lex->col_list.empty();
|
|
461
by Monty Taylor
Removed NullS. bu-bye. |
1279 |
lex->change=NULL;
|
212.6.6
by Mats Kindahl
Removing redundant use of casts in drizzled/ for memcmp(), memcpy(), memset(), and memmove(). |
1280 |
memset(&lex->create_info, 0, sizeof(lex->create_info));
|
1
by brian
clean slate |
1281 |
lex->create_info.options=$2 | $4;
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1282 |
lex->create_info.db_type= ha_default_handlerton(session);
|
1
by brian
clean slate |
1283 |
lex->create_info.default_table_charset= NULL;
|
1284 |
lex->name.str= 0;
|
|
1285 |
lex->name.length= 0;
|
|
1286 |
}
|
|
1287 |
create2
|
|
1288 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1289 |
LEX *lex= YYSession->lex;
|
1
by brian
clean slate |
1290 |
lex->current_select= &lex->select_lex;
|
1291 |
if (!lex->create_info.db_type)
|
|
1292 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1293 |
lex->create_info.db_type= ha_default_handlerton(YYSession);
|
1294 |
push_warning_printf(YYSession, DRIZZLE_ERROR::WARN_LEVEL_WARN,
|
|
1
by brian
clean slate |
1295 |
ER_WARN_USING_OTHER_HANDLER,
|
1296 |
ER(ER_WARN_USING_OTHER_HANDLER),
|
|
1297 |
ha_resolve_storage_engine_name(lex->create_info.db_type),
|
|
1298 |
$5->table.str);
|
|
1299 |
}
|
|
1300 |
}
|
|
1301 |
| CREATE build_method opt_unique INDEX_SYM ident key_alg
|
|
1302 |
ON table_ident
|
|
1303 |
{
|
|
1304 |
LEX *lex=Lex;
|
|
1305 |
lex->sql_command= SQLCOM_CREATE_INDEX;
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1306 |
if (!lex->current_select->add_table_to_list(lex->session, $8,
|
1
by brian
clean slate |
1307 |
NULL,
|
1308 |
TL_OPTION_UPDATING))
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
1309 |
DRIZZLE_YYABORT;
|
1
by brian
clean slate |
1310 |
lex->alter_info.reset();
|
1311 |
lex->alter_info.flags= ALTER_ADD_INDEX;
|
|
1312 |
lex->alter_info.build_method= $2;
|
|
1313 |
lex->col_list.empty();
|
|
461
by Monty Taylor
Removed NullS. bu-bye. |
1314 |
lex->change=NULL;
|
1
by brian
clean slate |
1315 |
}
|
1316 |
'(' key_list ')' key_options
|
|
1317 |
{
|
|
1318 |
LEX *lex=Lex;
|
|
1319 |
Key *key;
|
|
1320 |
key= new Key($3, $5, &lex->key_create_info, 0,
|
|
1321 |
lex->col_list);
|
|
1322 |
lex->alter_info.key_list.push_back(key);
|
|
1323 |
lex->col_list.empty();
|
|
1324 |
}
|
|
1325 |
| CREATE DATABASE opt_if_not_exists ident
|
|
1326 |
{
|
|
1327 |
Lex->create_info.default_table_charset= NULL;
|
|
1328 |
Lex->create_info.used_fields= 0;
|
|
1329 |
}
|
|
1330 |
opt_create_database_options
|
|
1331 |
{
|
|
1332 |
LEX *lex=Lex;
|
|
1333 |
lex->sql_command=SQLCOM_CREATE_DB;
|
|
1334 |
lex->name= $4;
|
|
1335 |
lex->create_info.options=$3;
|
|
1336 |
}
|
|
1337 |
;
|
|
1338 |
||
1339 |
create2:
|
|
1340 |
'(' create2a {}
|
|
1341 |
| opt_create_table_options
|
|
1342 |
create3 {}
|
|
1343 |
| LIKE table_ident
|
|
1344 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1345 |
Session *session= YYSession;
|
1346 |
LEX *lex= session->lex;
|
|
1
by brian
clean slate |
1347 |
|
1348 |
lex->create_info.options|= HA_LEX_CREATE_TABLE_LIKE;
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1349 |
if (!lex->select_lex.add_table_to_list(session, $2, NULL, 0, TL_READ))
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
1350 |
DRIZZLE_YYABORT;
|
1
by brian
clean slate |
1351 |
}
|
1352 |
| '(' LIKE table_ident ')'
|
|
1353 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1354 |
Session *session= YYSession;
|
1355 |
LEX *lex= session->lex;
|
|
1
by brian
clean slate |
1356 |
|
1357 |
lex->create_info.options|= HA_LEX_CREATE_TABLE_LIKE;
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1358 |
if (!lex->select_lex.add_table_to_list(session, $3, NULL, 0, TL_READ))
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
1359 |
DRIZZLE_YYABORT;
|
1
by brian
clean slate |
1360 |
}
|
1361 |
;
|
|
1362 |
||
1363 |
create2a:
|
|
1364 |
field_list ')' opt_create_table_options
|
|
1365 |
create3 {}
|
|
1366 |
| create_select ')'
|
|
1367 |
{ Select->set_braces(1);}
|
|
1368 |
union_opt {}
|
|
1369 |
;
|
|
1370 |
||
1371 |
create3:
|
|
1372 |
/* empty */ {}
|
|
1373 |
| opt_duplicate opt_as create_select
|
|
1374 |
{ Select->set_braces(0);}
|
|
1375 |
union_clause {}
|
|
1376 |
| opt_duplicate opt_as '(' create_select ')'
|
|
1377 |
{ Select->set_braces(1);}
|
|
1378 |
union_opt {}
|
|
1379 |
;
|
|
1380 |
||
1381 |
create_select:
|
|
1382 |
SELECT_SYM
|
|
1383 |
{
|
|
1384 |
LEX *lex=Lex;
|
|
604
by Brian Aker
Remove lock condition needed (we do row based replication, so... lock is |
1385 |
lex->lock_option= TL_READ;
|
1
by brian
clean slate |
1386 |
if (lex->sql_command == SQLCOM_INSERT)
|
1387 |
lex->sql_command= SQLCOM_INSERT_SELECT;
|
|
1388 |
else if (lex->sql_command == SQLCOM_REPLACE)
|
|
1389 |
lex->sql_command= SQLCOM_REPLACE_SELECT;
|
|
1390 |
/*
|
|
1391 |
The following work only with the local list, the global list
|
|
1392 |
is created correctly in this case
|
|
1393 |
*/
|
|
1394 |
lex->current_select->table_list.save_and_clear(&lex->save_list);
|
|
1395 |
mysql_init_select(lex);
|
|
1396 |
lex->current_select->parsing_place= SELECT_LIST;
|
|
1397 |
}
|
|
1398 |
select_options select_item_list
|
|
1399 |
{
|
|
1400 |
Select->parsing_place= NO_MATTER;
|
|
1401 |
}
|
|
1402 |
opt_select_from
|
|
1403 |
{
|
|
1404 |
/*
|
|
1405 |
The following work only with the local list, the global list
|
|
1406 |
is created correctly in this case
|
|
1407 |
*/
|
|
1408 |
Lex->current_select->table_list.push_front(&Lex->save_list);
|
|
1409 |
}
|
|
1410 |
;
|
|
1411 |
||
1412 |
opt_as:
|
|
1413 |
/* empty */ {}
|
|
1414 |
| AS {}
|
|
1415 |
;
|
|
1416 |
||
1417 |
opt_create_database_options:
|
|
1418 |
/* empty */ {}
|
|
1419 |
| create_database_options {}
|
|
1420 |
;
|
|
1421 |
||
1422 |
create_database_options:
|
|
1423 |
create_database_option {}
|
|
1424 |
| create_database_options create_database_option {}
|
|
1425 |
;
|
|
1426 |
||
1427 |
create_database_option:
|
|
1428 |
default_collation {}
|
|
1429 |
;
|
|
1430 |
||
1431 |
opt_table_options:
|
|
1432 |
/* empty */ { $$= 0; }
|
|
1433 |
| table_options { $$= $1;}
|
|
1434 |
;
|
|
1435 |
||
1436 |
table_options:
|
|
1437 |
table_option { $$=$1; }
|
|
1438 |
| table_option table_options { $$= $1 | $2; }
|
|
1439 |
;
|
|
1440 |
||
1441 |
table_option:
|
|
1442 |
TEMPORARY { $$=HA_LEX_CREATE_TMP_TABLE; }
|
|
1443 |
;
|
|
1444 |
||
1445 |
opt_if_not_exists:
|
|
1446 |
/* empty */ { $$= 0; }
|
|
1447 |
| IF not EXISTS { $$=HA_LEX_CREATE_IF_NOT_EXISTS; }
|
|
1448 |
;
|
|
1449 |
||
1450 |
opt_create_table_options:
|
|
1451 |
/* empty */
|
|
1452 |
| create_table_options
|
|
1453 |
;
|
|
1454 |
||
1455 |
create_table_options_space_separated:
|
|
1456 |
create_table_option
|
|
1457 |
| create_table_option create_table_options_space_separated
|
|
1458 |
;
|
|
1459 |
||
1460 |
create_table_options:
|
|
1461 |
create_table_option
|
|
1462 |
| create_table_option create_table_options
|
|
1463 |
| create_table_option ',' create_table_options
|
|
1464 |
;
|
|
1465 |
||
1466 |
create_table_option:
|
|
1467 |
ENGINE_SYM opt_equal storage_engines
|
|
1468 |
{
|
|
1469 |
Lex->create_info.db_type= $3;
|
|
1470 |
Lex->create_info.used_fields|= HA_CREATE_USED_ENGINE;
|
|
1471 |
}
|
|
1472 |
| MAX_ROWS opt_equal ulonglong_num
|
|
1473 |
{
|
|
1474 |
Lex->create_info.max_rows= $3;
|
|
1475 |
Lex->create_info.used_fields|= HA_CREATE_USED_MAX_ROWS;
|
|
1476 |
}
|
|
1477 |
| MIN_ROWS opt_equal ulonglong_num
|
|
1478 |
{
|
|
1479 |
Lex->create_info.min_rows= $3;
|
|
1480 |
Lex->create_info.used_fields|= HA_CREATE_USED_MIN_ROWS;
|
|
1481 |
}
|
|
1482 |
| AVG_ROW_LENGTH opt_equal ulong_num
|
|
1483 |
{
|
|
1484 |
Lex->create_info.avg_row_length=$3;
|
|
1485 |
Lex->create_info.used_fields|= HA_CREATE_USED_AVG_ROW_LENGTH;
|
|
1486 |
}
|
|
244.1.1
by Harrison Fisk
Port Ebay/Google memory storage engine variable width columns. |
1487 |
| BLOCK_SIZE_SYM opt_equal ulong_num
|
1488 |
{
|
|
1489 |
Lex->create_info.block_size= $3;
|
|
1490 |
Lex->create_info.used_fields|= HA_CREATE_USED_BLOCK_SIZE;
|
|
1491 |
}
|
|
1
by brian
clean slate |
1492 |
| COMMENT_SYM opt_equal TEXT_STRING_sys
|
1493 |
{
|
|
1494 |
Lex->create_info.comment=$3;
|
|
1495 |
Lex->create_info.used_fields|= HA_CREATE_USED_COMMENT;
|
|
1496 |
}
|
|
1497 |
| AUTO_INC opt_equal ulonglong_num
|
|
1498 |
{
|
|
1499 |
Lex->create_info.auto_increment_value=$3;
|
|
1500 |
Lex->create_info.used_fields|= HA_CREATE_USED_AUTO;
|
|
1501 |
}
|
|
1502 |
| PACK_KEYS_SYM opt_equal ulong_num
|
|
1503 |
{
|
|
1504 |
switch($3) {
|
|
1505 |
case 0:
|
|
1506 |
Lex->create_info.table_options|= HA_OPTION_NO_PACK_KEYS;
|
|
1507 |
break;
|
|
1508 |
case 1:
|
|
1509 |
Lex->create_info.table_options|= HA_OPTION_PACK_KEYS;
|
|
1510 |
break;
|
|
1511 |
default:
|
|
1512 |
my_parse_error(ER(ER_SYNTAX_ERROR));
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
1513 |
DRIZZLE_YYABORT;
|
1
by brian
clean slate |
1514 |
}
|
1515 |
Lex->create_info.used_fields|= HA_CREATE_USED_PACK_KEYS;
|
|
1516 |
}
|
|
1517 |
| PACK_KEYS_SYM opt_equal DEFAULT
|
|
1518 |
{
|
|
1519 |
Lex->create_info.table_options&=
|
|
1520 |
~(HA_OPTION_PACK_KEYS | HA_OPTION_NO_PACK_KEYS);
|
|
1521 |
Lex->create_info.used_fields|= HA_CREATE_USED_PACK_KEYS;
|
|
1522 |
}
|
|
1523 |
| CHECKSUM_SYM opt_equal ulong_num
|
|
1524 |
{
|
|
1525 |
Lex->create_info.table_options|= $3 ? HA_OPTION_CHECKSUM : HA_OPTION_NO_CHECKSUM;
|
|
1526 |
Lex->create_info.used_fields|= HA_CREATE_USED_CHECKSUM;
|
|
1527 |
}
|
|
1528 |
| TABLE_CHECKSUM_SYM opt_equal ulong_num
|
|
1529 |
{
|
|
1530 |
Lex->create_info.table_options|= $3 ? HA_OPTION_CHECKSUM : HA_OPTION_NO_CHECKSUM;
|
|
1531 |
Lex->create_info.used_fields|= HA_CREATE_USED_CHECKSUM;
|
|
1532 |
}
|
|
1533 |
| PAGE_CHECKSUM_SYM opt_equal choice
|
|
1534 |
{
|
|
1535 |
Lex->create_info.used_fields|= HA_CREATE_USED_PAGE_CHECKSUM;
|
|
1536 |
Lex->create_info.page_checksum= $3;
|
|
1537 |
}
|
|
1538 |
| DELAY_KEY_WRITE_SYM opt_equal ulong_num
|
|
1539 |
{
|
|
1540 |
Lex->create_info.table_options|= $3 ? HA_OPTION_DELAY_KEY_WRITE : HA_OPTION_NO_DELAY_KEY_WRITE;
|
|
1541 |
Lex->create_info.used_fields|= HA_CREATE_USED_DELAY_KEY_WRITE;
|
|
1542 |
}
|
|
1543 |
| ROW_FORMAT_SYM opt_equal row_types
|
|
1544 |
{
|
|
1545 |
Lex->create_info.row_type= $3;
|
|
1546 |
Lex->create_info.used_fields|= HA_CREATE_USED_ROW_FORMAT;
|
|
1547 |
Lex->alter_info.flags|= ALTER_ROW_FORMAT;
|
|
1548 |
}
|
|
1549 |
| default_collation
|
|
1550 |
| DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
|
|
1551 |
{
|
|
1552 |
Lex->create_info.data_file_name= $4.str;
|
|
1553 |
Lex->create_info.used_fields|= HA_CREATE_USED_DATADIR;
|
|
1554 |
}
|
|
1555 |
| INDEX_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
|
|
1556 |
{
|
|
1557 |
Lex->create_info.index_file_name= $4.str;
|
|
1558 |
Lex->create_info.used_fields|= HA_CREATE_USED_INDEXDIR;
|
|
1559 |
}
|
|
1560 |
| CONNECTION_SYM opt_equal TEXT_STRING_sys
|
|
1561 |
{
|
|
1562 |
Lex->create_info.connect_string.str= $3.str;
|
|
1563 |
Lex->create_info.connect_string.length= $3.length;
|
|
1564 |
Lex->create_info.used_fields|= HA_CREATE_USED_CONNECTION;
|
|
1565 |
}
|
|
1566 |
| KEY_BLOCK_SIZE opt_equal ulong_num
|
|
1567 |
{
|
|
1568 |
Lex->create_info.used_fields|= HA_CREATE_USED_KEY_BLOCK_SIZE;
|
|
1569 |
Lex->create_info.key_block_size= $3;
|
|
1570 |
}
|
|
1571 |
;
|
|
1572 |
||
1573 |
default_collation:
|
|
1574 |
opt_default COLLATE_SYM opt_equal collation_name_or_default
|
|
1575 |
{
|
|
1576 |
HA_CREATE_INFO *cinfo= &Lex->create_info;
|
|
1577 |
if ((cinfo->used_fields & HA_CREATE_USED_DEFAULT_CHARSET) &&
|
|
1578 |
cinfo->default_table_charset && $4 &&
|
|
1579 |
!my_charset_same(cinfo->default_table_charset,$4))
|
|
1580 |
{
|
|
1581 |
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
|
|
1582 |
$4->name, cinfo->default_table_charset->csname);
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
1583 |
DRIZZLE_YYABORT;
|
1
by brian
clean slate |
1584 |
}
|
1585 |
Lex->create_info.default_table_charset= $4;
|
|
1586 |
Lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
|
|
1587 |
}
|
|
1588 |
;
|
|
1589 |
||
1590 |
storage_engines:
|
|
1591 |
ident_or_text
|
|
1592 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1593 |
plugin_ref plugin= ha_resolve_by_name(YYSession, &$1);
|
1
by brian
clean slate |
1594 |
|
1595 |
if (plugin)
|
|
1596 |
$$= plugin_data(plugin, handlerton*);
|
|
1597 |
else
|
|
1598 |
{
|
|
1599 |
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str);
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
1600 |
DRIZZLE_YYABORT;
|
1
by brian
clean slate |
1601 |
}
|
1602 |
}
|
|
1603 |
;
|
|
1604 |
||
1605 |
known_storage_engines:
|
|
1606 |
ident_or_text
|
|
1607 |
{
|
|
1608 |
plugin_ref plugin;
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1609 |
if ((plugin= ha_resolve_by_name(YYSession, &$1)))
|
1
by brian
clean slate |
1610 |
$$= plugin_data(plugin, handlerton*);
|
1611 |
else
|
|
1612 |
{
|
|
1613 |
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str);
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
1614 |
DRIZZLE_YYABORT;
|
1
by brian
clean slate |
1615 |
}
|
1616 |
}
|
|
1617 |
;
|
|
1618 |
||
1619 |
column_format_types:
|
|
1620 |
DEFAULT { $$= COLUMN_FORMAT_TYPE_DEFAULT; }
|
|
1621 |
| FIXED_SYM { $$= COLUMN_FORMAT_TYPE_FIXED; }
|
|
1622 |
| DYNAMIC_SYM { $$= COLUMN_FORMAT_TYPE_DYNAMIC; };
|
|
1623 |
||
1624 |
row_types:
|
|
1625 |
DEFAULT { $$= ROW_TYPE_DEFAULT; }
|
|
1626 |
| FIXED_SYM { $$= ROW_TYPE_FIXED; }
|
|
1627 |
| DYNAMIC_SYM { $$= ROW_TYPE_DYNAMIC; }
|
|
1628 |
| COMPRESSED_SYM { $$= ROW_TYPE_COMPRESSED; }
|
|
1629 |
| REDUNDANT_SYM { $$= ROW_TYPE_REDUNDANT; }
|
|
1630 |
| COMPACT_SYM { $$= ROW_TYPE_COMPACT; }
|
|
1631 |
| PAGE_SYM { $$= ROW_TYPE_PAGE; }
|
|
1632 |
;
|
|
1633 |
||
1634 |
opt_select_from:
|
|
1635 |
opt_limit_clause {}
|
|
1636 |
| select_from select_lock_type
|
|
1637 |
;
|
|
1638 |
||
1639 |
field_list:
|
|
1640 |
field_list_item
|
|
1641 |
| field_list ',' field_list_item
|
|
1642 |
;
|
|
1643 |
||
1644 |
field_list_item:
|
|
1645 |
column_def
|
|
1646 |
| key_def
|
|
1647 |
;
|
|
1648 |
||
1649 |
column_def:
|
|
1650 |
field_spec opt_check_constraint
|
|
1651 |
| field_spec references
|
|
1652 |
{
|
|
1653 |
Lex->col_list.empty(); /* Alloced by sql_alloc */
|
|
1654 |
}
|
|
1655 |
;
|
|
1656 |
||
1657 |
key_def:
|
|
1658 |
key_type opt_ident key_alg '(' key_list ')' key_options
|
|
1659 |
{
|
|
1660 |
LEX *lex=Lex;
|
|
1661 |
Key *key= new Key($1, $2, &lex->key_create_info, 0,
|
|
1662 |
lex->col_list);
|
|
1663 |
lex->alter_info.key_list.push_back(key);
|
|
1664 |
lex->col_list.empty(); /* Alloced by sql_alloc */
|
|
1665 |
}
|
|
1666 |
| opt_constraint constraint_key_type opt_ident key_alg
|
|
1667 |
'(' key_list ')' key_options
|
|
1668 |
{
|
|
1669 |
LEX *lex=Lex;
|
|
1670 |
Key *key= new Key($2, $3.str ? $3 : $1, &lex->key_create_info, 0,
|
|
1671 |
lex->col_list);
|
|
1672 |
lex->alter_info.key_list.push_back(key);
|
|
1673 |
lex->col_list.empty(); /* Alloced by sql_alloc */
|
|
1674 |
}
|
|
1675 |
| opt_constraint FOREIGN KEY_SYM opt_ident '(' key_list ')' references
|
|
1676 |
{
|
|
1677 |
LEX *lex=Lex;
|
|
1678 |
Key *key= new Foreign_key($4.str ? $4 : $1, lex->col_list,
|
|
1679 |
$8,
|
|
1680 |
lex->ref_list,
|
|
1681 |
lex->fk_delete_opt,
|
|
1682 |
lex->fk_update_opt,
|
|
1683 |
lex->fk_match_option);
|
|
1684 |
lex->alter_info.key_list.push_back(key);
|
|
1685 |
key= new Key(Key::MULTIPLE, $1.str ? $1 : $4,
|
|
1686 |
&default_key_create_info, 1,
|
|
1687 |
lex->col_list);
|
|
1688 |
lex->alter_info.key_list.push_back(key);
|
|
1689 |
lex->col_list.empty(); /* Alloced by sql_alloc */
|
|
1690 |
/* Only used for ALTER TABLE. Ignored otherwise. */
|
|
1691 |
lex->alter_info.flags|= ALTER_FOREIGN_KEY;
|
|
1692 |
}
|
|
1693 |
| constraint opt_check_constraint
|
|
1694 |
{
|
|
1695 |
Lex->col_list.empty(); /* Alloced by sql_alloc */
|
|
1696 |
}
|
|
1697 |
| opt_constraint check_constraint
|
|
1698 |
{
|
|
1699 |
Lex->col_list.empty(); /* Alloced by sql_alloc */
|
|
1700 |
}
|
|
1701 |
;
|
|
1702 |
||
1703 |
opt_check_constraint:
|
|
1704 |
/* empty */
|
|
1705 |
| check_constraint
|
|
1706 |
;
|
|
1707 |
||
1708 |
check_constraint:
|
|
1709 |
CHECK_SYM expr
|
|
1710 |
;
|
|
1711 |
||
1712 |
opt_constraint:
|
|
1713 |
/* empty */ { $$= null_lex_str; }
|
|
1714 |
| constraint { $$= $1; }
|
|
1715 |
;
|
|
1716 |
||
1717 |
constraint:
|
|
1718 |
CONSTRAINT opt_ident { $$=$2; }
|
|
1719 |
;
|
|
1720 |
||
1721 |
field_spec:
|
|
1722 |
field_ident
|
|
1723 |
{
|
|
1724 |
LEX *lex=Lex;
|
|
1725 |
lex->length=lex->dec=0;
|
|
1726 |
lex->type=0;
|
|
1727 |
lex->default_value= lex->on_update_value= 0;
|
|
1728 |
lex->comment=null_lex_str;
|
|
1729 |
lex->charset=NULL;
|
|
1730 |
lex->column_format= COLUMN_FORMAT_TYPE_DEFAULT;
|
|
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
1731 |
lex->vcol_info= NULL;
|
1
by brian
clean slate |
1732 |
}
|
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
1733 |
field_def
|
1
by brian
clean slate |
1734 |
{
|
1735 |
LEX *lex=Lex;
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1736 |
if (add_field_to_list(lex->session, &$1, (enum enum_field_types) $3,
|
1
by brian
clean slate |
1737 |
lex->length,lex->dec,lex->type,
|
100
by Brian Aker
First pass through refactor to remove STORAGE TYPE from Yacc (and eventually |
1738 |
lex->column_format,
|
1
by brian
clean slate |
1739 |
lex->default_value, lex->on_update_value,
|
1740 |
&lex->comment,
|
|
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
1741 |
lex->change,&lex->interval_list,lex->charset,
|
1742 |
lex->vcol_info))
|
|
1743 |
DRIZZLE_YYABORT;
|
|
1744 |
}
|
|
1745 |
;
|
|
1746 |
field_def:
|
|
1747 |
type opt_attribute {}
|
|
1748 |
| VIRTUAL_SYM type AS '(' virtual_column_func ')' vcol_opt_attribute
|
|
1749 |
{
|
|
1750 |
$$=DRIZZLE_TYPE_VIRTUAL;
|
|
1751 |
Lex->vcol_info->set_field_type((enum enum_field_types) $2);
|
|
1752 |
}
|
|
1753 |
;
|
|
1754 |
||
1755 |
vcol_opt_attribute:
|
|
1756 |
/* empty */ {}
|
|
1757 |
| vcol_opt_attribute_list {}
|
|
1758 |
;
|
|
1759 |
||
1760 |
vcol_opt_attribute_list:
|
|
1761 |
vcol_opt_attribute_list vcol_attribute {}
|
|
1762 |
| vcol_attribute
|
|
1763 |
;
|
|
1764 |
||
1765 |
vcol_attribute:
|
|
1766 |
UNIQUE_SYM
|
|
1767 |
{
|
|
1768 |
LEX *lex=Lex;
|
|
1769 |
lex->type|= UNIQUE_FLAG;
|
|
1770 |
lex->alter_info.flags|= ALTER_ADD_INDEX;
|
|
1771 |
}
|
|
1772 |
| UNIQUE_SYM KEY_SYM
|
|
1773 |
{
|
|
1774 |
LEX *lex=Lex;
|
|
1775 |
lex->type|= UNIQUE_KEY_FLAG;
|
|
1776 |
lex->alter_info.flags|= ALTER_ADD_INDEX;
|
|
1777 |
}
|
|
1778 |
| COMMENT_SYM TEXT_STRING_sys { Lex->comment= $2; }
|
|
1779 |
| STORED_SYM
|
|
1780 |
{
|
|
1781 |
Lex->vcol_info->set_field_stored(true);
|
|
1782 |
}
|
|
1783 |
;
|
|
1784 |
||
1785 |
parse_vcol_expr:
|
|
1786 |
PARSE_VCOL_EXPR_SYM '(' virtual_column_func ')'
|
|
1787 |
{
|
|
1788 |
/*
|
|
1789 |
"PARSE_VCOL_EXPR" can only be used by the SQL server
|
|
1790 |
when reading a '*.frm' file. |
|
1791 |
Prevent the end user from invoking this command. |
|
1792 |
*/
|
|
1793 |
if (not Lex->parse_vcol_expr) |
|
1794 |
{
|
|
1795 |
my_message(ER_SYNTAX_ERROR, ER(ER_SYNTAX_ERROR), MYF(0)); |
|
1796 |
DRIZZLE_YYABORT; |
|
1797 |
}
|
|
1798 |
}
|
|
1799 |
;
|
|
1800 |
||
1801 |
virtual_column_func: |
|
1802 |
remember_name expr remember_end |
|
1803 |
{
|
|
1804 |
Lex->vcol_info= new virtual_column_info(); |
|
1805 |
if (not Lex->vcol_info) |
|
1806 |
{
|
|
1807 |
my_error(ER_OUTOFMEMORY, MYF(0), sizeof(virtual_column_info)); |
|
1808 |
DRIZZLE_YYABORT; |
|
1809 |
}
|
|
1810 |
uint expr_len= (uint)($3 - $1) - 1; |
|
1811 |
Lex->vcol_info->expr_str.str= (char* ) sql_memdup($1 + 1, expr_len); |
|
1812 |
Lex->vcol_info->expr_str.length= expr_len; |
|
1813 |
Lex->vcol_info->expr_item= $2; |
|
1
by brian
clean slate |
1814 |
}
|
1815 |
;
|
|
1816 |
||
1817 |
type: |
|
413.2.2
by Brian Aker
Removed UNSIGNED from parser. |
1818 |
int_type
|
223
by Brian Aker
Cleanup int() work. |
1819 |
{
|
1820 |
$$=$1; |
|
1821 |
Lex->length=(char*) 0; /* use default length */ |
|
1822 |
}
|
|
413.2.2
by Brian Aker
Removed UNSIGNED from parser. |
1823 |
| real_type opt_precision { $$=$1; } |
1
by brian
clean slate |
1824 |
| char '(' NUM ')' opt_binary |
1825 |
{
|
|
1826 |
Lex->length=$3.str; |
|
237
by Brian Aker
Syntax remove of char() (now maps to varchar). |
1827 |
$$=DRIZZLE_TYPE_VARCHAR; |
1
by brian
clean slate |
1828 |
}
|
1829 |
| char opt_binary |
|
1830 |
{
|
|
1831 |
Lex->length=(char*) "1"; |
|
237
by Brian Aker
Syntax remove of char() (now maps to varchar). |
1832 |
$$=DRIZZLE_TYPE_VARCHAR; |
1
by brian
clean slate |
1833 |
}
|
1834 |
| varchar '(' NUM ')' opt_binary |
|
1835 |
{
|
|
1836 |
Lex->length=$3.str; |
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1837 |
$$= DRIZZLE_TYPE_VARCHAR; |
1
by brian
clean slate |
1838 |
}
|
1839 |
| VARBINARY '(' NUM ')' |
|
1840 |
{
|
|
1841 |
Lex->length=$3.str; |
|
1842 |
Lex->charset=&my_charset_bin; |
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1843 |
$$= DRIZZLE_TYPE_VARCHAR; |
1
by brian
clean slate |
1844 |
}
|
1845 |
| DATE_SYM |
|
575.5.1
by David Axmark
Changed NEWDATE to DATE. One failing test but I think its somewhere else in the code |
1846 |
{ $$=DRIZZLE_TYPE_DATE; } |
1
by brian
clean slate |
1847 |
| TIME_SYM |
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1848 |
{ $$=DRIZZLE_TYPE_TIME; } |
1
by brian
clean slate |
1849 |
| TIMESTAMP |
1850 |
{
|
|
1851 |
/* Unlike other types TIMESTAMP fields are NOT NULL by default */ |
|
1852 |
Lex->type|= NOT_NULL_FLAG; |
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1853 |
$$=DRIZZLE_TYPE_TIMESTAMP; |
1
by brian
clean slate |
1854 |
}
|
1855 |
| DATETIME |
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1856 |
{ $$=DRIZZLE_TYPE_DATETIME; } |
232
by Brian Aker
Removed display bits from blob/text. |
1857 |
| BLOB_SYM |
1
by brian
clean slate |
1858 |
{
|
1859 |
Lex->charset=&my_charset_bin; |
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1860 |
$$=DRIZZLE_TYPE_BLOB; |
232
by Brian Aker
Removed display bits from blob/text. |
1861 |
Lex->length=(char*) 0; /* use default length */ |
1862 |
}
|
|
1863 |
| TEXT_SYM opt_binary |
|
1864 |
{
|
|
1865 |
$$=DRIZZLE_TYPE_BLOB; |
|
1866 |
Lex->length=(char*) 0; /* use default length */ |
|
1867 |
}
|
|
413.2.2
by Brian Aker
Removed UNSIGNED from parser. |
1868 |
| DECIMAL_SYM float_options |
1869 |
{ $$=DRIZZLE_TYPE_NEWDECIMAL;} |
|
1870 |
| NUMERIC_SYM float_options |
|
1871 |
{ $$=DRIZZLE_TYPE_NEWDECIMAL;} |
|
1872 |
| FIXED_SYM float_options |
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1873 |
{ $$=DRIZZLE_TYPE_NEWDECIMAL;} |
1
by brian
clean slate |
1874 |
| ENUM |
1875 |
{Lex->interval_list.empty();} |
|
1876 |
'(' string_list ')' opt_binary |
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1877 |
{ $$=DRIZZLE_TYPE_ENUM; } |
1
by brian
clean slate |
1878 |
| SERIAL_SYM |
1879 |
{
|
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1880 |
$$=DRIZZLE_TYPE_LONGLONG; |
413.2.2
by Brian Aker
Removed UNSIGNED from parser. |
1881 |
Lex->type|= (AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNIQUE_FLAG); |
1
by brian
clean slate |
1882 |
}
|
1883 |
;
|
|
1884 |
||
1885 |
char: |
|
1886 |
CHAR_SYM {} |
|
1887 |
;
|
|
1888 |
||
1889 |
varchar: |
|
1890 |
char VARYING {} |
|
1891 |
| VARCHAR {} |
|
1892 |
;
|
|
1893 |
||
1894 |
int_type: |
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1895 |
INT_SYM { $$=DRIZZLE_TYPE_LONG; } |
1896 |
| BIGINT { $$=DRIZZLE_TYPE_LONGLONG; } |
|
1
by brian
clean slate |
1897 |
;
|
1898 |
||
1899 |
real_type: |
|
1900 |
REAL
|
|
1901 |
{
|
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1902 |
$$= DRIZZLE_TYPE_DOUBLE; |
1
by brian
clean slate |
1903 |
}
|
1904 |
| DOUBLE_SYM |
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1905 |
{ $$=DRIZZLE_TYPE_DOUBLE; } |
1
by brian
clean slate |
1906 |
| DOUBLE_SYM PRECISION |
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1907 |
{ $$=DRIZZLE_TYPE_DOUBLE; } |
1
by brian
clean slate |
1908 |
;
|
1909 |
||
1910 |
float_options: |
|
1911 |
/* empty */ |
|
1912 |
{ Lex->dec=Lex->length= (char*)0; } |
|
1913 |
| '(' NUM ')' |
|
1914 |
{ Lex->length=$2.str; Lex->dec= (char*)0; } |
|
1915 |
| precision |
|
1916 |
{}
|
|
1917 |
;
|
|
1918 |
||
1919 |
precision: |
|
1920 |
'(' NUM ',' NUM ')' |
|
1921 |
{
|
|
1922 |
LEX *lex=Lex; |
|
1923 |
lex->length=$2.str; |
|
1924 |
lex->dec=$4.str; |
|
1925 |
}
|
|
1926 |
;
|
|
1927 |
||
1928 |
opt_len: |
|
1929 |
/* empty */ { Lex->length=(char*) 0; /* use default length */ } |
|
1930 |
| '(' NUM ')' { Lex->length= $2.str; } |
|
1931 |
;
|
|
1932 |
||
1933 |
opt_precision: |
|
1934 |
/* empty */ {} |
|
1935 |
| precision {} |
|
1936 |
;
|
|
1937 |
||
1938 |
opt_attribute: |
|
1939 |
/* empty */ {} |
|
1940 |
| opt_attribute_list {} |
|
1941 |
;
|
|
1942 |
||
1943 |
opt_attribute_list: |
|
1944 |
opt_attribute_list attribute {} |
|
1945 |
| attribute |
|
1946 |
;
|
|
1947 |
||
1948 |
attribute: |
|
1949 |
NULL_SYM { Lex->type&= ~ NOT_NULL_FLAG; } |
|
1950 |
| COLUMN_FORMAT_SYM column_format_types |
|
1951 |
{
|
|
1952 |
Lex->column_format= $2; |
|
1953 |
Lex->alter_info.flags|= ALTER_COLUMN_FORMAT; |
|
1954 |
}
|
|
1955 |
| not NULL_SYM { Lex->type|= NOT_NULL_FLAG; } |
|
1956 |
| DEFAULT now_or_signed_literal |
|
1957 |
{
|
|
1958 |
Lex->default_value=$2; |
|
1959 |
Lex->alter_info.flags|= ALTER_COLUMN_DEFAULT; |
|
1960 |
}
|
|
1961 |
| ON UPDATE_SYM NOW_SYM optional_braces |
|
1962 |
{ Lex->on_update_value= new Item_func_now_local(); } |
|
1963 |
| AUTO_INC { Lex->type|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG; } |
|
1964 |
| SERIAL_SYM DEFAULT VALUE_SYM |
|
1965 |
{
|
|
1966 |
LEX *lex=Lex; |
|
1967 |
lex->type|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNIQUE_FLAG; |
|
1968 |
lex->alter_info.flags|= ALTER_ADD_INDEX; |
|
1969 |
}
|
|
1970 |
| opt_primary KEY_SYM |
|
1971 |
{
|
|
1972 |
LEX *lex=Lex; |
|
1973 |
lex->type|= PRI_KEY_FLAG | NOT_NULL_FLAG; |
|
1974 |
lex->alter_info.flags|= ALTER_ADD_INDEX; |
|
1975 |
}
|
|
1976 |
| UNIQUE_SYM |
|
1977 |
{
|
|
1978 |
LEX *lex=Lex; |
|
1979 |
lex->type|= UNIQUE_FLAG; |
|
1980 |
lex->alter_info.flags|= ALTER_ADD_INDEX; |
|
1981 |
}
|
|
1982 |
| UNIQUE_SYM KEY_SYM |
|
1983 |
{
|
|
1984 |
LEX *lex=Lex; |
|
1985 |
lex->type|= UNIQUE_KEY_FLAG; |
|
1986 |
lex->alter_info.flags|= ALTER_ADD_INDEX; |
|
1987 |
}
|
|
1988 |
| COMMENT_SYM TEXT_STRING_sys { Lex->comment= $2; } |
|
1989 |
| COLLATE_SYM collation_name |
|
1990 |
{
|
|
1991 |
if (Lex->charset && !my_charset_same(Lex->charset,$2)) |
|
1992 |
{
|
|
1993 |
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0), |
|
1994 |
$2->name,Lex->charset->csname); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
1995 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
1996 |
}
|
1997 |
else
|
|
1998 |
{
|
|
1999 |
Lex->charset=$2; |
|
2000 |
}
|
|
2001 |
}
|
|
2002 |
;
|
|
2003 |
||
2004 |
now_or_signed_literal: |
|
2005 |
NOW_SYM optional_braces |
|
2006 |
{ $$= new Item_func_now_local(); } |
|
2007 |
| signed_literal |
|
2008 |
{ $$=$1; } |
|
2009 |
;
|
|
2010 |
||
2011 |
collation_name: |
|
2012 |
ident_or_text
|
|
2013 |
{
|
|
2014 |
if (!($$=get_charset_by_name($1.str,MYF(0)))) |
|
2015 |
{
|
|
2016 |
my_error(ER_UNKNOWN_COLLATION, MYF(0), $1.str); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2017 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2018 |
}
|
2019 |
}
|
|
2020 |
;
|
|
2021 |
||
2022 |
collation_name_or_default: |
|
2023 |
collation_name { $$=$1; } |
|
2024 |
| DEFAULT { $$=NULL; } |
|
2025 |
;
|
|
2026 |
||
2027 |
opt_default: |
|
2028 |
/* empty */ {} |
|
2029 |
| DEFAULT {} |
|
2030 |
;
|
|
2031 |
||
2032 |
opt_binary: |
|
2033 |
/* empty */ { Lex->charset=NULL; } |
|
2034 |
| BYTE_SYM { Lex->charset=&my_charset_bin; } |
|
2035 |
| BINARY { Lex->type|= BINCMP_FLAG; } |
|
2036 |
;
|
|
2037 |
||
2038 |
ws_nweights: |
|
2039 |
'(' real_ulong_num |
|
2040 |
{
|
|
2041 |
if ($2 == 0) |
|
2042 |
{
|
|
2043 |
my_parse_error(ER(ER_SYNTAX_ERROR)); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2044 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2045 |
}
|
2046 |
}
|
|
2047 |
')'
|
|
2048 |
{ $$= $2; } |
|
2049 |
;
|
|
2050 |
||
2051 |
ws_level_flag_desc: |
|
2052 |
ASC { $$= 0; } |
|
2053 |
| DESC { $$= 1 << MY_STRXFRM_DESC_SHIFT; } |
|
2054 |
;
|
|
2055 |
||
2056 |
ws_level_flag_reverse: |
|
2057 |
REVERSE_SYM { $$= 1 << MY_STRXFRM_REVERSE_SHIFT; } ; |
|
2058 |
||
2059 |
ws_level_flags: |
|
2060 |
/* empty */ { $$= 0; } |
|
2061 |
| ws_level_flag_desc { $$= $1; } |
|
2062 |
| ws_level_flag_desc ws_level_flag_reverse { $$= $1 | $2; } |
|
2063 |
| ws_level_flag_reverse { $$= $1 ; } |
|
2064 |
;
|
|
2065 |
||
2066 |
ws_level_number: |
|
2067 |
real_ulong_num
|
|
2068 |
{
|
|
2069 |
$$= $1 < 1 ? 1 : ($1 > MY_STRXFRM_NLEVELS ? MY_STRXFRM_NLEVELS : $1); |
|
2070 |
$$--; |
|
2071 |
}
|
|
2072 |
;
|
|
2073 |
||
2074 |
ws_level_list_item: |
|
2075 |
ws_level_number ws_level_flags |
|
2076 |
{
|
|
2077 |
$$= (1 | $2) << $1; |
|
2078 |
}
|
|
2079 |
;
|
|
2080 |
||
2081 |
ws_level_list: |
|
2082 |
ws_level_list_item { $$= $1; } |
|
2083 |
| ws_level_list ',' ws_level_list_item { $$|= $3; } |
|
2084 |
;
|
|
2085 |
||
2086 |
ws_level_range: |
|
2087 |
ws_level_number '-' ws_level_number |
|
2088 |
{
|
|
482
by Brian Aker
Remove uint. |
2089 |
uint32_t start= $1; |
2090 |
uint32_t end= $3; |
|
1
by brian
clean slate |
2091 |
for ($$= 0; start <= end; start++) |
2092 |
$$|= (1 << start); |
|
2093 |
}
|
|
2094 |
;
|
|
2095 |
||
2096 |
ws_level_list_or_range: |
|
2097 |
ws_level_list { $$= $1; } |
|
2098 |
| ws_level_range { $$= $1; } |
|
2099 |
;
|
|
2100 |
||
2101 |
opt_ws_levels: |
|
2102 |
/* empty*/ { $$= 0; } |
|
2103 |
| LEVEL_SYM ws_level_list_or_range { $$= $2; } |
|
2104 |
;
|
|
2105 |
||
2106 |
opt_primary: |
|
2107 |
/* empty */ |
|
2108 |
| PRIMARY_SYM |
|
2109 |
;
|
|
2110 |
||
2111 |
references: |
|
2112 |
REFERENCES
|
|
2113 |
table_ident
|
|
2114 |
opt_ref_list
|
|
2115 |
opt_match_clause
|
|
2116 |
opt_on_update_delete
|
|
2117 |
{
|
|
2118 |
$$=$2; |
|
2119 |
}
|
|
2120 |
;
|
|
2121 |
||
2122 |
opt_ref_list: |
|
2123 |
/* empty */ |
|
2124 |
{ Lex->ref_list.empty(); } |
|
2125 |
| '(' ref_list ')' |
|
2126 |
;
|
|
2127 |
||
2128 |
ref_list: |
|
2129 |
ref_list ',' ident |
|
2130 |
{ Lex->ref_list.push_back(new Key_part_spec($3, 0)); } |
|
2131 |
| ident |
|
2132 |
{
|
|
2133 |
LEX *lex= Lex; |
|
2134 |
lex->ref_list.empty(); |
|
2135 |
lex->ref_list.push_back(new Key_part_spec($1, 0)); |
|
2136 |
}
|
|
2137 |
;
|
|
2138 |
||
2139 |
opt_match_clause: |
|
2140 |
/* empty */ |
|
2141 |
{ Lex->fk_match_option= Foreign_key::FK_MATCH_UNDEF; } |
|
2142 |
| MATCH FULL |
|
2143 |
{ Lex->fk_match_option= Foreign_key::FK_MATCH_FULL; } |
|
2144 |
| MATCH PARTIAL |
|
2145 |
{ Lex->fk_match_option= Foreign_key::FK_MATCH_PARTIAL; } |
|
2146 |
| MATCH SIMPLE_SYM |
|
2147 |
{ Lex->fk_match_option= Foreign_key::FK_MATCH_SIMPLE; } |
|
2148 |
;
|
|
2149 |
||
2150 |
opt_on_update_delete: |
|
2151 |
/* empty */ |
|
2152 |
{
|
|
2153 |
LEX *lex= Lex; |
|
2154 |
lex->fk_update_opt= Foreign_key::FK_OPTION_UNDEF; |
|
2155 |
lex->fk_delete_opt= Foreign_key::FK_OPTION_UNDEF; |
|
2156 |
}
|
|
2157 |
| ON UPDATE_SYM delete_option |
|
2158 |
{
|
|
2159 |
LEX *lex= Lex; |
|
2160 |
lex->fk_update_opt= $3; |
|
2161 |
lex->fk_delete_opt= Foreign_key::FK_OPTION_UNDEF; |
|
2162 |
}
|
|
2163 |
| ON DELETE_SYM delete_option |
|
2164 |
{
|
|
2165 |
LEX *lex= Lex; |
|
2166 |
lex->fk_update_opt= Foreign_key::FK_OPTION_UNDEF; |
|
2167 |
lex->fk_delete_opt= $3; |
|
2168 |
}
|
|
2169 |
| ON UPDATE_SYM delete_option |
|
2170 |
ON DELETE_SYM delete_option |
|
2171 |
{
|
|
2172 |
LEX *lex= Lex; |
|
2173 |
lex->fk_update_opt= $3; |
|
2174 |
lex->fk_delete_opt= $6; |
|
2175 |
}
|
|
2176 |
| ON DELETE_SYM delete_option |
|
2177 |
ON UPDATE_SYM delete_option |
|
2178 |
{
|
|
2179 |
LEX *lex= Lex; |
|
2180 |
lex->fk_update_opt= $6; |
|
2181 |
lex->fk_delete_opt= $3; |
|
2182 |
}
|
|
2183 |
;
|
|
2184 |
||
2185 |
delete_option: |
|
2186 |
RESTRICT { $$= Foreign_key::FK_OPTION_RESTRICT; } |
|
2187 |
| CASCADE { $$= Foreign_key::FK_OPTION_CASCADE; } |
|
2188 |
| SET NULL_SYM { $$= Foreign_key::FK_OPTION_SET_NULL; } |
|
2189 |
| NO_SYM ACTION { $$= Foreign_key::FK_OPTION_NO_ACTION; } |
|
2190 |
| SET DEFAULT { $$= Foreign_key::FK_OPTION_DEFAULT; } |
|
2191 |
;
|
|
2192 |
||
2193 |
key_type: |
|
2194 |
key_or_index { $$= Key::MULTIPLE; } |
|
2195 |
;
|
|
2196 |
||
2197 |
constraint_key_type: |
|
2198 |
PRIMARY_SYM KEY_SYM { $$= Key::PRIMARY; } |
|
2199 |
| UNIQUE_SYM opt_key_or_index { $$= Key::UNIQUE; } |
|
2200 |
;
|
|
2201 |
||
2202 |
key_or_index: |
|
2203 |
KEY_SYM {} |
|
2204 |
| INDEX_SYM {} |
|
2205 |
;
|
|
2206 |
||
2207 |
opt_key_or_index: |
|
2208 |
/* empty */ {} |
|
2209 |
| key_or_index |
|
2210 |
;
|
|
2211 |
||
2212 |
keys_or_index: |
|
2213 |
KEYS {} |
|
2214 |
| INDEX_SYM {} |
|
2215 |
| INDEXES {} |
|
2216 |
;
|
|
2217 |
||
2218 |
opt_unique: |
|
2219 |
/* empty */ { $$= Key::MULTIPLE; } |
|
2220 |
| UNIQUE_SYM { $$= Key::UNIQUE; } |
|
2221 |
;
|
|
2222 |
||
2223 |
init_key_options: |
|
2224 |
{
|
|
2225 |
Lex->key_create_info= default_key_create_info; |
|
2226 |
}
|
|
2227 |
;
|
|
2228 |
||
2229 |
/*
|
|
2230 |
For now, key_alg initializies lex->key_create_info. |
|
2231 |
In the future, when all key options are after key definition, |
|
2232 |
we can remove key_alg and move init_key_options to key_options |
|
2233 |
*/
|
|
2234 |
||
2235 |
key_alg: |
|
2236 |
init_key_options
|
|
2237 |
| init_key_options key_using_alg |
|
2238 |
;
|
|
2239 |
||
2240 |
key_options: |
|
2241 |
/* empty */ {} |
|
2242 |
| key_opts |
|
2243 |
;
|
|
2244 |
||
2245 |
key_opts: |
|
2246 |
key_opt
|
|
2247 |
| key_opts key_opt |
|
2248 |
;
|
|
2249 |
||
2250 |
key_using_alg: |
|
2251 |
USING btree_or_rtree { Lex->key_create_info.algorithm= $2; } |
|
2252 |
| TYPE_SYM btree_or_rtree { Lex->key_create_info.algorithm= $2; } |
|
2253 |
;
|
|
2254 |
||
2255 |
key_opt: |
|
2256 |
key_using_alg
|
|
2257 |
| KEY_BLOCK_SIZE opt_equal ulong_num |
|
2258 |
{ Lex->key_create_info.block_size= $3; } |
|
2259 |
| COMMENT_SYM TEXT_STRING_sys |
|
2260 |
{ Lex->key_create_info.comment= $2; } |
|
2261 |
;
|
|
2262 |
||
2263 |
btree_or_rtree: |
|
2264 |
BTREE_SYM { $$= HA_KEY_ALG_BTREE; } |
|
2265 |
| HASH_SYM { $$= HA_KEY_ALG_HASH; } |
|
2266 |
;
|
|
2267 |
||
2268 |
key_list: |
|
2269 |
key_list ',' key_part order_dir { Lex->col_list.push_back($3); } |
|
2270 |
| key_part order_dir { Lex->col_list.push_back($1); } |
|
2271 |
;
|
|
2272 |
||
2273 |
key_part: |
|
2274 |
ident { $$=new Key_part_spec($1, 0); } |
|
2275 |
| ident '(' NUM ')' |
|
2276 |
{
|
|
2277 |
int key_part_len= atoi($3.str); |
|
2278 |
if (!key_part_len) |
|
2279 |
{
|
|
2280 |
my_error(ER_KEY_PART_0, MYF(0), $1.str); |
|
2281 |
}
|
|
2282 |
$$=new Key_part_spec($1, (uint) key_part_len); |
|
2283 |
}
|
|
2284 |
;
|
|
2285 |
||
2286 |
opt_ident: |
|
2287 |
/* empty */ { $$= null_lex_str; } |
|
2288 |
| field_ident { $$= $1; } |
|
2289 |
;
|
|
2290 |
||
2291 |
opt_component: |
|
2292 |
/* empty */ { $$= null_lex_str; } |
|
2293 |
| '.' ident { $$= $2; } |
|
2294 |
;
|
|
2295 |
||
2296 |
string_list: |
|
2297 |
text_string { Lex->interval_list.push_back($1); } |
|
2298 |
| string_list ',' text_string { Lex->interval_list.push_back($3); }; |
|
2299 |
||
2300 |
/*
|
|
2301 |
** Alter table |
|
2302 |
*/
|
|
2303 |
||
2304 |
alter: |
|
2305 |
ALTER build_method opt_ignore TABLE_SYM table_ident |
|
2306 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2307 |
Session *session= YYSession; |
2308 |
LEX *lex= session->lex; |
|
1
by brian
clean slate |
2309 |
lex->name.str= 0; |
2310 |
lex->name.length= 0; |
|
2311 |
lex->sql_command= SQLCOM_ALTER_TABLE; |
|
2312 |
lex->duplicates= DUP_ERROR; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2313 |
if (!lex->select_lex.add_table_to_list(session, $5, NULL, |
1
by brian
clean slate |
2314 |
TL_OPTION_UPDATING)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2315 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2316 |
lex->alter_info.reset(); |
2317 |
lex->col_list.empty(); |
|
2318 |
lex->select_lex.init_order(); |
|
2319 |
lex->select_lex.db= |
|
327.2.5
by Brian Aker
Refactoring show command |
2320 |
((TableList*) lex->select_lex.table_list.first)->db; |
212.6.6
by Mats Kindahl
Removing redundant use of casts in drizzled/ for memcmp(), memcpy(), memset(), and memmove(). |
2321 |
memset(&lex->create_info, 0, sizeof(lex->create_info)); |
1
by brian
clean slate |
2322 |
lex->create_info.db_type= 0; |
2323 |
lex->create_info.default_table_charset= NULL; |
|
2324 |
lex->create_info.row_type= ROW_TYPE_NOT_USED; |
|
2325 |
lex->alter_info.reset(); |
|
2326 |
lex->alter_info.build_method= $2; |
|
2327 |
}
|
|
2328 |
alter_commands
|
|
2329 |
{}
|
|
2330 |
| ALTER DATABASE ident_or_empty |
|
2331 |
{
|
|
2332 |
Lex->create_info.default_table_charset= NULL; |
|
2333 |
Lex->create_info.used_fields= 0; |
|
2334 |
}
|
|
2335 |
create_database_options
|
|
2336 |
{
|
|
2337 |
LEX *lex=Lex; |
|
2338 |
lex->sql_command=SQLCOM_ALTER_DB; |
|
2339 |
lex->name= $3; |
|
2340 |
if (lex->name.str == NULL && |
|
2341 |
lex->copy_db_to(&lex->name.str, &lex->name.length)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2342 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2343 |
}
|
2344 |
;
|
|
2345 |
||
2346 |
ident_or_empty: |
|
2347 |
/* empty */ { $$.str= 0; $$.length= 0; } |
|
2348 |
| ident { $$= $1; } |
|
2349 |
;
|
|
2350 |
||
2351 |
alter_commands: |
|
2352 |
/* empty */ |
|
108
by Brian Aker
Removed unwanted ALTER TABLESPACE, left in valuable bits. |
2353 |
| DISCARD TABLESPACE { Lex->alter_info.tablespace_op= DISCARD_TABLESPACE; } |
2354 |
| IMPORT TABLESPACE { Lex->alter_info.tablespace_op= IMPORT_TABLESPACE; } |
|
1
by brian
clean slate |
2355 |
| alter_list |
2356 |
;
|
|
2357 |
||
2358 |
build_method: |
|
2359 |
/* empty */ |
|
2360 |
{
|
|
2361 |
$$= HA_BUILD_DEFAULT; |
|
2362 |
}
|
|
2363 |
| ONLINE_SYM |
|
2364 |
{
|
|
2365 |
$$= HA_BUILD_ONLINE; |
|
2366 |
}
|
|
2367 |
| OFFLINE_SYM |
|
2368 |
{
|
|
2369 |
$$= HA_BUILD_OFFLINE; |
|
2370 |
}
|
|
2371 |
;
|
|
2372 |
||
2373 |
alter_list: |
|
2374 |
alter_list_item
|
|
2375 |
| alter_list ',' alter_list_item |
|
2376 |
;
|
|
2377 |
||
2378 |
add_column: |
|
2379 |
ADD opt_column |
|
2380 |
{
|
|
2381 |
LEX *lex=Lex; |
|
2382 |
lex->change=0; |
|
2383 |
lex->alter_info.flags|= ALTER_ADD_COLUMN; |
|
2384 |
}
|
|
2385 |
;
|
|
2386 |
||
2387 |
alter_list_item: |
|
2388 |
add_column column_def opt_place { } |
|
2389 |
| ADD key_def |
|
2390 |
{
|
|
2391 |
Lex->alter_info.flags|= ALTER_ADD_INDEX; |
|
2392 |
}
|
|
2393 |
| add_column '(' field_list ')' |
|
2394 |
{
|
|
2395 |
Lex->alter_info.flags|= ALTER_ADD_COLUMN | ALTER_ADD_INDEX; |
|
2396 |
}
|
|
2397 |
| CHANGE opt_column field_ident |
|
2398 |
{
|
|
2399 |
LEX *lex=Lex; |
|
2400 |
lex->change= $3.str; |
|
2401 |
lex->alter_info.flags|= ALTER_CHANGE_COLUMN; |
|
2402 |
}
|
|
2403 |
field_spec opt_place |
|
2404 |
| MODIFY_SYM opt_column field_ident |
|
2405 |
{
|
|
2406 |
LEX *lex=Lex; |
|
2407 |
lex->length=lex->dec=0; lex->type=0; |
|
2408 |
lex->default_value= lex->on_update_value= 0; |
|
2409 |
lex->comment=null_lex_str; |
|
2410 |
lex->charset= NULL; |
|
2411 |
lex->alter_info.flags|= ALTER_CHANGE_COLUMN; |
|
2412 |
lex->column_format= COLUMN_FORMAT_TYPE_DEFAULT; |
|
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
2413 |
lex->vcol_info= NULL; |
1
by brian
clean slate |
2414 |
}
|
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
2415 |
field_def
|
1
by brian
clean slate |
2416 |
{
|
2417 |
LEX *lex=Lex; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2418 |
if (add_field_to_list(lex->session,&$3, |
1
by brian
clean slate |
2419 |
(enum enum_field_types) $5, |
2420 |
lex->length,lex->dec,lex->type, |
|
100
by Brian Aker
First pass through refactor to remove STORAGE TYPE from Yacc (and eventually |
2421 |
lex->column_format, |
1
by brian
clean slate |
2422 |
lex->default_value, lex->on_update_value, |
2423 |
&lex->comment, |
|
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
2424 |
$3.str, &lex->interval_list, lex->charset, |
2425 |
lex->vcol_info)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2426 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2427 |
}
|
2428 |
opt_place
|
|
184
by Brian Aker
Dead debug code removal (and a compatible "never used") bit in the |
2429 |
| DROP opt_column field_ident |
1
by brian
clean slate |
2430 |
{
|
2431 |
LEX *lex=Lex; |
|
2432 |
lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::COLUMN, |
|
2433 |
$3.str)); |
|
2434 |
lex->alter_info.flags|= ALTER_DROP_COLUMN; |
|
2435 |
}
|
|
2436 |
| DROP FOREIGN KEY_SYM opt_ident |
|
2437 |
{
|
|
2438 |
Lex->alter_info.flags|= ALTER_DROP_INDEX | ALTER_FOREIGN_KEY; |
|
2439 |
}
|
|
2440 |
| DROP PRIMARY_SYM KEY_SYM |
|
2441 |
{
|
|
2442 |
LEX *lex=Lex; |
|
2443 |
lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY, |
|
590.1.1
by Stewart Smith
begin moving from global const char* primary_key_name to methods is_primary_key() and is_primary_key_name() |
2444 |
"PRIMARY")); |
1
by brian
clean slate |
2445 |
lex->alter_info.flags|= ALTER_DROP_INDEX; |
2446 |
}
|
|
2447 |
| DROP key_or_index field_ident |
|
2448 |
{
|
|
2449 |
LEX *lex=Lex; |
|
2450 |
lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY, |
|
2451 |
$3.str)); |
|
2452 |
lex->alter_info.flags|= ALTER_DROP_INDEX; |
|
2453 |
}
|
|
2454 |
| DISABLE_SYM KEYS |
|
2455 |
{
|
|
2456 |
LEX *lex=Lex; |
|
2457 |
lex->alter_info.keys_onoff= DISABLE; |
|
2458 |
lex->alter_info.flags|= ALTER_KEYS_ONOFF; |
|
2459 |
}
|
|
2460 |
| ENABLE_SYM KEYS |
|
2461 |
{
|
|
2462 |
LEX *lex=Lex; |
|
2463 |
lex->alter_info.keys_onoff= ENABLE; |
|
2464 |
lex->alter_info.flags|= ALTER_KEYS_ONOFF; |
|
2465 |
}
|
|
2466 |
| ALTER opt_column field_ident SET DEFAULT signed_literal |
|
2467 |
{
|
|
2468 |
LEX *lex=Lex; |
|
2469 |
lex->alter_info.alter_list.push_back(new Alter_column($3.str,$6)); |
|
2470 |
lex->alter_info.flags|= ALTER_COLUMN_DEFAULT; |
|
2471 |
}
|
|
2472 |
| ALTER opt_column field_ident DROP DEFAULT |
|
2473 |
{
|
|
2474 |
LEX *lex=Lex; |
|
2475 |
lex->alter_info.alter_list.push_back(new Alter_column($3.str, |
|
2476 |
(Item*) 0)); |
|
2477 |
lex->alter_info.flags|= ALTER_COLUMN_DEFAULT; |
|
2478 |
}
|
|
2479 |
| RENAME opt_to table_ident |
|
2480 |
{
|
|
2481 |
LEX *lex=Lex; |
|
2482 |
size_t dummy; |
|
2483 |
lex->select_lex.db=$3->db.str; |
|
2484 |
if (lex->select_lex.db == NULL && |
|
2485 |
lex->copy_db_to(&lex->select_lex.db, &dummy)) |
|
2486 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2487 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2488 |
}
|
2489 |
if (check_table_name($3->table.str,$3->table.length) || ($3->db.str && check_db_name(&$3->db))) |
|
2490 |
{
|
|
2491 |
my_error(ER_WRONG_TABLE_NAME, MYF(0), $3->table.str); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2492 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2493 |
}
|
2494 |
lex->name= $3->table; |
|
2495 |
lex->alter_info.flags|= ALTER_RENAME; |
|
2496 |
}
|
|
383.1.27
by Brian Aker
Next pass in the unending saga of UTF-8.. now we can set in SQL collation |
2497 |
| CONVERT_SYM TO_SYM collation_name_or_default |
1
by brian
clean slate |
2498 |
{
|
383.1.27
by Brian Aker
Next pass in the unending saga of UTF-8.. now we can set in SQL collation |
2499 |
if (!$3) |
1
by brian
clean slate |
2500 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2501 |
Session *session= YYSession; |
2502 |
$3= session->variables.collation_database; |
|
1
by brian
clean slate |
2503 |
}
|
2504 |
LEX *lex= Lex; |
|
2505 |
lex->create_info.table_charset= |
|
383.1.27
by Brian Aker
Next pass in the unending saga of UTF-8.. now we can set in SQL collation |
2506 |
lex->create_info.default_table_charset= $3; |
1
by brian
clean slate |
2507 |
lex->create_info.used_fields|= (HA_CREATE_USED_CHARSET | |
2508 |
HA_CREATE_USED_DEFAULT_CHARSET); |
|
2509 |
lex->alter_info.flags|= ALTER_CONVERT; |
|
2510 |
}
|
|
2511 |
| create_table_options_space_separated |
|
2512 |
{
|
|
2513 |
LEX *lex=Lex; |
|
2514 |
lex->alter_info.flags|= ALTER_OPTIONS; |
|
2515 |
}
|
|
2516 |
| FORCE_SYM |
|
2517 |
{
|
|
2518 |
Lex->alter_info.flags|= ALTER_FORCE; |
|
2519 |
}
|
|
2520 |
| alter_order_clause |
|
2521 |
{
|
|
2522 |
LEX *lex=Lex; |
|
2523 |
lex->alter_info.flags|= ALTER_ORDER; |
|
2524 |
}
|
|
2525 |
;
|
|
2526 |
||
2527 |
opt_column: |
|
2528 |
/* empty */ {} |
|
2529 |
| COLUMN_SYM {} |
|
2530 |
;
|
|
2531 |
||
2532 |
opt_ignore: |
|
2533 |
/* empty */ { Lex->ignore= 0;} |
|
2534 |
| IGNORE_SYM { Lex->ignore= 1;} |
|
2535 |
;
|
|
2536 |
||
2537 |
opt_place: |
|
2538 |
/* empty */ {} |
|
2539 |
| AFTER_SYM ident |
|
2540 |
{
|
|
2541 |
store_position_for_column($2.str); |
|
2542 |
Lex->alter_info.flags|= ALTER_COLUMN_ORDER; |
|
2543 |
}
|
|
2544 |
| FIRST_SYM |
|
2545 |
{
|
|
2546 |
store_position_for_column(first_keyword); |
|
2547 |
Lex->alter_info.flags|= ALTER_COLUMN_ORDER; |
|
2548 |
}
|
|
2549 |
;
|
|
2550 |
||
2551 |
opt_to: |
|
2552 |
/* empty */ {} |
|
2553 |
| TO_SYM {} |
|
2554 |
| EQ {} |
|
2555 |
| AS {} |
|
2556 |
;
|
|
2557 |
||
2558 |
/*
|
|
2559 |
SLAVE START and SLAVE STOP are deprecated. We keep them for compatibility. |
|
2560 |
*/
|
|
2561 |
||
2562 |
slave: |
|
2563 |
START_SYM SLAVE slave_thread_opts |
|
2564 |
{
|
|
2565 |
LEX *lex=Lex; |
|
2566 |
lex->sql_command = SQLCOM_SLAVE_START; |
|
2567 |
lex->type = 0; |
|
2568 |
/* We'll use mi structure for UNTIL options */ |
|
212.6.6
by Mats Kindahl
Removing redundant use of casts in drizzled/ for memcmp(), memcpy(), memset(), and memmove(). |
2569 |
memset(&lex->mi, 0, sizeof(lex->mi)); |
1
by brian
clean slate |
2570 |
/* If you change this code don't forget to update SLAVE START too */ |
2571 |
}
|
|
2572 |
slave_until
|
|
2573 |
{}
|
|
2574 |
| STOP_SYM SLAVE slave_thread_opts |
|
2575 |
{
|
|
2576 |
LEX *lex=Lex; |
|
2577 |
lex->sql_command = SQLCOM_SLAVE_STOP; |
|
2578 |
lex->type = 0; |
|
2579 |
/* If you change this code don't forget to update SLAVE STOP too */ |
|
2580 |
}
|
|
2581 |
| SLAVE START_SYM slave_thread_opts |
|
2582 |
{
|
|
2583 |
LEX *lex=Lex; |
|
2584 |
lex->sql_command = SQLCOM_SLAVE_START; |
|
2585 |
lex->type = 0; |
|
2586 |
/* We'll use mi structure for UNTIL options */ |
|
212.6.6
by Mats Kindahl
Removing redundant use of casts in drizzled/ for memcmp(), memcpy(), memset(), and memmove(). |
2587 |
memset(&lex->mi, 0, sizeof(lex->mi)); |
1
by brian
clean slate |
2588 |
}
|
2589 |
slave_until
|
|
2590 |
{}
|
|
2591 |
| SLAVE STOP_SYM slave_thread_opts |
|
2592 |
{
|
|
2593 |
LEX *lex=Lex; |
|
2594 |
lex->sql_command = SQLCOM_SLAVE_STOP; |
|
2595 |
lex->type = 0; |
|
2596 |
}
|
|
2597 |
;
|
|
2598 |
||
2599 |
start: |
|
2600 |
START_SYM TRANSACTION_SYM start_transaction_opts |
|
2601 |
{
|
|
2602 |
LEX *lex= Lex; |
|
2603 |
lex->sql_command= SQLCOM_BEGIN; |
|
2604 |
lex->start_transaction_opt= $3; |
|
2605 |
}
|
|
2606 |
;
|
|
2607 |
||
2608 |
start_transaction_opts: |
|
2609 |
/*empty*/ { $$ = 0; } |
|
2610 |
| WITH CONSISTENT_SYM SNAPSHOT_SYM |
|
2611 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2612 |
$$= DRIZZLE_START_TRANS_OPT_WITH_CONS_SNAPSHOT; |
1
by brian
clean slate |
2613 |
}
|
2614 |
;
|
|
2615 |
||
2616 |
slave_thread_opts: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2617 |
{ Lex->slave_session_opt= 0; } |
1
by brian
clean slate |
2618 |
slave_thread_opt_list
|
2619 |
{}
|
|
2620 |
;
|
|
2621 |
||
2622 |
slave_thread_opt_list: |
|
2623 |
slave_thread_opt
|
|
2624 |
| slave_thread_opt_list ',' slave_thread_opt |
|
2625 |
;
|
|
2626 |
||
2627 |
slave_thread_opt: |
|
2628 |
/*empty*/ {} |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2629 |
| SQL_THREAD { Lex->slave_session_opt|=SLAVE_SQL; } |
2630 |
| RELAY_THREAD { Lex->slave_session_opt|=SLAVE_IO; } |
|
1
by brian
clean slate |
2631 |
;
|
2632 |
||
2633 |
slave_until: |
|
2634 |
/*empty*/ {} |
|
2635 |
| UNTIL_SYM slave_until_opts |
|
2636 |
{
|
|
2637 |
LEX *lex=Lex; |
|
2638 |
if (((lex->mi.log_file_name || lex->mi.pos) && (lex->mi.relay_log_name || lex->mi.relay_log_pos)) || |
|
2639 |
!((lex->mi.log_file_name && lex->mi.pos) || |
|
2640 |
(lex->mi.relay_log_name && lex->mi.relay_log_pos))) |
|
2641 |
{
|
|
2642 |
my_message(ER_BAD_SLAVE_UNTIL_COND, |
|
2643 |
ER(ER_BAD_SLAVE_UNTIL_COND), MYF(0)); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2644 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2645 |
}
|
2646 |
}
|
|
2647 |
;
|
|
2648 |
||
2649 |
slave_until_opts: |
|
2650 |
master_file_def
|
|
2651 |
| slave_until_opts ',' master_file_def |
|
2652 |
;
|
|
2653 |
||
2654 |
checksum: |
|
2655 |
CHECKSUM_SYM table_or_tables |
|
2656 |
{
|
|
2657 |
LEX *lex=Lex; |
|
2658 |
lex->sql_command = SQLCOM_CHECKSUM; |
|
2659 |
}
|
|
2660 |
table_list opt_checksum_type |
|
2661 |
{}
|
|
2662 |
;
|
|
2663 |
||
2664 |
opt_checksum_type: |
|
2665 |
/* nothing */ { Lex->check_opt.flags= 0; } |
|
2666 |
| QUICK { Lex->check_opt.flags= T_QUICK; } |
|
2667 |
| EXTENDED_SYM { Lex->check_opt.flags= T_EXTEND; } |
|
2668 |
;
|
|
2669 |
||
2670 |
repair: |
|
383.1.26
by Brian Aker
Removed option for single command replication and have now left disable of |
2671 |
REPAIR table_or_tables |
1
by brian
clean slate |
2672 |
{
|
2673 |
LEX *lex=Lex; |
|
2674 |
lex->sql_command = SQLCOM_REPAIR; |
|
2675 |
lex->check_opt.init(); |
|
2676 |
}
|
|
2677 |
table_list opt_mi_repair_type |
|
2678 |
{}
|
|
2679 |
;
|
|
2680 |
||
2681 |
opt_mi_repair_type: |
|
2682 |
/* empty */ { Lex->check_opt.flags = T_MEDIUM; } |
|
2683 |
| mi_repair_types {} |
|
2684 |
;
|
|
2685 |
||
2686 |
mi_repair_types: |
|
2687 |
mi_repair_type {} |
|
2688 |
| mi_repair_type mi_repair_types {} |
|
2689 |
;
|
|
2690 |
||
2691 |
mi_repair_type: |
|
2692 |
QUICK { Lex->check_opt.flags|= T_QUICK; } |
|
2693 |
| EXTENDED_SYM { Lex->check_opt.flags|= T_EXTEND; } |
|
2694 |
| USE_FRM { Lex->check_opt.sql_flags|= TT_USEFRM; } |
|
2695 |
;
|
|
2696 |
||
2697 |
analyze: |
|
383.1.26
by Brian Aker
Removed option for single command replication and have now left disable of |
2698 |
ANALYZE_SYM table_or_tables |
1
by brian
clean slate |
2699 |
{
|
2700 |
LEX *lex=Lex; |
|
2701 |
lex->sql_command = SQLCOM_ANALYZE; |
|
2702 |
lex->check_opt.init(); |
|
2703 |
}
|
|
2704 |
table_list
|
|
2705 |
{}
|
|
2706 |
;
|
|
2707 |
||
2708 |
binlog_base64_event: |
|
2709 |
BINLOG_SYM TEXT_STRING_sys |
|
2710 |
{
|
|
2711 |
Lex->sql_command = SQLCOM_BINLOG_BASE64_EVENT; |
|
2712 |
Lex->comment= $2; |
|
2713 |
}
|
|
2714 |
;
|
|
2715 |
||
2716 |
check: |
|
2717 |
CHECK_SYM table_or_tables |
|
2718 |
{
|
|
2719 |
LEX *lex=Lex; |
|
2720 |
||
2721 |
lex->sql_command = SQLCOM_CHECK; |
|
2722 |
lex->check_opt.init(); |
|
2723 |
}
|
|
2724 |
table_list opt_mi_check_type |
|
2725 |
{}
|
|
2726 |
;
|
|
2727 |
||
2728 |
opt_mi_check_type: |
|
2729 |
/* empty */ { Lex->check_opt.flags = T_MEDIUM; } |
|
2730 |
| mi_check_types {} |
|
2731 |
;
|
|
2732 |
||
2733 |
mi_check_types: |
|
2734 |
mi_check_type {} |
|
2735 |
| mi_check_type mi_check_types {} |
|
2736 |
;
|
|
2737 |
||
2738 |
mi_check_type: |
|
2739 |
QUICK { Lex->check_opt.flags|= T_QUICK; } |
|
2740 |
| FAST_SYM { Lex->check_opt.flags|= T_FAST; } |
|
2741 |
| MEDIUM_SYM { Lex->check_opt.flags|= T_MEDIUM; } |
|
2742 |
| EXTENDED_SYM { Lex->check_opt.flags|= T_EXTEND; } |
|
2743 |
| CHANGED { Lex->check_opt.flags|= T_CHECK_ONLY_CHANGED; } |
|
2744 |
| FOR_SYM UPGRADE_SYM { Lex->check_opt.sql_flags|= TT_FOR_UPGRADE; } |
|
2745 |
;
|
|
2746 |
||
2747 |
optimize: |
|
383.1.26
by Brian Aker
Removed option for single command replication and have now left disable of |
2748 |
OPTIMIZE table_or_tables |
1
by brian
clean slate |
2749 |
{
|
2750 |
LEX *lex=Lex; |
|
2751 |
lex->sql_command = SQLCOM_OPTIMIZE; |
|
2752 |
lex->check_opt.init(); |
|
2753 |
}
|
|
2754 |
table_list
|
|
2755 |
{}
|
|
2756 |
;
|
|
2757 |
||
2758 |
rename: |
|
2759 |
RENAME table_or_tables |
|
2760 |
{
|
|
2761 |
Lex->sql_command= SQLCOM_RENAME_TABLE; |
|
2762 |
}
|
|
2763 |
table_to_table_list
|
|
2764 |
{}
|
|
2765 |
;
|
|
2766 |
||
2767 |
table_to_table_list: |
|
2768 |
table_to_table
|
|
2769 |
| table_to_table_list ',' table_to_table |
|
2770 |
;
|
|
2771 |
||
2772 |
table_to_table: |
|
2773 |
table_ident TO_SYM table_ident |
|
2774 |
{
|
|
2775 |
LEX *lex=Lex; |
|
2776 |
SELECT_LEX *sl= lex->current_select; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2777 |
if (!sl->add_table_to_list(lex->session, $1,NULL,TL_OPTION_UPDATING, |
1
by brian
clean slate |
2778 |
TL_IGNORE) || |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2779 |
!sl->add_table_to_list(lex->session, $3,NULL,TL_OPTION_UPDATING, |
1
by brian
clean slate |
2780 |
TL_IGNORE)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2781 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2782 |
}
|
2783 |
;
|
|
2784 |
||
2785 |
keycache: |
|
2786 |
CACHE_SYM INDEX_SYM keycache_list IN_SYM key_cache_name |
|
2787 |
{
|
|
2788 |
LEX *lex=Lex; |
|
2789 |
lex->sql_command= SQLCOM_ASSIGN_TO_KEYCACHE; |
|
2790 |
lex->ident= $5; |
|
2791 |
}
|
|
2792 |
;
|
|
2793 |
||
2794 |
keycache_list: |
|
2795 |
assign_to_keycache
|
|
2796 |
| keycache_list ',' assign_to_keycache |
|
2797 |
;
|
|
2798 |
||
2799 |
assign_to_keycache: |
|
2800 |
table_ident cache_keys_spec |
|
2801 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2802 |
if (!Select->add_table_to_list(YYSession, $1, NULL, 0, TL_READ, |
1
by brian
clean slate |
2803 |
Select->pop_index_hints())) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2804 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2805 |
}
|
2806 |
;
|
|
2807 |
||
2808 |
key_cache_name: |
|
2809 |
ident { $$= $1; } |
|
2810 |
| DEFAULT { $$ = default_key_cache_base; } |
|
2811 |
;
|
|
2812 |
||
2813 |
cache_keys_spec: |
|
2814 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2815 |
Lex->select_lex.alloc_index_hints(YYSession); |
1
by brian
clean slate |
2816 |
Select->set_index_hint_type(INDEX_HINT_USE, |
2817 |
global_system_variables.old_mode ? |
|
2818 |
INDEX_HINT_MASK_JOIN : |
|
2819 |
INDEX_HINT_MASK_ALL); |
|
2820 |
}
|
|
2821 |
cache_key_list_or_empty
|
|
2822 |
;
|
|
2823 |
||
2824 |
cache_key_list_or_empty: |
|
2825 |
/* empty */ { } |
|
2826 |
| key_or_index '(' opt_key_usage_list ')' |
|
2827 |
;
|
|
2828 |
||
2829 |
/*
|
|
2830 |
Select : retrieve data from table |
|
2831 |
*/
|
|
2832 |
||
2833 |
||
2834 |
select: |
|
2835 |
select_init
|
|
2836 |
{
|
|
2837 |
LEX *lex= Lex; |
|
2838 |
lex->sql_command= SQLCOM_SELECT; |
|
2839 |
}
|
|
2840 |
;
|
|
2841 |
||
2842 |
/* Need select_init2 for subselects. */ |
|
2843 |
select_init: |
|
2844 |
SELECT_SYM select_init2 |
|
2845 |
| '(' select_paren ')' union_opt |
|
2846 |
;
|
|
2847 |
||
2848 |
select_paren: |
|
2849 |
SELECT_SYM select_part2 |
|
2850 |
{
|
|
2851 |
if (setup_select_in_parentheses(Lex)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2852 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2853 |
}
|
2854 |
| '(' select_paren ')' |
|
2855 |
;
|
|
2856 |
||
2857 |
/* The equivalent of select_paren for nested queries. */ |
|
2858 |
select_paren_derived: |
|
2859 |
SELECT_SYM select_part2_derived |
|
2860 |
{
|
|
2861 |
if (setup_select_in_parentheses(Lex)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2862 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2863 |
}
|
2864 |
| '(' select_paren_derived ')' |
|
2865 |
;
|
|
2866 |
||
2867 |
select_init2: |
|
2868 |
select_part2
|
|
2869 |
{
|
|
2870 |
LEX *lex= Lex; |
|
2871 |
SELECT_LEX * sel= lex->current_select; |
|
2872 |
if (lex->current_select->set_braces(0)) |
|
2873 |
{
|
|
2874 |
my_parse_error(ER(ER_SYNTAX_ERROR)); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2875 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2876 |
}
|
2877 |
if (sel->linkage == UNION_TYPE && |
|
2878 |
sel->master_unit()->first_select()->braces) |
|
2879 |
{
|
|
2880 |
my_parse_error(ER(ER_SYNTAX_ERROR)); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2881 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2882 |
}
|
2883 |
}
|
|
2884 |
union_clause
|
|
2885 |
;
|
|
2886 |
||
2887 |
select_part2: |
|
2888 |
{
|
|
2889 |
LEX *lex= Lex; |
|
2890 |
SELECT_LEX *sel= lex->current_select; |
|
2891 |
if (sel->linkage != UNION_TYPE) |
|
2892 |
mysql_init_select(lex); |
|
2893 |
lex->current_select->parsing_place= SELECT_LIST; |
|
2894 |
}
|
|
2895 |
select_options select_item_list |
|
2896 |
{
|
|
2897 |
Select->parsing_place= NO_MATTER; |
|
2898 |
}
|
|
2899 |
select_into select_lock_type |
|
2900 |
;
|
|
2901 |
||
2902 |
select_into: |
|
2903 |
opt_order_clause opt_limit_clause {} |
|
2904 |
| into |
|
2905 |
| select_from |
|
2906 |
| into select_from |
|
2907 |
| select_from into |
|
2908 |
;
|
|
2909 |
||
2910 |
select_from: |
|
2911 |
FROM join_table_list where_clause group_clause having_clause |
|
2912 |
opt_order_clause opt_limit_clause |
|
2913 |
{
|
|
2914 |
Select->context.table_list= |
|
2915 |
Select->context.first_name_resolution_table= |
|
327.2.5
by Brian Aker
Refactoring show command |
2916 |
(TableList *) Select->table_list.first; |
1
by brian
clean slate |
2917 |
}
|
2918 |
;
|
|
2919 |
||
2920 |
select_options: |
|
2921 |
/* empty*/ |
|
2922 |
| select_option_list |
|
2923 |
{
|
|
2924 |
if (Select->options & SELECT_DISTINCT && Select->options & SELECT_ALL) |
|
2925 |
{
|
|
2926 |
my_error(ER_WRONG_USAGE, MYF(0), "ALL", "DISTINCT"); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2927 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2928 |
}
|
2929 |
}
|
|
2930 |
;
|
|
2931 |
||
2932 |
select_option_list: |
|
2933 |
select_option_list select_option |
|
2934 |
| select_option |
|
2935 |
;
|
|
2936 |
||
2937 |
select_option: |
|
2938 |
STRAIGHT_JOIN { Select->options|= SELECT_STRAIGHT_JOIN; } |
|
2939 |
| HIGH_PRIORITY |
|
2940 |
{
|
|
2941 |
if (check_simple_select()) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2942 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2943 |
Lex->lock_option= TL_READ_HIGH_PRIORITY; |
2944 |
}
|
|
2945 |
| DISTINCT { Select->options|= SELECT_DISTINCT; } |
|
2946 |
| SQL_SMALL_RESULT { Select->options|= SELECT_SMALL_RESULT; } |
|
2947 |
| SQL_BIG_RESULT { Select->options|= SELECT_BIG_RESULT; } |
|
2948 |
| SQL_BUFFER_RESULT |
|
2949 |
{
|
|
2950 |
if (check_simple_select()) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2951 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2952 |
Select->options|= OPTION_BUFFER_RESULT; |
2953 |
}
|
|
2954 |
| SQL_CALC_FOUND_ROWS |
|
2955 |
{
|
|
2956 |
if (check_simple_select()) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2957 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2958 |
Select->options|= OPTION_FOUND_ROWS; |
2959 |
}
|
|
2960 |
| ALL { Select->options|= SELECT_ALL; } |
|
2961 |
;
|
|
2962 |
||
2963 |
select_lock_type: |
|
2964 |
/* empty */ |
|
2965 |
| FOR_SYM UPDATE_SYM |
|
2966 |
{
|
|
2967 |
LEX *lex=Lex; |
|
2968 |
lex->current_select->set_lock_for_tables(TL_WRITE); |
|
2969 |
}
|
|
2970 |
| LOCK_SYM IN_SYM SHARE_SYM MODE_SYM |
|
2971 |
{
|
|
2972 |
LEX *lex=Lex; |
|
2973 |
lex->current_select-> |
|
2974 |
set_lock_for_tables(TL_READ_WITH_SHARED_LOCKS); |
|
2975 |
}
|
|
2976 |
;
|
|
2977 |
||
2978 |
select_item_list: |
|
2979 |
select_item_list ',' select_item |
|
2980 |
| select_item |
|
2981 |
| '*' |
|
2982 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2983 |
Session *session= YYSession; |
2984 |
if (add_item_to_list(session, |
|
2985 |
new Item_field(&session->lex->current_select-> |
|
1
by brian
clean slate |
2986 |
context, |
2987 |
NULL, NULL, "*"))) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2988 |
DRIZZLE_YYABORT; |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2989 |
(session->lex->current_select->with_wild)++; |
1
by brian
clean slate |
2990 |
}
|
2991 |
;
|
|
2992 |
||
2993 |
select_item: |
|
2994 |
remember_name table_wild remember_end |
|
2995 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2996 |
Session *session= YYSession; |
1
by brian
clean slate |
2997 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2998 |
if (add_item_to_list(session, $2)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2999 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3000 |
}
|
3001 |
| remember_name expr remember_end select_alias |
|
3002 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3003 |
Session *session= YYSession; |
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
3004 |
assert($1 < $3); |
1
by brian
clean slate |
3005 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3006 |
if (add_item_to_list(session, $2)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3007 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3008 |
if ($4.str) |
3009 |
{
|
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
3010 |
$2->is_autogenerated_name= false; |
1
by brian
clean slate |
3011 |
$2->set_name($4.str, $4.length, system_charset_info); |
3012 |
}
|
|
3013 |
else if (!$2->name) |
|
3014 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3015 |
$2->set_name($1, (uint) ($3 - $1), session->charset()); |
1
by brian
clean slate |
3016 |
}
|
3017 |
}
|
|
3018 |
;
|
|
3019 |
||
3020 |
remember_name: |
|
3021 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3022 |
Session *session= YYSession; |
3023 |
Lex_input_stream *lip= session->m_lip; |
|
1
by brian
clean slate |
3024 |
$$= (char*) lip->get_cpp_tok_start(); |
3025 |
}
|
|
3026 |
;
|
|
3027 |
||
3028 |
remember_end: |
|
3029 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3030 |
Session *session= YYSession; |
3031 |
Lex_input_stream *lip= session->m_lip; |
|
1
by brian
clean slate |
3032 |
$$= (char*) lip->get_cpp_tok_end(); |
3033 |
}
|
|
3034 |
;
|
|
3035 |
||
3036 |
select_alias: |
|
3037 |
/* empty */ { $$=null_lex_str;} |
|
3038 |
| AS ident { $$=$2; } |
|
3039 |
| AS TEXT_STRING_sys { $$=$2; } |
|
3040 |
| ident { $$=$1; } |
|
3041 |
| TEXT_STRING_sys { $$=$1; } |
|
3042 |
;
|
|
3043 |
||
3044 |
optional_braces: |
|
3045 |
/* empty */ {} |
|
3046 |
| '(' ')' {} |
|
3047 |
;
|
|
3048 |
||
3049 |
/* all possible expressions */ |
|
3050 |
expr: |
|
3051 |
expr or expr %prec OR_SYM |
|
3052 |
{
|
|
3053 |
/*
|
|
3054 |
Design notes: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3055 |
Do not use a manually maintained stack like session->lex->xxx_list, |
1
by brian
clean slate |
3056 |
but use the internal bison stack ($$, $1 and $3) instead. |
3057 |
Using the bison stack is: |
|
3058 |
- more robust to changes in the grammar, |
|
3059 |
- guaranteed to be in sync with the parser state, |
|
3060 |
- better for performances (no memory allocation). |
|
3061 |
*/
|
|
3062 |
Item_cond_or *item1; |
|
3063 |
Item_cond_or *item3; |
|
3064 |
if (is_cond_or($1)) |
|
3065 |
{
|
|
3066 |
item1= (Item_cond_or*) $1; |
|
3067 |
if (is_cond_or($3)) |
|
3068 |
{
|
|
3069 |
item3= (Item_cond_or*) $3; |
|
3070 |
/*
|
|
3071 |
(X1 OR X2) OR (Y1 OR Y2) ==> OR (X1, X2, Y1, Y2) |
|
3072 |
*/
|
|
3073 |
item3->add_at_head(item1->argument_list()); |
|
3074 |
$$ = $3; |
|
3075 |
}
|
|
3076 |
else
|
|
3077 |
{
|
|
3078 |
/*
|
|
3079 |
(X1 OR X2) OR Y ==> OR (X1, X2, Y) |
|
3080 |
*/
|
|
3081 |
item1->add($3); |
|
3082 |
$$ = $1; |
|
3083 |
}
|
|
3084 |
}
|
|
3085 |
else if (is_cond_or($3)) |
|
3086 |
{
|
|
3087 |
item3= (Item_cond_or*) $3; |
|
3088 |
/*
|
|
3089 |
X OR (Y1 OR Y2) ==> OR (X, Y1, Y2) |
|
3090 |
*/
|
|
3091 |
item3->add_at_head($1); |
|
3092 |
$$ = $3; |
|
3093 |
}
|
|
3094 |
else
|
|
3095 |
{
|
|
3096 |
/* X OR Y */ |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3097 |
$$ = new (YYSession->mem_root) Item_cond_or($1, $3); |
1
by brian
clean slate |
3098 |
}
|
3099 |
}
|
|
3100 |
| expr XOR expr %prec XOR |
|
3101 |
{
|
|
3102 |
/* XOR is a proprietary extension */ |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3103 |
$$ = new (YYSession->mem_root) Item_cond_xor($1, $3); |
1
by brian
clean slate |
3104 |
}
|
3105 |
| expr and expr %prec AND_SYM |
|
3106 |
{
|
|
3107 |
/* See comments in rule expr: expr or expr */ |
|
3108 |
Item_cond_and *item1; |
|
3109 |
Item_cond_and *item3; |
|
3110 |
if (is_cond_and($1)) |
|
3111 |
{
|
|
3112 |
item1= (Item_cond_and*) $1; |
|
3113 |
if (is_cond_and($3)) |
|
3114 |
{
|
|
3115 |
item3= (Item_cond_and*) $3; |
|
3116 |
/*
|
|
3117 |
(X1 AND X2) AND (Y1 AND Y2) ==> AND (X1, X2, Y1, Y2) |
|
3118 |
*/
|
|
3119 |
item3->add_at_head(item1->argument_list()); |
|
3120 |
$$ = $3; |
|
3121 |
}
|
|
3122 |
else
|
|
3123 |
{
|
|
3124 |
/*
|
|
3125 |
(X1 AND X2) AND Y ==> AND (X1, X2, Y) |
|
3126 |
*/
|
|
3127 |
item1->add($3); |
|
3128 |
$$ = $1; |
|
3129 |
}
|
|
3130 |
}
|
|
3131 |
else if (is_cond_and($3)) |
|
3132 |
{
|
|
3133 |
item3= (Item_cond_and*) $3; |
|
3134 |
/*
|
|
3135 |
X AND (Y1 AND Y2) ==> AND (X, Y1, Y2) |
|
3136 |
*/
|
|
3137 |
item3->add_at_head($1); |
|
3138 |
$$ = $3; |
|
3139 |
}
|
|
3140 |
else
|
|
3141 |
{
|
|
3142 |
/* X AND Y */ |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3143 |
$$ = new (YYSession->mem_root) Item_cond_and($1, $3); |
1
by brian
clean slate |
3144 |
}
|
3145 |
}
|
|
3146 |
| NOT_SYM expr %prec NOT_SYM |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3147 |
{ $$= negate_expression(YYSession, $2); } |
1
by brian
clean slate |
3148 |
| bool_pri IS TRUE_SYM %prec IS |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3149 |
{ $$= new (YYSession->mem_root) Item_func_istrue($1); } |
1
by brian
clean slate |
3150 |
| bool_pri IS not TRUE_SYM %prec IS |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3151 |
{ $$= new (YYSession->mem_root) Item_func_isnottrue($1); } |
1
by brian
clean slate |
3152 |
| bool_pri IS FALSE_SYM %prec IS |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3153 |
{ $$= new (YYSession->mem_root) Item_func_isfalse($1); } |
1
by brian
clean slate |
3154 |
| bool_pri IS not FALSE_SYM %prec IS |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3155 |
{ $$= new (YYSession->mem_root) Item_func_isnotfalse($1); } |
1
by brian
clean slate |
3156 |
| bool_pri IS UNKNOWN_SYM %prec IS |
3157 |
{ $$= new Item_func_isnull($1); } |
|
3158 |
| bool_pri IS not UNKNOWN_SYM %prec IS |
|
3159 |
{ $$= new Item_func_isnotnull($1); } |
|
3160 |
| bool_pri |
|
3161 |
;
|
|
3162 |
||
3163 |
bool_pri: |
|
3164 |
bool_pri IS NULL_SYM %prec IS |
|
3165 |
{ $$= new Item_func_isnull($1); } |
|
3166 |
| bool_pri IS not NULL_SYM %prec IS |
|
3167 |
{ $$= new Item_func_isnotnull($1); } |
|
3168 |
| bool_pri EQUAL_SYM predicate %prec EQUAL_SYM |
|
3169 |
{ $$= new Item_func_equal($1,$3); } |
|
3170 |
| bool_pri comp_op predicate %prec EQ |
|
3171 |
{ $$= (*$2)(0)->create($1,$3); } |
|
3172 |
| bool_pri comp_op all_or_any '(' subselect ')' %prec EQ |
|
3173 |
{ $$= all_any_subquery_creator($1, $2, $3, $5); } |
|
3174 |
| predicate |
|
3175 |
;
|
|
3176 |
||
3177 |
predicate: |
|
3178 |
bit_expr IN_SYM '(' subselect ')' |
|
3179 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3180 |
$$= new (YYSession->mem_root) Item_in_subselect($1, $4); |
1
by brian
clean slate |
3181 |
}
|
3182 |
| bit_expr not IN_SYM '(' subselect ')' |
|
3183 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3184 |
Session *session= YYSession; |
3185 |
Item *item= new (session->mem_root) Item_in_subselect($1, $5); |
|
3186 |
$$= negate_expression(session, item); |
|
1
by brian
clean slate |
3187 |
}
|
3188 |
| bit_expr IN_SYM '(' expr ')' |
|
3189 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3190 |
$$= handle_sql2003_note184_exception(YYSession, $1, true, $4); |
1
by brian
clean slate |
3191 |
}
|
3192 |
| bit_expr IN_SYM '(' expr ',' expr_list ')' |
|
3193 |
{
|
|
3194 |
$6->push_front($4); |
|
3195 |
$6->push_front($1); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3196 |
$$= new (YYSession->mem_root) Item_func_in(*$6); |
1
by brian
clean slate |
3197 |
}
|
3198 |
| bit_expr not IN_SYM '(' expr ')' |
|
3199 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3200 |
$$= handle_sql2003_note184_exception(YYSession, $1, false, $5); |
1
by brian
clean slate |
3201 |
}
|
3202 |
| bit_expr not IN_SYM '(' expr ',' expr_list ')' |
|
3203 |
{
|
|
3204 |
$7->push_front($5); |
|
3205 |
$7->push_front($1); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3206 |
Item_func_in *item = new (YYSession->mem_root) Item_func_in(*$7); |
1
by brian
clean slate |
3207 |
item->negate(); |
3208 |
$$= item; |
|
3209 |
}
|
|
3210 |
| bit_expr BETWEEN_SYM bit_expr AND_SYM predicate |
|
3211 |
{ $$= new Item_func_between($1,$3,$5); } |
|
3212 |
| bit_expr not BETWEEN_SYM bit_expr AND_SYM predicate |
|
3213 |
{
|
|
3214 |
Item_func_between *item= new Item_func_between($1,$4,$6); |
|
3215 |
item->negate(); |
|
3216 |
$$= item; |
|
3217 |
}
|
|
3218 |
| bit_expr LIKE simple_expr opt_escape |
|
3219 |
{ $$= new Item_func_like($1,$3,$4,Lex->escape_used); } |
|
3220 |
| bit_expr not LIKE simple_expr opt_escape |
|
3221 |
{ $$= new Item_func_not(new Item_func_like($1,$4,$5, Lex->escape_used)); } |
|
3222 |
| bit_expr |
|
3223 |
;
|
|
3224 |
||
3225 |
bit_expr: |
|
256
by Brian Aker
Remove BIT operations, replace with functions. |
3226 |
bit_expr '+' bit_expr %prec '+' |
1
by brian
clean slate |
3227 |
{ $$= new Item_func_plus($1,$3); } |
3228 |
| bit_expr '-' bit_expr %prec '-' |
|
3229 |
{ $$= new Item_func_minus($1,$3); } |
|
3230 |
| bit_expr '+' INTERVAL_SYM expr interval %prec '+' |
|
3231 |
{ $$= new Item_date_add_interval($1,$4,$5,0); } |
|
3232 |
| bit_expr '-' INTERVAL_SYM expr interval %prec '-' |
|
3233 |
{ $$= new Item_date_add_interval($1,$4,$5,1); } |
|
3234 |
| bit_expr '*' bit_expr %prec '*' |
|
3235 |
{ $$= new Item_func_mul($1,$3); } |
|
3236 |
| bit_expr '/' bit_expr %prec '/' |
|
3237 |
{ $$= new Item_func_div($1,$3); } |
|
3238 |
| bit_expr '%' bit_expr %prec '%' |
|
3239 |
{ $$= new Item_func_mod($1,$3); } |
|
3240 |
| bit_expr DIV_SYM bit_expr %prec DIV_SYM |
|
3241 |
{ $$= new Item_func_int_div($1,$3); } |
|
3242 |
| bit_expr MOD_SYM bit_expr %prec MOD_SYM |
|
3243 |
{ $$= new Item_func_mod($1,$3); } |
|
3244 |
| simple_expr |
|
3245 |
;
|
|
3246 |
||
3247 |
or: |
|
3248 |
OR_SYM
|
|
3249 |
;
|
|
3250 |
||
3251 |
and: |
|
3252 |
AND_SYM
|
|
3253 |
;
|
|
3254 |
||
3255 |
not: |
|
3256 |
NOT_SYM
|
|
3257 |
;
|
|
3258 |
||
3259 |
comp_op: |
|
3260 |
EQ { $$ = &comp_eq_creator; } |
|
3261 |
| GE { $$ = &comp_ge_creator; } |
|
3262 |
| GT_SYM { $$ = &comp_gt_creator; } |
|
3263 |
| LE { $$ = &comp_le_creator; } |
|
3264 |
| LT { $$ = &comp_lt_creator; } |
|
3265 |
| NE { $$ = &comp_ne_creator; } |
|
3266 |
;
|
|
3267 |
||
3268 |
all_or_any: |
|
3269 |
ALL { $$ = 1; } |
|
3270 |
| ANY_SYM { $$ = 0; } |
|
3271 |
;
|
|
3272 |
||
3273 |
simple_expr: |
|
3274 |
simple_ident
|
|
3275 |
| function_call_keyword |
|
3276 |
| function_call_nonkeyword |
|
3277 |
| function_call_generic |
|
3278 |
| function_call_conflict |
|
3279 |
| simple_expr COLLATE_SYM ident_or_text %prec NEG |
|
3280 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3281 |
Session *session= YYSession; |
3282 |
Item *i1= new (session->mem_root) Item_string($3.str, |
|
1
by brian
clean slate |
3283 |
$3.length, |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3284 |
session->charset()); |
3285 |
$$= new (session->mem_root) Item_func_set_collation($1, i1); |
|
1
by brian
clean slate |
3286 |
}
|
3287 |
| literal |
|
3288 |
| variable |
|
3289 |
| sum_expr |
|
3290 |
| '+' simple_expr %prec NEG { $$= $2; } |
|
3291 |
| '-' simple_expr %prec NEG |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3292 |
{ $$= new (YYSession->mem_root) Item_func_neg($2); } |
1
by brian
clean slate |
3293 |
| '(' subselect ')' |
3294 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3295 |
$$= new (YYSession->mem_root) Item_singlerow_subselect($2); |
1
by brian
clean slate |
3296 |
}
|
3297 |
| '(' expr ')' { $$= $2; } |
|
3298 |
| '(' expr ',' expr_list ')' |
|
3299 |
{
|
|
3300 |
$4->push_front($2); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3301 |
$$= new (YYSession->mem_root) Item_row(*$4); |
1
by brian
clean slate |
3302 |
}
|
3303 |
| ROW_SYM '(' expr ',' expr_list ')' |
|
3304 |
{
|
|
3305 |
$5->push_front($3); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3306 |
$$= new (YYSession->mem_root) Item_row(*$5); |
1
by brian
clean slate |
3307 |
}
|
3308 |
| EXISTS '(' subselect ')' |
|
3309 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3310 |
$$= new (YYSession->mem_root) Item_exists_subselect($3); |
1
by brian
clean slate |
3311 |
}
|
3312 |
| '{' ident expr '}' { $$= $3; } |
|
3313 |
| BINARY simple_expr %prec NEG |
|
3314 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3315 |
$$= create_func_cast(YYSession, $2, ITEM_CAST_CHAR, NULL, NULL, |
1
by brian
clean slate |
3316 |
&my_charset_bin); |
3317 |
}
|
|
3318 |
| CAST_SYM '(' expr AS cast_type ')' |
|
3319 |
{
|
|
3320 |
LEX *lex= Lex; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3321 |
$$= create_func_cast(YYSession, $3, $5, lex->length, lex->dec, |
1
by brian
clean slate |
3322 |
lex->charset); |
3323 |
if (!$$) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3324 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3325 |
}
|
3326 |
| CASE_SYM opt_expr when_list opt_else END |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3327 |
{ $$= new (YYSession->mem_root) Item_func_case(* $3, $2, $4 ); } |
1
by brian
clean slate |
3328 |
| CONVERT_SYM '(' expr ',' cast_type ')' |
3329 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3330 |
$$= create_func_cast(YYSession, $3, $5, Lex->length, Lex->dec, |
1
by brian
clean slate |
3331 |
Lex->charset); |
3332 |
if (!$$) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3333 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3334 |
}
|
3335 |
| DEFAULT '(' simple_ident ')' |
|
3336 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3337 |
$$= new (YYSession->mem_root) Item_default_value(Lex->current_context(), |
1
by brian
clean slate |
3338 |
$3); |
3339 |
}
|
|
3340 |
| VALUES '(' simple_ident_nospvar ')' |
|
3341 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3342 |
$$= new (YYSession->mem_root) Item_insert_value(Lex->current_context(), |
1
by brian
clean slate |
3343 |
$3); |
3344 |
}
|
|
3345 |
| INTERVAL_SYM expr interval '+' expr %prec INTERVAL_SYM |
|
3346 |
/* we cannot put interval before - */ |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3347 |
{ $$= new (YYSession->mem_root) Item_date_add_interval($5,$2,$3,0); } |
1
by brian
clean slate |
3348 |
;
|
3349 |
||
3350 |
/*
|
|
3351 |
Function call syntax using official SQL 2003 keywords. |
|
3352 |
Because the function name is an official token, |
|
3353 |
a dedicated grammar rule is needed in the parser. |
|
3354 |
There is no potential for conflicts |
|
3355 |
*/
|
|
3356 |
function_call_keyword: |
|
3357 |
CHAR_SYM '(' expr_list ')' |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3358 |
{ $$= new (YYSession->mem_root) Item_func_char(*$3); } |
1
by brian
clean slate |
3359 |
| CURRENT_USER optional_braces |
3360 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3361 |
$$= new (YYSession->mem_root) Item_func_current_user(Lex->current_context()); |
1
by brian
clean slate |
3362 |
}
|
3363 |
| DATE_SYM '(' expr ')' |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3364 |
{ $$= new (YYSession->mem_root) Item_date_typecast($3); } |
1
by brian
clean slate |
3365 |
| DAY_SYM '(' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3366 |
{ $$= new (YYSession->mem_root) Item_func_dayofmonth($3); } |
1
by brian
clean slate |
3367 |
| HOUR_SYM '(' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3368 |
{ $$= new (YYSession->mem_root) Item_func_hour($3); } |
1
by brian
clean slate |
3369 |
| INSERT '(' expr ',' expr ',' expr ',' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3370 |
{ $$= new (YYSession->mem_root) Item_func_insert($3,$5,$7,$9); } |
1
by brian
clean slate |
3371 |
| INTERVAL_SYM '(' expr ',' expr ')' %prec INTERVAL_SYM |
3372 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3373 |
Session *session= YYSession; |
3374 |
List<Item> *list= new (session->mem_root) List<Item>; |
|
1
by brian
clean slate |
3375 |
list->push_front($5); |
3376 |
list->push_front($3); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3377 |
Item_row *item= new (session->mem_root) Item_row(*list); |
3378 |
$$= new (session->mem_root) Item_func_interval(item); |
|
1
by brian
clean slate |
3379 |
}
|
3380 |
| INTERVAL_SYM '(' expr ',' expr ',' expr_list ')' %prec INTERVAL_SYM |
|
3381 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3382 |
Session *session= YYSession; |
1
by brian
clean slate |
3383 |
$7->push_front($5); |
3384 |
$7->push_front($3); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3385 |
Item_row *item= new (session->mem_root) Item_row(*$7); |
3386 |
$$= new (session->mem_root) Item_func_interval(item); |
|
1
by brian
clean slate |
3387 |
}
|
3388 |
| LEFT '(' expr ',' expr ')' |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3389 |
{ $$= new (YYSession->mem_root) Item_func_left($3,$5); } |
1
by brian
clean slate |
3390 |
| MINUTE_SYM '(' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3391 |
{ $$= new (YYSession->mem_root) Item_func_minute($3); } |
1
by brian
clean slate |
3392 |
| MONTH_SYM '(' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3393 |
{ $$= new (YYSession->mem_root) Item_func_month($3); } |
1
by brian
clean slate |
3394 |
| RIGHT '(' expr ',' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3395 |
{ $$= new (YYSession->mem_root) Item_func_right($3,$5); } |
1
by brian
clean slate |
3396 |
| SECOND_SYM '(' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3397 |
{ $$= new (YYSession->mem_root) Item_func_second($3); } |
1
by brian
clean slate |
3398 |
| TIME_SYM '(' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3399 |
{ $$= new (YYSession->mem_root) Item_time_typecast($3); } |
1
by brian
clean slate |
3400 |
| TIMESTAMP '(' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3401 |
{ $$= new (YYSession->mem_root) Item_datetime_typecast($3); } |
1
by brian
clean slate |
3402 |
| TIMESTAMP '(' expr ',' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3403 |
{ $$= new (YYSession->mem_root) Item_func_add_time($3, $5, 1, 0); } |
1
by brian
clean slate |
3404 |
| TRIM '(' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3405 |
{ $$= new (YYSession->mem_root) Item_func_trim($3); } |
1
by brian
clean slate |
3406 |
| TRIM '(' LEADING expr FROM expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3407 |
{ $$= new (YYSession->mem_root) Item_func_ltrim($6,$4); } |
1
by brian
clean slate |
3408 |
| TRIM '(' TRAILING expr FROM expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3409 |
{ $$= new (YYSession->mem_root) Item_func_rtrim($6,$4); } |
1
by brian
clean slate |
3410 |
| TRIM '(' BOTH expr FROM expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3411 |
{ $$= new (YYSession->mem_root) Item_func_trim($6,$4); } |
1
by brian
clean slate |
3412 |
| TRIM '(' LEADING FROM expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3413 |
{ $$= new (YYSession->mem_root) Item_func_ltrim($5); } |
1
by brian
clean slate |
3414 |
| TRIM '(' TRAILING FROM expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3415 |
{ $$= new (YYSession->mem_root) Item_func_rtrim($5); } |
1
by brian
clean slate |
3416 |
| TRIM '(' BOTH FROM expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3417 |
{ $$= new (YYSession->mem_root) Item_func_trim($5); } |
1
by brian
clean slate |
3418 |
| TRIM '(' expr FROM expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3419 |
{ $$= new (YYSession->mem_root) Item_func_trim($5,$3); } |
1
by brian
clean slate |
3420 |
| USER '(' ')' |
3421 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3422 |
$$= new (YYSession->mem_root) Item_func_user(); |
1
by brian
clean slate |
3423 |
}
|
3424 |
| YEAR_SYM '(' expr ')' |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3425 |
{ $$= new (YYSession->mem_root) Item_func_year($3); } |
1
by brian
clean slate |
3426 |
;
|
3427 |
||
3428 |
/*
|
|
3429 |
Function calls using non reserved keywords, with special syntaxic forms. |
|
3430 |
Dedicated grammar rules are needed because of the syntax, |
|
3431 |
but also have the potential to cause incompatibilities with other |
|
3432 |
parts of the language. |
|
3433 |
MAINTAINER: |
|
3434 |
The only reasons a function should be added here are: |
|
3435 |
- for compatibility reasons with another SQL syntax (CURDATE), |
|
3436 |
- for typing reasons (GET_FORMAT) |
|
3437 |
Any other 'Syntaxic sugar' enhancements should be *STRONGLY* |
|
3438 |
discouraged. |
|
3439 |
*/
|
|
3440 |
function_call_nonkeyword: |
|
3441 |
ADDDATE_SYM '(' expr ',' expr ')' |
|
3442 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3443 |
$$= new (YYSession->mem_root) Item_date_add_interval($3, $5, |
1
by brian
clean slate |
3444 |
INTERVAL_DAY, 0); |
3445 |
}
|
|
3446 |
| ADDDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')' |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3447 |
{ $$= new (YYSession->mem_root) Item_date_add_interval($3, $6, $7, 0); } |
1
by brian
clean slate |
3448 |
| CURDATE optional_braces |
3449 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3450 |
$$= new (YYSession->mem_root) Item_func_curdate_local(); |
1
by brian
clean slate |
3451 |
}
|
3452 |
| CURTIME optional_braces |
|
3453 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3454 |
$$= new (YYSession->mem_root) Item_func_curtime_local(); |
1
by brian
clean slate |
3455 |
}
|
3456 |
| CURTIME '(' expr ')' |
|
3457 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3458 |
$$= new (YYSession->mem_root) Item_func_curtime_local($3); |
1
by brian
clean slate |
3459 |
}
|
3460 |
| DATE_ADD_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')' %prec INTERVAL_SYM |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3461 |
{ $$= new (YYSession->mem_root) Item_date_add_interval($3,$6,$7,0); } |
1
by brian
clean slate |
3462 |
| DATE_SUB_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')' %prec INTERVAL_SYM |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3463 |
{ $$= new (YYSession->mem_root) Item_date_add_interval($3,$6,$7,1); } |
1
by brian
clean slate |
3464 |
| EXTRACT_SYM '(' interval FROM expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3465 |
{ $$=new (YYSession->mem_root) Item_extract( $3, $5); } |
1
by brian
clean slate |
3466 |
| GET_FORMAT '(' date_time_type ',' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3467 |
{ $$= new (YYSession->mem_root) Item_func_get_format($3, $5); } |
1
by brian
clean slate |
3468 |
| NOW_SYM optional_braces |
3469 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3470 |
$$= new (YYSession->mem_root) Item_func_now_local(); |
1
by brian
clean slate |
3471 |
}
|
3472 |
| NOW_SYM '(' expr ')' |
|
3473 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3474 |
$$= new (YYSession->mem_root) Item_func_now_local($3); |
1
by brian
clean slate |
3475 |
}
|
3476 |
| POSITION_SYM '(' bit_expr IN_SYM expr ')' |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3477 |
{ $$ = new (YYSession->mem_root) Item_func_locate($5,$3); } |
1
by brian
clean slate |
3478 |
| SUBDATE_SYM '(' expr ',' expr ')' |
3479 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3480 |
$$= new (YYSession->mem_root) Item_date_add_interval($3, $5, |
1
by brian
clean slate |
3481 |
INTERVAL_DAY, 1); |
3482 |
}
|
|
3483 |
| SUBDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')' |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3484 |
{ $$= new (YYSession->mem_root) Item_date_add_interval($3, $6, $7, 1); } |
1
by brian
clean slate |
3485 |
| SUBSTRING '(' expr ',' expr ',' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3486 |
{ $$= new (YYSession->mem_root) Item_func_substr($3,$5,$7); } |
1
by brian
clean slate |
3487 |
| SUBSTRING '(' expr ',' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3488 |
{ $$= new (YYSession->mem_root) Item_func_substr($3,$5); } |
1
by brian
clean slate |
3489 |
| SUBSTRING '(' expr FROM expr FOR_SYM expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3490 |
{ $$= new (YYSession->mem_root) Item_func_substr($3,$5,$7); } |
1
by brian
clean slate |
3491 |
| SUBSTRING '(' expr FROM expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3492 |
{ $$= new (YYSession->mem_root) Item_func_substr($3,$5); } |
1
by brian
clean slate |
3493 |
| SYSDATE optional_braces |
3494 |
{
|
|
3495 |
if (global_system_variables.sysdate_is_now == 0) |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3496 |
$$= new (YYSession->mem_root) Item_func_sysdate_local(); |
1
by brian
clean slate |
3497 |
else
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3498 |
$$= new (YYSession->mem_root) Item_func_now_local(); |
1
by brian
clean slate |
3499 |
}
|
3500 |
| SYSDATE '(' expr ')' |
|
3501 |
{
|
|
3502 |
if (global_system_variables.sysdate_is_now == 0) |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3503 |
$$= new (YYSession->mem_root) Item_func_sysdate_local($3); |
1
by brian
clean slate |
3504 |
else
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3505 |
$$= new (YYSession->mem_root) Item_func_now_local($3); |
1
by brian
clean slate |
3506 |
}
|
3507 |
| TIMESTAMP_ADD '(' interval_time_stamp ',' expr ',' expr ')' |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3508 |
{ $$= new (YYSession->mem_root) Item_date_add_interval($7,$5,$3,0); } |
1
by brian
clean slate |
3509 |
| TIMESTAMP_DIFF '(' interval_time_stamp ',' expr ',' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3510 |
{ $$= new (YYSession->mem_root) Item_func_timestamp_diff($5,$7,$3); } |
1
by brian
clean slate |
3511 |
| UTC_DATE_SYM optional_braces |
3512 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3513 |
$$= new (YYSession->mem_root) Item_func_curdate_utc(); |
1
by brian
clean slate |
3514 |
}
|
3515 |
| UTC_TIME_SYM optional_braces |
|
3516 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3517 |
$$= new (YYSession->mem_root) Item_func_curtime_utc(); |
1
by brian
clean slate |
3518 |
}
|
3519 |
| UTC_TIMESTAMP_SYM optional_braces |
|
3520 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3521 |
$$= new (YYSession->mem_root) Item_func_now_utc(); |
1
by brian
clean slate |
3522 |
}
|
3523 |
;
|
|
3524 |
||
3525 |
/*
|
|
3526 |
Functions calls using a non reserved keyword, and using a regular syntax. |
|
3527 |
Because the non reserved keyword is used in another part of the grammar, |
|
3528 |
a dedicated rule is needed here. |
|
3529 |
*/
|
|
3530 |
function_call_conflict: |
|
3531 |
ASCII_SYM '(' expr ')' |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3532 |
{ $$= new (YYSession->mem_root) Item_func_ascii($3); } |
1
by brian
clean slate |
3533 |
| COALESCE '(' expr_list ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3534 |
{ $$= new (YYSession->mem_root) Item_func_coalesce(* $3); } |
1
by brian
clean slate |
3535 |
| COLLATION_SYM '(' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3536 |
{ $$= new (YYSession->mem_root) Item_func_collation($3); } |
1
by brian
clean slate |
3537 |
| DATABASE '(' ')' |
3538 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3539 |
$$= new (YYSession->mem_root) Item_func_database(); |
1
by brian
clean slate |
3540 |
}
|
3541 |
| IF '(' expr ',' expr ',' expr ')' |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3542 |
{ $$= new (YYSession->mem_root) Item_func_if($3,$5,$7); } |
1
by brian
clean slate |
3543 |
| MICROSECOND_SYM '(' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3544 |
{ $$= new (YYSession->mem_root) Item_func_microsecond($3); } |
1
by brian
clean slate |
3545 |
| MOD_SYM '(' expr ',' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3546 |
{ $$ = new (YYSession->mem_root) Item_func_mod( $3, $5); } |
1
by brian
clean slate |
3547 |
| QUARTER_SYM '(' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3548 |
{ $$ = new (YYSession->mem_root) Item_func_quarter($3); } |
1
by brian
clean slate |
3549 |
| REPEAT_SYM '(' expr ',' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3550 |
{ $$= new (YYSession->mem_root) Item_func_repeat($3,$5); } |
1
by brian
clean slate |
3551 |
| REPLACE '(' expr ',' expr ',' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3552 |
{ $$= new (YYSession->mem_root) Item_func_replace($3,$5,$7); } |
1
by brian
clean slate |
3553 |
| REVERSE_SYM '(' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3554 |
{ $$= new (YYSession->mem_root) Item_func_reverse($3); } |
1
by brian
clean slate |
3555 |
| TRUNCATE_SYM '(' expr ',' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3556 |
{ $$= new (YYSession->mem_root) Item_func_round($3,$5,1); } |
1
by brian
clean slate |
3557 |
| WEEK_SYM '(' expr ')' |
3558 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3559 |
Session *session= YYSession; |
3560 |
Item *i1= new (session->mem_root) Item_int((char*) "0", |
|
3561 |
session->variables.default_week_format, |
|
1
by brian
clean slate |
3562 |
1); |
3563 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
3564 |
$$= new (session->mem_root) Item_func_week($3, i1); |
1
by brian
clean slate |
3565 |
}
|
3566 |
| WEEK_SYM '(' expr ',' expr ')' |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3567 |
{ $$= new (YYSession->mem_root) Item_func_week($3,$5); } |
1
by brian
clean slate |
3568 |
| WEIGHT_STRING_SYM '(' expr opt_ws_levels ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3569 |
{ $$= new (YYSession->mem_root) Item_func_weight_string($3, 0, $4); } |
1
by brian
clean slate |
3570 |
| WEIGHT_STRING_SYM '(' expr AS CHAR_SYM ws_nweights opt_ws_levels ')' |
3571 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3572 |
$$= new (YYSession->mem_root) |
1
by brian
clean slate |
3573 |
Item_func_weight_string($3, $6, $7|MY_STRXFRM_PAD_WITH_SPACE); |
3574 |
}
|
|
3575 |
| WEIGHT_STRING_SYM '(' expr AS BINARY ws_nweights ')' |
|
3576 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3577 |
$3= create_func_char_cast(YYSession, $3, $6, &my_charset_bin); |
3578 |
$$= new (YYSession->mem_root) |
|
1
by brian
clean slate |
3579 |
Item_func_weight_string($3, $6, MY_STRXFRM_PAD_WITH_SPACE); |
3580 |
}
|
|
3581 |
;
|
|
3582 |
||
3583 |
/*
|
|
3584 |
Regular function calls. |
|
3585 |
The function name is *not* a token, and therefore is guaranteed to not |
|
3586 |
introduce side effects to the language in general. |
|
3587 |
MAINTAINER: |
|
3588 |
All the new functions implemented for new features should fit into |
|
3589 |
this category. The place to implement the function itself is |
|
3590 |
in sql/item_create.cc |
|
3591 |
*/
|
|
3592 |
function_call_generic: |
|
3593 |
IDENT_sys '(' |
|
3594 |
{
|
|
3595 |
udf_func *udf= 0; |
|
139.1.8
by Stewart Smith
UDFs are now normal Item_func objects. Simplifies handling them a lot. |
3596 |
udf= find_udf($1.str, $1.length); |
3597 |
||
1
by brian
clean slate |
3598 |
/* Temporary placing the result of find_udf in $3 */ |
3599 |
$<udf>$= udf; |
|
3600 |
}
|
|
3601 |
opt_udf_expr_list ')' |
|
3602 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3603 |
Session *session= YYSession; |
1
by brian
clean slate |
3604 |
Create_func *builder; |
3605 |
Item *item= NULL; |
|
3606 |
||
3607 |
/*
|
|
3608 |
Implementation note: |
|
3609 |
names are resolved with the following order: |
|
3610 |
- MySQL native functions, |
|
3611 |
- User Defined Functions, |
|
3612 |
- Stored Functions (assuming the current <use> database) |
|
3613 |
||
3614 |
This will be revised with WL#2128 (SQL PATH) |
|
3615 |
*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3616 |
builder= find_native_function_builder(session, $1); |
1
by brian
clean slate |
3617 |
if (builder) |
3618 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3619 |
item= builder->create(session, $1, $4); |
1
by brian
clean slate |
3620 |
}
|
3621 |
else
|
|
3622 |
{
|
|
3623 |
/* Retrieving the result of find_udf */ |
|
3624 |
udf_func *udf= $<udf>3; |
|
134.1.1
by Mark Atwood
more hackery to get plugin UDFs working |
3625 |
if (udf) |
1
by brian
clean slate |
3626 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3627 |
item= Create_udf_func::s_singleton.create(session, udf, $4); |
258.1.1
by Mark Atwood
fix for bug 250065 from Andrew Garner <muzazzi@gmail.com> |
3628 |
} else { |
3629 |
/* fix for bug 250065, from Andrew Garner <muzazzi@gmail.com> */ |
|
3630 |
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", $1.str); |
|
1
by brian
clean slate |
3631 |
}
|
3632 |
}
|
|
3633 |
||
3634 |
if (! ($$= item)) |
|
3635 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3636 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3637 |
}
|
3638 |
}
|
|
3639 |
;
|
|
3640 |
||
3641 |
opt_udf_expr_list: |
|
3642 |
/* empty */ { $$= NULL; } |
|
3643 |
| udf_expr_list { $$= $1; } |
|
3644 |
;
|
|
3645 |
||
3646 |
udf_expr_list: |
|
3647 |
udf_expr
|
|
3648 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3649 |
$$= new (YYSession->mem_root) List<Item>; |
1
by brian
clean slate |
3650 |
$$->push_back($1); |
3651 |
}
|
|
3652 |
| udf_expr_list ',' udf_expr |
|
3653 |
{
|
|
3654 |
$1->push_back($3); |
|
3655 |
$$= $1; |
|
3656 |
}
|
|
3657 |
;
|
|
3658 |
||
3659 |
udf_expr: |
|
3660 |
remember_name expr remember_end select_alias |
|
3661 |
{
|
|
3662 |
/*
|
|
3663 |
Use Item::name as a storage for the attribute value of user |
|
3664 |
defined function argument. It is safe to use Item::name |
|
3665 |
because the syntax will not allow having an explicit name here. |
|
3666 |
See WL#1017 re. udf attributes. |
|
3667 |
*/
|
|
3668 |
if ($4.str) |
|
3669 |
{
|
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
3670 |
$2->is_autogenerated_name= false; |
1
by brian
clean slate |
3671 |
$2->set_name($4.str, $4.length, system_charset_info); |
3672 |
}
|
|
3673 |
else
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3674 |
$2->set_name($1, (uint) ($3 - $1), YYSession->charset()); |
1
by brian
clean slate |
3675 |
$$= $2; |
3676 |
}
|
|
3677 |
;
|
|
3678 |
||
3679 |
sum_expr: |
|
3680 |
AVG_SYM '(' in_sum_expr ')' |
|
3681 |
{ $$=new Item_sum_avg($3); } |
|
3682 |
| AVG_SYM '(' DISTINCT in_sum_expr ')' |
|
3683 |
{ $$=new Item_sum_avg_distinct($4); } |
|
3684 |
| COUNT_SYM '(' opt_all '*' ')' |
|
205
by Brian Aker
uint32 -> uin32_t |
3685 |
{ $$=new Item_sum_count(new Item_int((int32_t) 0L,1)); } |
1
by brian
clean slate |
3686 |
| COUNT_SYM '(' in_sum_expr ')' |
3687 |
{ $$=new Item_sum_count($3); } |
|
3688 |
| COUNT_SYM '(' DISTINCT |
|
3689 |
{ Select->in_sum_expr++; } |
|
3690 |
expr_list
|
|
3691 |
{ Select->in_sum_expr--; } |
|
3692 |
')'
|
|
3693 |
{ $$=new Item_sum_count_distinct(* $5); } |
|
3694 |
| MIN_SYM '(' in_sum_expr ')' |
|
3695 |
{ $$=new Item_sum_min($3); } |
|
3696 |
/*
|
|
3697 |
According to ANSI SQL, DISTINCT is allowed and has |
|
3698 |
no sense inside MIN and MAX grouping functions; so MIN|MAX(DISTINCT ...) |
|
3699 |
is processed like an ordinary MIN | MAX() |
|
3700 |
*/
|
|
3701 |
| MIN_SYM '(' DISTINCT in_sum_expr ')' |
|
3702 |
{ $$=new Item_sum_min($4); } |
|
3703 |
| MAX_SYM '(' in_sum_expr ')' |
|
3704 |
{ $$=new Item_sum_max($3); } |
|
3705 |
| MAX_SYM '(' DISTINCT in_sum_expr ')' |
|
3706 |
{ $$=new Item_sum_max($4); } |
|
3707 |
| STD_SYM '(' in_sum_expr ')' |
|
3708 |
{ $$=new Item_sum_std($3, 0); } |
|
3709 |
| VARIANCE_SYM '(' in_sum_expr ')' |
|
3710 |
{ $$=new Item_sum_variance($3, 0); } |
|
3711 |
| STDDEV_SAMP_SYM '(' in_sum_expr ')' |
|
3712 |
{ $$=new Item_sum_std($3, 1); } |
|
3713 |
| VAR_SAMP_SYM '(' in_sum_expr ')' |
|
3714 |
{ $$=new Item_sum_variance($3, 1); } |
|
3715 |
| SUM_SYM '(' in_sum_expr ')' |
|
3716 |
{ $$=new Item_sum_sum($3); } |
|
3717 |
| SUM_SYM '(' DISTINCT in_sum_expr ')' |
|
3718 |
{ $$=new Item_sum_sum_distinct($4); } |
|
3719 |
| GROUP_CONCAT_SYM '(' opt_distinct |
|
3720 |
{ Select->in_sum_expr++; } |
|
3721 |
expr_list opt_gorder_clause |
|
3722 |
opt_gconcat_separator
|
|
3723 |
')'
|
|
3724 |
{
|
|
3725 |
SELECT_LEX *sel= Select; |
|
3726 |
sel->in_sum_expr--; |
|
3727 |
$$=new Item_func_group_concat(Lex->current_context(), $3, $5, |
|
3728 |
sel->gorder_list, $7); |
|
3729 |
$5->empty(); |
|
3730 |
}
|
|
3731 |
;
|
|
3732 |
||
3733 |
variable: |
|
3734 |
'@'
|
|
3735 |
{
|
|
3736 |
if (! Lex->parsing_options.allows_variable) |
|
3737 |
{
|
|
3738 |
my_error(ER_VIEW_SELECT_VARIABLE, MYF(0)); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3739 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3740 |
}
|
3741 |
}
|
|
3742 |
variable_aux
|
|
3743 |
{
|
|
3744 |
$$= $3; |
|
3745 |
}
|
|
3746 |
;
|
|
3747 |
||
3748 |
variable_aux: |
|
3749 |
ident_or_text SET_VAR expr |
|
3750 |
{
|
|
3751 |
$$= new Item_func_set_user_var($1, $3); |
|
3752 |
}
|
|
3753 |
| ident_or_text |
|
3754 |
{
|
|
3755 |
$$= new Item_func_get_user_var($1); |
|
3756 |
}
|
|
3757 |
| '@' opt_var_ident_type ident_or_text opt_component |
|
3758 |
{
|
|
3759 |
/* disallow "SELECT @@global.global.variable" */ |
|
3760 |
if ($3.str && $4.str && check_reserved_words(&$3)) |
|
3761 |
{
|
|
3762 |
my_parse_error(ER(ER_SYNTAX_ERROR)); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3763 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3764 |
}
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3765 |
if (!($$= get_system_var(YYSession, $2, $3, $4))) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3766 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3767 |
}
|
3768 |
;
|
|
3769 |
||
3770 |
opt_distinct: |
|
3771 |
/* empty */ { $$ = 0; } |
|
3772 |
| DISTINCT { $$ = 1; } |
|
3773 |
;
|
|
3774 |
||
3775 |
opt_gconcat_separator: |
|
3776 |
/* empty */ |
|
3777 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3778 |
$$= new (YYSession->mem_root) String(",", 1, &my_charset_utf8_general_ci); |
1
by brian
clean slate |
3779 |
}
|
3780 |
| SEPARATOR_SYM text_string { $$ = $2; } |
|
3781 |
;
|
|
3782 |
||
3783 |
opt_gorder_clause: |
|
3784 |
/* empty */ |
|
3785 |
{
|
|
3786 |
Select->gorder_list = NULL; |
|
3787 |
}
|
|
3788 |
| order_clause |
|
3789 |
{
|
|
3790 |
SELECT_LEX *select= Select; |
|
3791 |
select->gorder_list= |
|
3792 |
(SQL_LIST*) sql_memdup((char*) &select->order_list, |
|
3793 |
sizeof(st_sql_list)); |
|
3794 |
select->order_list.empty(); |
|
3795 |
}
|
|
3796 |
;
|
|
3797 |
||
3798 |
in_sum_expr: |
|
3799 |
opt_all
|
|
3800 |
{
|
|
3801 |
LEX *lex= Lex; |
|
3802 |
if (lex->current_select->inc_in_sum_expr()) |
|
3803 |
{
|
|
3804 |
my_parse_error(ER(ER_SYNTAX_ERROR)); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3805 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3806 |
}
|
3807 |
}
|
|
3808 |
expr
|
|
3809 |
{
|
|
3810 |
Select->in_sum_expr--; |
|
3811 |
$$= $3; |
|
3812 |
}
|
|
3813 |
;
|
|
3814 |
||
3815 |
cast_type: |
|
3816 |
BINARY opt_len |
|
3817 |
{ $$=ITEM_CAST_CHAR; Lex->charset= &my_charset_bin; Lex->dec= 0; } |
|
3818 |
| CHAR_SYM opt_len opt_binary |
|
3819 |
{ $$=ITEM_CAST_CHAR; Lex->dec= 0; } |
|
3820 |
| DATE_SYM |
|
3821 |
{ $$=ITEM_CAST_DATE; Lex->charset= NULL; Lex->dec=Lex->length= (char*)0; } |
|
3822 |
| TIME_SYM |
|
3823 |
{ $$=ITEM_CAST_TIME; Lex->charset= NULL; Lex->dec=Lex->length= (char*)0; } |
|
3824 |
| DATETIME |
|
3825 |
{ $$=ITEM_CAST_DATETIME; Lex->charset= NULL; Lex->dec=Lex->length= (char*)0; } |
|
3826 |
| DECIMAL_SYM float_options |
|
3827 |
{ $$=ITEM_CAST_DECIMAL; Lex->charset= NULL; } |
|
3828 |
;
|
|
3829 |
||
3830 |
expr_list: |
|
3831 |
expr
|
|
3832 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3833 |
$$= new (YYSession->mem_root) List<Item>; |
1
by brian
clean slate |
3834 |
$$->push_back($1); |
3835 |
}
|
|
3836 |
| expr_list ',' expr |
|
3837 |
{
|
|
3838 |
$1->push_back($3); |
|
3839 |
$$= $1; |
|
3840 |
}
|
|
3841 |
;
|
|
3842 |
||
3843 |
opt_expr: |
|
3844 |
/* empty */ { $$= NULL; } |
|
3845 |
| expr { $$= $1; } |
|
3846 |
;
|
|
3847 |
||
3848 |
opt_else: |
|
3849 |
/* empty */ { $$= NULL; } |
|
3850 |
| ELSE expr { $$= $2; } |
|
3851 |
;
|
|
3852 |
||
3853 |
when_list: |
|
3854 |
WHEN_SYM expr THEN_SYM expr |
|
3855 |
{
|
|
3856 |
$$= new List<Item>; |
|
3857 |
$$->push_back($2); |
|
3858 |
$$->push_back($4); |
|
3859 |
}
|
|
3860 |
| when_list WHEN_SYM expr THEN_SYM expr |
|
3861 |
{
|
|
3862 |
$1->push_back($3); |
|
3863 |
$1->push_back($5); |
|
3864 |
$$= $1; |
|
3865 |
}
|
|
3866 |
;
|
|
3867 |
||
3868 |
/* Equivalent to <table reference> in the SQL:2003 standard. */ |
|
3869 |
/* Warning - may return NULL in case of incomplete SELECT */ |
|
3870 |
table_ref: |
|
3871 |
table_factor { $$=$1; } |
|
3872 |
| join_table |
|
3873 |
{
|
|
3874 |
LEX *lex= Lex; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3875 |
if (!($$= lex->current_select->nest_last_join(lex->session))) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3876 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3877 |
}
|
3878 |
;
|
|
3879 |
||
3880 |
join_table_list: |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3881 |
derived_table_list { DRIZZLE_YYABORT_UNLESS($$=$1); } |
1
by brian
clean slate |
3882 |
;
|
3883 |
||
3884 |
/*
|
|
3885 |
The ODBC escape syntax for Outer Join is: '{' OJ join_table '}' |
|
3886 |
The parser does not define OJ as a token, any ident is accepted |
|
3887 |
instead in $2 (ident). Also, all productions from table_ref can |
|
3888 |
be escaped, not only join_table. Both syntax extensions are safe |
|
3889 |
and are ignored. |
|
3890 |
*/
|
|
3891 |
esc_table_ref: |
|
3892 |
table_ref { $$=$1; } |
|
3893 |
| '{' ident table_ref '}' { $$=$3; } |
|
3894 |
;
|
|
3895 |
||
3896 |
/* Equivalent to <table reference list> in the SQL:2003 standard. */ |
|
3897 |
/* Warning - may return NULL in case of incomplete SELECT */ |
|
3898 |
derived_table_list: |
|
3899 |
esc_table_ref { $$=$1; } |
|
3900 |
| derived_table_list ',' esc_table_ref |
|
3901 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3902 |
DRIZZLE_YYABORT_UNLESS($1 && ($$=$3)); |
1
by brian
clean slate |
3903 |
}
|
3904 |
;
|
|
3905 |
||
3906 |
/*
|
|
3907 |
Notice that JOIN is a left-associative operation, and it must be parsed |
|
3908 |
as such, that is, the parser must process first the left join operand |
|
3909 |
then the right one. Such order of processing ensures that the parser |
|
3910 |
produces correct join trees which is essential for semantic analysis |
|
3911 |
and subsequent optimization phases. |
|
3912 |
*/
|
|
3913 |
join_table: |
|
3914 |
/* INNER JOIN variants */ |
|
3915 |
/*
|
|
3916 |
Use %prec to evaluate production 'table_ref' before 'normal_join' |
|
3917 |
so that [INNER | CROSS] JOIN is properly nested as other |
|
3918 |
left-associative joins. |
|
3919 |
*/
|
|
3920 |
table_ref normal_join table_ref %prec TABLE_REF_PRIORITY |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3921 |
{ DRIZZLE_YYABORT_UNLESS($1 && ($$=$3)); } |
1
by brian
clean slate |
3922 |
| table_ref STRAIGHT_JOIN table_factor |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3923 |
{ DRIZZLE_YYABORT_UNLESS($1 && ($$=$3)); $3->straight=1; } |
1
by brian
clean slate |
3924 |
| table_ref normal_join table_ref |
3925 |
ON
|
|
3926 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3927 |
DRIZZLE_YYABORT_UNLESS($1 && $3); |
1
by brian
clean slate |
3928 |
/* Change the current name resolution context to a local context. */ |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3929 |
if (push_new_name_resolution_context(YYSession, $1, $3)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3930 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3931 |
Select->parsing_place= IN_ON; |
3932 |
}
|
|
3933 |
expr
|
|
3934 |
{
|
|
3935 |
add_join_on($3,$6); |
|
3936 |
Lex->pop_context(); |
|
3937 |
Select->parsing_place= NO_MATTER; |
|
3938 |
}
|
|
3939 |
| table_ref STRAIGHT_JOIN table_factor |
|
3940 |
ON
|
|
3941 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3942 |
DRIZZLE_YYABORT_UNLESS($1 && $3); |
1
by brian
clean slate |
3943 |
/* Change the current name resolution context to a local context. */ |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3944 |
if (push_new_name_resolution_context(YYSession, $1, $3)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3945 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3946 |
Select->parsing_place= IN_ON; |
3947 |
}
|
|
3948 |
expr
|
|
3949 |
{
|
|
3950 |
$3->straight=1; |
|
3951 |
add_join_on($3,$6); |
|
3952 |
Lex->pop_context(); |
|
3953 |
Select->parsing_place= NO_MATTER; |
|
3954 |
}
|
|
3955 |
| table_ref normal_join table_ref |
|
3956 |
USING
|
|
3957 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3958 |
DRIZZLE_YYABORT_UNLESS($1 && $3); |
1
by brian
clean slate |
3959 |
}
|
3960 |
'(' using_list ')' |
|
3961 |
{ add_join_natural($1,$3,$7,Select); $$=$3; } |
|
3962 |
| table_ref NATURAL JOIN_SYM table_factor |
|
3963 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3964 |
DRIZZLE_YYABORT_UNLESS($1 && ($$=$4)); |
1
by brian
clean slate |
3965 |
add_join_natural($1,$4,NULL,Select); |
3966 |
}
|
|
3967 |
||
3968 |
/* LEFT JOIN variants */ |
|
3969 |
| table_ref LEFT opt_outer JOIN_SYM table_ref |
|
3970 |
ON
|
|
3971 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3972 |
DRIZZLE_YYABORT_UNLESS($1 && $5); |
1
by brian
clean slate |
3973 |
/* Change the current name resolution context to a local context. */ |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3974 |
if (push_new_name_resolution_context(YYSession, $1, $5)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3975 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3976 |
Select->parsing_place= IN_ON; |
3977 |
}
|
|
3978 |
expr
|
|
3979 |
{
|
|
3980 |
add_join_on($5,$8); |
|
3981 |
Lex->pop_context(); |
|
3982 |
$5->outer_join|=JOIN_TYPE_LEFT; |
|
3983 |
$$=$5; |
|
3984 |
Select->parsing_place= NO_MATTER; |
|
3985 |
}
|
|
3986 |
| table_ref LEFT opt_outer JOIN_SYM table_factor |
|
3987 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3988 |
DRIZZLE_YYABORT_UNLESS($1 && $5); |
1
by brian
clean slate |
3989 |
}
|
3990 |
USING '(' using_list ')' |
|
3991 |
{
|
|
3992 |
add_join_natural($1,$5,$9,Select); |
|
3993 |
$5->outer_join|=JOIN_TYPE_LEFT; |
|
3994 |
$$=$5; |
|
3995 |
}
|
|
3996 |
| table_ref NATURAL LEFT opt_outer JOIN_SYM table_factor |
|
3997 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3998 |
DRIZZLE_YYABORT_UNLESS($1 && $6); |
1
by brian
clean slate |
3999 |
add_join_natural($1,$6,NULL,Select); |
4000 |
$6->outer_join|=JOIN_TYPE_LEFT; |
|
4001 |
$$=$6; |
|
4002 |
}
|
|
4003 |
||
4004 |
/* RIGHT JOIN variants */ |
|
4005 |
| table_ref RIGHT opt_outer JOIN_SYM table_ref |
|
4006 |
ON
|
|
4007 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4008 |
DRIZZLE_YYABORT_UNLESS($1 && $5); |
1
by brian
clean slate |
4009 |
/* Change the current name resolution context to a local context. */ |
520.1.22
by Brian Aker
Second pass of thd cleanup |
4010 |
if (push_new_name_resolution_context(YYSession, $1, $5)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4011 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4012 |
Select->parsing_place= IN_ON; |
4013 |
}
|
|
4014 |
expr
|
|
4015 |
{
|
|
4016 |
LEX *lex= Lex; |
|
4017 |
if (!($$= lex->current_select->convert_right_join())) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4018 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4019 |
add_join_on($$, $8); |
4020 |
Lex->pop_context(); |
|
4021 |
Select->parsing_place= NO_MATTER; |
|
4022 |
}
|
|
4023 |
| table_ref RIGHT opt_outer JOIN_SYM table_factor |
|
4024 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4025 |
DRIZZLE_YYABORT_UNLESS($1 && $5); |
1
by brian
clean slate |
4026 |
}
|
4027 |
USING '(' using_list ')' |
|
4028 |
{
|
|
4029 |
LEX *lex= Lex; |
|
4030 |
if (!($$= lex->current_select->convert_right_join())) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4031 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4032 |
add_join_natural($$,$5,$9,Select); |
4033 |
}
|
|
4034 |
| table_ref NATURAL RIGHT opt_outer JOIN_SYM table_factor |
|
4035 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4036 |
DRIZZLE_YYABORT_UNLESS($1 && $6); |
1
by brian
clean slate |
4037 |
add_join_natural($6,$1,NULL,Select); |
4038 |
LEX *lex= Lex; |
|
4039 |
if (!($$= lex->current_select->convert_right_join())) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4040 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4041 |
}
|
4042 |
;
|
|
4043 |
||
4044 |
normal_join: |
|
4045 |
JOIN_SYM {} |
|
4046 |
| INNER_SYM JOIN_SYM {} |
|
4047 |
| CROSS JOIN_SYM {} |
|
4048 |
;
|
|
4049 |
||
4050 |
/*
|
|
4051 |
This is a flattening of the rules <table factor> and <table primary> |
|
4052 |
in the SQL:2003 standard, since we don't have <sample clause> |
|
4053 |
||
4054 |
I.e.
|
|
4055 |
<table factor> ::= <table primary> [ <sample clause> ]
|
|
4056 |
*/
|
|
4057 |
/* Warning - may return NULL in case of incomplete SELECT */
|
|
4058 |
table_factor:
|
|
4059 |
{
|
|
4060 |
SELECT_LEX *sel= Select;
|
|
4061 |
sel->table_join_options= 0;
|
|
4062 |
}
|
|
4063 |
table_ident opt_table_alias opt_key_definition
|
|
4064 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
4065 |
if (!($$= Select->add_table_to_list(YYSession, $2, $3,
|
1
by brian
clean slate |
4066 |
Select->get_table_join_options(),
|
4067 |
Lex->lock_option,
|
|
4068 |
Select->pop_index_hints())))
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4069 |
DRIZZLE_YYABORT;
|
1
by brian
clean slate |
4070 |
Select->add_joined_table($$);
|
4071 |
}
|
|
4072 |
| select_derived_init get_select_lex select_derived2
|
|
4073 |
{
|
|
4074 |
LEX *lex= Lex;
|
|
4075 |
SELECT_LEX *sel= lex->current_select;
|
|
4076 |
if ($1)
|
|
4077 |
{
|
|
4078 |
if (sel->set_braces(1))
|
|
4079 |
{
|
|
4080 |
my_parse_error(ER(ER_SYNTAX_ERROR));
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4081 |
DRIZZLE_YYABORT;
|
1
by brian
clean slate |
4082 |
}
|
4083 |
/* select in braces, can't contain global parameters */ |
|
4084 |
if (sel->master_unit()->fake_select_lex) |
|
4085 |
sel->master_unit()->global_parameters= |
|
4086 |
sel->master_unit()->fake_select_lex; |
|
4087 |
}
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
4088 |
if ($2->init_nested_join(lex->session)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4089 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4090 |
$$= 0; |
4091 |
/* incomplete derived tables return NULL, we must be |
|
4092 |
nested in select_derived rule to be here. */ |
|
4093 |
}
|
|
4094 |
/*
|
|
4095 |
Represents a flattening of the following rules from the SQL:2003 |
|
4096 |
standard. This sub-rule corresponds to the sub-rule |
|
4097 |
<table primary> ::= ... | <derived table> [ AS ] <correlation name> |
|
4098 |
||
4099 |
The following rules have been flattened into query_expression_body |
|
4100 |
(since we have no <with clause>). |
|
4101 |
||
4102 |
<derived table> ::= <table subquery> |
|
4103 |
<table subquery> ::= <subquery> |
|
4104 |
<subquery> ::= <left paren> <query expression> <right paren> |
|
4105 |
<query expression> ::= [ <with clause> ] <query expression body> |
|
4106 |
||
4107 |
For the time being we use the non-standard rule |
|
4108 |
select_derived_union which is a compromise between the standard |
|
4109 |
and our parser. Possibly this rule could be replaced by our |
|
4110 |
query_expression_body. |
|
4111 |
*/
|
|
4112 |
| '(' get_select_lex select_derived_union ')' opt_table_alias |
|
4113 |
{
|
|
4114 |
/* Use $2 instead of Lex->current_select as derived table will |
|
4115 |
alter value of Lex->current_select. */ |
|
4116 |
if (!($3 || $5) && $2->embedding && |
|
4117 |
!$2->embedding->nested_join->join_list.elements) |
|
4118 |
{
|
|
4119 |
/* we have a derived table ($3 == NULL) but no alias, |
|
4120 |
Since we are nested in further parentheses so we |
|
4121 |
can pass NULL to the outer level parentheses |
|
4122 |
Permits parsing of "((((select ...))) as xyz)" */ |
|
4123 |
$$= 0; |
|
4124 |
}
|
|
4125 |
else if (!$3) |
|
4126 |
{
|
|
4127 |
/* Handle case of derived table, alias may be NULL if there |
|
4128 |
are no outer parentheses, add_table_to_list() will throw |
|
4129 |
error in this case */ |
|
4130 |
LEX *lex=Lex; |
|
4131 |
SELECT_LEX *sel= lex->current_select; |
|
4132 |
SELECT_LEX_UNIT *unit= sel->master_unit(); |
|
4133 |
lex->current_select= sel= unit->outer_select(); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
4134 |
if (!($$= sel->add_table_to_list(lex->session, |
1
by brian
clean slate |
4135 |
new Table_ident(unit), $5, 0, |
4136 |
TL_READ))) |
|
4137 |
||
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4138 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4139 |
sel->add_joined_table($$); |
4140 |
lex->pop_context(); |
|
4141 |
}
|
|
4142 |
else if (($3->select_lex && $3->select_lex->master_unit()->is_union()) || $5) |
|
4143 |
{
|
|
4144 |
/* simple nested joins cannot have aliases or unions */ |
|
4145 |
my_parse_error(ER(ER_SYNTAX_ERROR)); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4146 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4147 |
}
|
4148 |
else
|
|
4149 |
$$= $3; |
|
4150 |
}
|
|
4151 |
;
|
|
4152 |
||
4153 |
select_derived_union: |
|
4154 |
select_derived opt_order_clause opt_limit_clause |
|
4155 |
| select_derived_union |
|
4156 |
UNION_SYM
|
|
4157 |
union_option
|
|
4158 |
{
|
|
4159 |
if (add_select_to_union_list(Lex, (bool)$3)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4160 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4161 |
}
|
4162 |
query_specification
|
|
4163 |
{
|
|
4164 |
/*
|
|
4165 |
Remove from the name resolution context stack the context of the |
|
4166 |
last select in the union. |
|
4167 |
*/
|
|
4168 |
Lex->pop_context(); |
|
4169 |
}
|
|
4170 |
opt_order_clause opt_limit_clause |
|
4171 |
;
|
|
4172 |
||
4173 |
/* The equivalent of select_init2 for nested queries. */ |
|
4174 |
select_init2_derived: |
|
4175 |
select_part2_derived
|
|
4176 |
{
|
|
4177 |
LEX *lex= Lex; |
|
4178 |
SELECT_LEX * sel= lex->current_select; |
|
4179 |
if (lex->current_select->set_braces(0)) |
|
4180 |
{
|
|
4181 |
my_parse_error(ER(ER_SYNTAX_ERROR)); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4182 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4183 |
}
|
4184 |
if (sel->linkage == UNION_TYPE && |
|
4185 |
sel->master_unit()->first_select()->braces) |
|
4186 |
{
|
|
4187 |
my_parse_error(ER(ER_SYNTAX_ERROR)); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4188 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4189 |
}
|
4190 |
}
|
|
4191 |
;
|
|
4192 |
||
4193 |
/* The equivalent of select_part2 for nested queries. */ |
|
4194 |
select_part2_derived: |
|
4195 |
{
|
|
4196 |
LEX *lex= Lex; |
|
4197 |
SELECT_LEX *sel= lex->current_select; |
|
4198 |
if (sel->linkage != UNION_TYPE) |
|
4199 |
mysql_init_select(lex); |
|
4200 |
lex->current_select->parsing_place= SELECT_LIST; |
|
4201 |
}
|
|
4202 |
select_options select_item_list |
|
4203 |
{
|
|
4204 |
Select->parsing_place= NO_MATTER; |
|
4205 |
}
|
|
4206 |
opt_select_from select_lock_type |
|
4207 |
;
|
|
4208 |
||
4209 |
/* handle contents of parentheses in join expression */ |
|
4210 |
select_derived: |
|
4211 |
get_select_lex
|
|
4212 |
{
|
|
4213 |
LEX *lex= Lex; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
4214 |
if ($1->init_nested_join(lex->session)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4215 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4216 |
}
|
4217 |
derived_table_list
|
|
4218 |
{
|
|
4219 |
LEX *lex= Lex; |
|
4220 |
/* for normal joins, $3 != NULL and end_nested_join() != NULL, |
|
4221 |
for derived tables, both must equal NULL */ |
|
4222 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
4223 |
if (!($$= $1->end_nested_join(lex->session)) && $3) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4224 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4225 |
if (!$3 && $$) |
4226 |
{
|
|
4227 |
my_parse_error(ER(ER_SYNTAX_ERROR)); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4228 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4229 |
}
|
4230 |
}
|
|
4231 |
;
|
|
4232 |
||
4233 |
select_derived2: |
|
4234 |
{
|
|
4235 |
LEX *lex= Lex; |
|
4236 |
lex->derived_tables|= DERIVED_SUBQUERY; |
|
4237 |
if (!lex->expr_allows_subselect || |
|
4238 |
lex->sql_command == (int)SQLCOM_PURGE) |
|
4239 |
{
|
|
4240 |
my_parse_error(ER(ER_SYNTAX_ERROR)); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4241 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4242 |
}
|
4243 |
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE || |
|
4244 |
mysql_new_select(lex, 1)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4245 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4246 |
mysql_init_select(lex); |
4247 |
lex->current_select->linkage= DERIVED_TABLE_TYPE; |
|
4248 |
lex->current_select->parsing_place= SELECT_LIST; |
|
4249 |
}
|
|
4250 |
select_options select_item_list |
|
4251 |
{
|
|
4252 |
Select->parsing_place= NO_MATTER; |
|
4253 |
}
|
|
4254 |
opt_select_from
|
|
4255 |
;
|
|
4256 |
||
4257 |
get_select_lex: |
|
4258 |
/* Empty */ { $$= Select; } |
|
4259 |
;
|
|
4260 |
||
4261 |
select_derived_init: |
|
4262 |
SELECT_SYM
|
|
4263 |
{
|
|
4264 |
LEX *lex= Lex; |
|
4265 |
||
4266 |
if (! lex->parsing_options.allows_derived) |
|
4267 |
{
|
|
4268 |
my_error(ER_VIEW_SELECT_DERIVED, MYF(0)); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4269 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4270 |
}
|
4271 |
||
4272 |
SELECT_LEX *sel= lex->current_select; |
|
327.2.5
by Brian Aker
Refactoring show command |
4273 |
TableList *embedding; |
520.1.22
by Brian Aker
Second pass of thd cleanup |
4274 |
if (!sel->embedding || sel->end_nested_join(lex->session)) |
1
by brian
clean slate |
4275 |
{
|
4276 |
/* we are not in parentheses */ |
|
4277 |
my_parse_error(ER(ER_SYNTAX_ERROR)); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4278 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4279 |
}
|
4280 |
embedding= Select->embedding; |
|
4281 |
$$= embedding && |
|
4282 |
!embedding->nested_join->join_list.elements; |
|
4283 |
/* return true if we are deeply nested */ |
|
4284 |
}
|
|
4285 |
;
|
|
4286 |
||
4287 |
opt_outer: |
|
4288 |
/* empty */ {} |
|
4289 |
| OUTER {} |
|
4290 |
;
|
|
4291 |
||
4292 |
index_hint_clause: |
|
4293 |
/* empty */ |
|
4294 |
{
|
|
4295 |
$$= global_system_variables.old_mode ? |
|
4296 |
INDEX_HINT_MASK_JOIN : INDEX_HINT_MASK_ALL; |
|
4297 |
}
|
|
4298 |
| FOR_SYM JOIN_SYM { $$= INDEX_HINT_MASK_JOIN; } |
|
4299 |
| FOR_SYM ORDER_SYM BY { $$= INDEX_HINT_MASK_ORDER; } |
|
4300 |
| FOR_SYM GROUP_SYM BY { $$= INDEX_HINT_MASK_GROUP; } |
|
4301 |
;
|
|
4302 |
||
4303 |
index_hint_type: |
|
4304 |
FORCE_SYM { $$= INDEX_HINT_FORCE; } |
|
4305 |
| IGNORE_SYM { $$= INDEX_HINT_IGNORE; } |
|
4306 |
;
|
|
4307 |
||
4308 |
index_hint_definition: |
|
4309 |
index_hint_type key_or_index index_hint_clause |
|
4310 |
{
|
|
4311 |
Select->set_index_hint_type($1, $3); |
|
4312 |
}
|
|
4313 |
'(' key_usage_list ')' |
|
4314 |
| USE_SYM key_or_index index_hint_clause |
|
4315 |
{
|
|
4316 |
Select->set_index_hint_type(INDEX_HINT_USE, $3); |
|
4317 |
}
|
|
4318 |
'(' opt_key_usage_list ')' |
|
4319 |
;
|
|
4320 |
||
4321 |
index_hints_list: |
|
4322 |
index_hint_definition
|
|
4323 |
| index_hints_list index_hint_definition |
|
4324 |
;
|
|
4325 |
||
4326 |
opt_index_hints_list: |
|
4327 |
/* empty */ |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
4328 |
| { Select->alloc_index_hints(YYSession); } index_hints_list |
1
by brian
clean slate |
4329 |
;
|
4330 |
||
4331 |
opt_key_definition: |
|
4332 |
{ Select->clear_index_hints(); } |
|
4333 |
opt_index_hints_list
|
|
4334 |
;
|
|
4335 |
||
4336 |
opt_key_usage_list: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
4337 |
/* empty */ { Select->add_index_hint(YYSession, NULL, 0); } |
1
by brian
clean slate |
4338 |
| key_usage_list {} |
4339 |
;
|
|
4340 |
||
4341 |
key_usage_element: |
|
4342 |
ident
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
4343 |
{ Select->add_index_hint(YYSession, $1.str, $1.length); } |
1
by brian
clean slate |
4344 |
| PRIMARY_SYM |
520.1.22
by Brian Aker
Second pass of thd cleanup |
4345 |
{ Select->add_index_hint(YYSession, (char *)"PRIMARY", 7); } |
1
by brian
clean slate |
4346 |
;
|
4347 |
||
4348 |
key_usage_list: |
|
4349 |
key_usage_element
|
|
4350 |
| key_usage_list ',' key_usage_element |
|
4351 |
;
|
|
4352 |
||
4353 |
using_list: |
|
4354 |
ident
|
|
4355 |
{
|
|
4356 |
if (!($$= new List<String>)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4357 |
DRIZZLE_YYABORT; |
520.1.22
by Brian Aker
Second pass of thd cleanup |
4358 |
$$->push_back(new (YYSession->mem_root) |
1
by brian
clean slate |
4359 |
String((const char *) $1.str, $1.length, |
4360 |
system_charset_info)); |
|
4361 |
}
|
|
4362 |
| using_list ',' ident |
|
4363 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
4364 |
$1->push_back(new (YYSession->mem_root) |
1
by brian
clean slate |
4365 |
String((const char *) $3.str, $3.length, |
4366 |
system_charset_info)); |
|
4367 |
$$= $1; |
|
4368 |
}
|
|
4369 |
;
|
|
4370 |
||
4371 |
interval: |
|
4372 |
interval_time_st {} |
|
4373 |
| DAY_HOUR_SYM { $$=INTERVAL_DAY_HOUR; } |
|
4374 |
| DAY_MICROSECOND_SYM { $$=INTERVAL_DAY_MICROSECOND; } |
|
4375 |
| DAY_MINUTE_SYM { $$=INTERVAL_DAY_MINUTE; } |
|
4376 |
| DAY_SECOND_SYM { $$=INTERVAL_DAY_SECOND; } |
|
4377 |
| HOUR_MICROSECOND_SYM { $$=INTERVAL_HOUR_MICROSECOND; } |
|
4378 |
| HOUR_MINUTE_SYM { $$=INTERVAL_HOUR_MINUTE; } |
|
4379 |
| HOUR_SECOND_SYM { $$=INTERVAL_HOUR_SECOND; } |
|
4380 |
| MINUTE_MICROSECOND_SYM { $$=INTERVAL_MINUTE_MICROSECOND; } |
|
4381 |
| MINUTE_SECOND_SYM { $$=INTERVAL_MINUTE_SECOND; } |
|
4382 |
| SECOND_MICROSECOND_SYM { $$=INTERVAL_SECOND_MICROSECOND; } |
|
4383 |
| YEAR_MONTH_SYM { $$=INTERVAL_YEAR_MONTH; } |
|
4384 |
;
|
|
4385 |
||
4386 |
interval_time_stamp: |
|
4387 |
interval_time_st {} |
|
4388 |
| FRAC_SECOND_SYM { |
|
4389 |
$$=INTERVAL_MICROSECOND; |
|
4390 |
/*
|
|
4391 |
FRAC_SECOND was mistakenly implemented with |
|
4392 |
a wrong resolution. According to the ODBC |
|
4393 |
standard it should be nanoseconds, not |
|
4394 |
microseconds. Changing it to nanoseconds |
|
4395 |
in MySQL would mean making TIMESTAMPDIFF |
|
4396 |
and TIMESTAMPADD to return DECIMAL, since |
|
4397 |
the return value would be too big for BIGINT |
|
4398 |
Hence we just deprecate the incorrect |
|
4399 |
implementation without changing its |
|
4400 |
resolution. |
|
4401 |
*/
|
|
4402 |
}
|
|
4403 |
;
|
|
4404 |
||
4405 |
interval_time_st: |
|
4406 |
DAY_SYM { $$=INTERVAL_DAY; } |
|
4407 |
| WEEK_SYM { $$=INTERVAL_WEEK; } |
|
4408 |
| HOUR_SYM { $$=INTERVAL_HOUR; } |
|
4409 |
| MINUTE_SYM { $$=INTERVAL_MINUTE; } |
|
4410 |
| MONTH_SYM { $$=INTERVAL_MONTH; } |
|
4411 |
| QUARTER_SYM { $$=INTERVAL_QUARTER; } |
|
4412 |
| SECOND_SYM { $$=INTERVAL_SECOND; } |
|
4413 |
| MICROSECOND_SYM { $$=INTERVAL_MICROSECOND; } |
|
4414 |
| YEAR_SYM { $$=INTERVAL_YEAR; } |
|
4415 |
;
|
|
4416 |
||
4417 |
date_time_type: |
|
236.1.24
by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME. |
4418 |
DATE_SYM {$$=DRIZZLE_TIMESTAMP_DATE;} |
4419 |
| TIME_SYM {$$=DRIZZLE_TIMESTAMP_TIME;} |
|
4420 |
| DATETIME {$$=DRIZZLE_TIMESTAMP_DATETIME;} |
|
4421 |
| TIMESTAMP {$$=DRIZZLE_TIMESTAMP_DATETIME;} |
|
1
by brian
clean slate |
4422 |
;
|
4423 |
||
4424 |
table_alias: |
|
4425 |
/* empty */ |
|
4426 |
| AS |
|
4427 |
| EQ |
|
4428 |
;
|
|
4429 |
||
4430 |
opt_table_alias: |
|
4431 |
/* empty */ { $$=0; } |
|
4432 |
| table_alias ident |
|
4433 |
{ $$= (LEX_STRING*) sql_memdup(&$2,sizeof(LEX_STRING)); } |
|
4434 |
;
|
|
4435 |
||
4436 |
opt_all: |
|
4437 |
/* empty */ |
|
4438 |
| ALL |
|
4439 |
;
|
|
4440 |
||
4441 |
where_clause: |
|
4442 |
/* empty */ { Select->where= 0; } |
|
4443 |
| WHERE |
|
4444 |
{
|
|
4445 |
Select->parsing_place= IN_WHERE; |
|
4446 |
}
|
|
4447 |
expr
|
|
4448 |
{
|
|
4449 |
SELECT_LEX *select= Select; |
|
4450 |
select->where= $3; |
|
4451 |
select->parsing_place= NO_MATTER; |
|
4452 |
if ($3) |
|
4453 |
$3->top_level_item(); |
|
4454 |
}
|
|
4455 |
;
|
|
4456 |
||
4457 |
having_clause: |
|
4458 |
/* empty */ |
|
4459 |
| HAVING |
|
4460 |
{
|
|
4461 |
Select->parsing_place= IN_HAVING; |
|
4462 |
}
|
|
4463 |
expr
|
|
4464 |
{
|
|
4465 |
SELECT_LEX *sel= Select; |
|
4466 |
sel->having= $3; |
|
4467 |
sel->parsing_place= NO_MATTER; |
|
4468 |
if ($3) |
|
4469 |
$3->top_level_item(); |
|
4470 |
}
|
|
4471 |
;
|
|
4472 |
||
4473 |
opt_escape: |
|
4474 |
ESCAPE_SYM simple_expr |
|
4475 |
{
|
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
4476 |
Lex->escape_used= true; |
1
by brian
clean slate |
4477 |
$$= $2; |
4478 |
}
|
|
4479 |
| /* empty */ |
|
4480 |
{
|
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
4481 |
Lex->escape_used= false; |
383.1.12
by Brian Aker
Much closer toward UTF8 being around all the time... |
4482 |
$$= new Item_string("\\", 1, &my_charset_utf8_general_ci); |
1
by brian
clean slate |
4483 |
}
|
4484 |
;
|
|
4485 |
||
4486 |
/*
|
|
4487 |
group by statement in select |
|
4488 |
*/
|
|
4489 |
||
4490 |
group_clause: |
|
4491 |
/* empty */ |
|
4492 |
| GROUP_SYM BY group_list olap_opt |
|
4493 |
;
|
|
4494 |
||
4495 |
group_list: |
|
4496 |
group_list ',' order_ident order_dir |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
4497 |
{ if (add_group_to_list(YYSession, $3,(bool) $4)) DRIZZLE_YYABORT; } |
1
by brian
clean slate |
4498 |
| order_ident order_dir |
520.1.22
by Brian Aker
Second pass of thd cleanup |
4499 |
{ if (add_group_to_list(YYSession, $1,(bool) $2)) DRIZZLE_YYABORT; } |
1
by brian
clean slate |
4500 |
;
|
4501 |
||
4502 |
olap_opt: |
|
4503 |
/* empty */ {} |
|
4504 |
| WITH_ROLLUP_SYM |
|
4505 |
{
|
|
4506 |
/*
|
|
4507 |
'WITH ROLLUP' is needed for backward compatibility, |
|
4508 |
and cause LALR(2) conflicts. |
|
4509 |
This syntax is not standard. |
|
4510 |
MySQL syntax: GROUP BY col1, col2, col3 WITH ROLLUP |
|
4511 |
SQL-2003: GROUP BY ... ROLLUP(col1, col2, col3) |
|
4512 |
*/
|
|
4513 |
LEX *lex= Lex; |
|
4514 |
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE) |
|
4515 |
{
|
|
4516 |
my_error(ER_WRONG_USAGE, MYF(0), "WITH ROLLUP", |
|
4517 |
"global union parameters"); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4518 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4519 |
}
|
4520 |
lex->current_select->olap= ROLLUP_TYPE; |
|
4521 |
}
|
|
4522 |
;
|
|
4523 |
||
4524 |
/*
|
|
4525 |
Order by statement in ALTER TABLE |
|
4526 |
*/
|
|
4527 |
||
4528 |
alter_order_clause: |
|
4529 |
ORDER_SYM BY alter_order_list |
|
4530 |
;
|
|
4531 |
||
4532 |
alter_order_list: |
|
4533 |
alter_order_list ',' alter_order_item |
|
4534 |
| alter_order_item |
|
4535 |
;
|
|
4536 |
||
4537 |
alter_order_item: |
|
4538 |
simple_ident_nospvar order_dir |
|
4539 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
4540 |
Session *session= YYSession; |
1
by brian
clean slate |
4541 |
bool ascending= ($2 == 1) ? true : false; |
520.1.22
by Brian Aker
Second pass of thd cleanup |
4542 |
if (add_order_to_list(session, $1, ascending)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4543 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4544 |
}
|
4545 |
;
|
|
4546 |
||
4547 |
/*
|
|
4548 |
Order by statement in select |
|
4549 |
*/
|
|
4550 |
||
4551 |
opt_order_clause: |
|
4552 |
/* empty */ |
|
4553 |
| order_clause |
|
4554 |
;
|
|
4555 |
||
4556 |
order_clause: |
|
4557 |
ORDER_SYM BY |
|
4558 |
{
|
|
4559 |
LEX *lex=Lex; |
|
4560 |
SELECT_LEX *sel= lex->current_select; |
|
4561 |
SELECT_LEX_UNIT *unit= sel-> master_unit(); |
|
4562 |
if (sel->linkage != GLOBAL_OPTIONS_TYPE && |
|
4563 |
sel->olap != UNSPECIFIED_OLAP_TYPE && |
|
4564 |
(sel->linkage != UNION_TYPE || sel->braces)) |
|
4565 |
{
|
|
4566 |
my_error(ER_WRONG_USAGE, MYF(0), |
|
4567 |
"CUBE/ROLLUP", "ORDER BY"); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4568 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4569 |
}
|
4570 |
if (lex->sql_command != SQLCOM_ALTER_TABLE && !unit->fake_select_lex) |
|
4571 |
{
|
|
4572 |
/*
|
|
4573 |
A query of the of the form (SELECT ...) ORDER BY order_list is |
|
4574 |
executed in the same way as the query |
|
4575 |
SELECT ... ORDER BY order_list |
|
4576 |
unless the SELECT construct contains ORDER BY or LIMIT clauses. |
|
4577 |
Otherwise we create a fake SELECT_LEX if it has not been created |
|
4578 |
yet. |
|
4579 |
*/
|
|
4580 |
SELECT_LEX *first_sl= unit->first_select(); |
|
4581 |
if (!unit->is_union() && |
|
4582 |
(first_sl->order_list.elements || |
|
4583 |
first_sl->select_limit) && |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
4584 |
unit->add_fake_select_lex(lex->session)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4585 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4586 |
}
|
4587 |
}
|
|
4588 |
order_list
|
|
4589 |
;
|
|
4590 |
||
4591 |
order_list: |
|
4592 |
order_list ',' order_ident order_dir |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
4593 |
{ if (add_order_to_list(YYSession, $3,(bool) $4)) DRIZZLE_YYABORT; } |
1
by brian
clean slate |
4594 |
| order_ident order_dir |
520.1.22
by Brian Aker
Second pass of thd cleanup |
4595 |
{ if (add_order_to_list(YYSession, $1,(bool) $2)) DRIZZLE_YYABORT; } |
1
by brian
clean slate |
4596 |
;
|
4597 |
||
4598 |
order_dir: |
|
4599 |
/* empty */ { $$ = 1; } |
|
4600 |
| ASC { $$ =1; } |
|
4601 |
| DESC { $$ =0; } |
|
4602 |
;
|
|
4603 |
||
4604 |
opt_limit_clause_init: |
|
4605 |
/* empty */ |
|
4606 |
{
|
|
4607 |
LEX *lex= Lex; |
|
4608 |
SELECT_LEX *sel= lex->current_select; |
|
4609 |
sel->offset_limit= 0; |
|
4610 |
sel->select_limit= 0; |
|
4611 |
}
|
|
4612 |
| limit_clause {} |
|
4613 |
;
|
|
4614 |
||
4615 |
opt_limit_clause: |
|
4616 |
/* empty */ {} |
|
4617 |
| limit_clause {} |
|
4618 |
;
|
|
4619 |
||
4620 |
limit_clause: |
|
4621 |
LIMIT limit_options {} |
|
4622 |
;
|
|
4623 |
||
4624 |
limit_options: |
|
4625 |
limit_option
|
|
4626 |
{
|
|
4627 |
SELECT_LEX *sel= Select; |
|
4628 |
sel->select_limit= $1; |
|
4629 |
sel->offset_limit= 0; |
|
4630 |
sel->explicit_limit= 1; |
|
4631 |
}
|
|
4632 |
| limit_option ',' limit_option |
|
4633 |
{
|
|
4634 |
SELECT_LEX *sel= Select; |
|
4635 |
sel->select_limit= $3; |
|
4636 |
sel->offset_limit= $1; |
|
4637 |
sel->explicit_limit= 1; |
|
4638 |
}
|
|
4639 |
| limit_option OFFSET_SYM limit_option |
|
4640 |
{
|
|
4641 |
SELECT_LEX *sel= Select; |
|
4642 |
sel->select_limit= $1; |
|
4643 |
sel->offset_limit= $3; |
|
4644 |
sel->explicit_limit= 1; |
|
4645 |
}
|
|
4646 |
;
|
|
4647 |
||
4648 |
limit_option: |
|
177.1.5
by brian
Removed dead ? operator. |
4649 |
ULONGLONG_NUM { $$= new Item_uint($1.str, $1.length); } |
1
by brian
clean slate |
4650 |
| LONG_NUM { $$= new Item_uint($1.str, $1.length); } |
4651 |
| NUM { $$= new Item_uint($1.str, $1.length); } |
|
4652 |
;
|
|
4653 |
||
4654 |
delete_limit_clause: |
|
4655 |
/* empty */ |
|
4656 |
{
|
|
4657 |
LEX *lex=Lex; |
|
4658 |
lex->current_select->select_limit= 0; |
|
4659 |
}
|
|
4660 |
| LIMIT limit_option |
|
4661 |
{
|
|
4662 |
SELECT_LEX *sel= Select; |
|
4663 |
sel->select_limit= $2; |
|
4664 |
sel->explicit_limit= 1; |
|
4665 |
}
|
|
4666 |
;
|
|
4667 |
||
4668 |
ulong_num: |
|
4669 |
NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); } |
|
4670 |
| HEX_NUM { $$= (ulong) strtol($1.str, (char**) 0, 16); } |
|
4671 |
| LONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); } |
|
4672 |
| ULONGLONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); } |
|
4673 |
| DECIMAL_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); } |
|
4674 |
| FLOAT_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); } |
|
4675 |
;
|
|
4676 |
||
4677 |
real_ulong_num: |
|
4678 |
NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); } |
|
4679 |
| HEX_NUM { $$= (ulong) strtol($1.str, (char**) 0, 16); } |
|
4680 |
| LONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); } |
|
4681 |
| ULONGLONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); } |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4682 |
| dec_num_error { DRIZZLE_YYABORT; } |
1
by brian
clean slate |
4683 |
;
|
4684 |
||
4685 |
ulonglong_num: |
|
151
by Brian Aker
Ulonglong to uint64_t |
4686 |
NUM { int error; $$= (uint64_t) my_strtoll10($1.str, (char**) 0, &error); } |
4687 |
| ULONGLONG_NUM { int error; $$= (uint64_t) my_strtoll10($1.str, (char**) 0, &error); } |
|
4688 |
| LONG_NUM { int error; $$= (uint64_t) my_strtoll10($1.str, (char**) 0, &error); } |
|
4689 |
| DECIMAL_NUM { int error; $$= (uint64_t) my_strtoll10($1.str, (char**) 0, &error); } |
|
4690 |
| FLOAT_NUM { int error; $$= (uint64_t) my_strtoll10($1.str, (char**) 0, &error); } |
|
1
by brian
clean slate |
4691 |
;
|
4692 |
||
4693 |
dec_num_error: |
|
4694 |
dec_num
|
|
4695 |
{ my_parse_error(ER(ER_ONLY_INTEGERS_ALLOWED)); } |
|
4696 |
;
|
|
4697 |
||
4698 |
dec_num: |
|
4699 |
DECIMAL_NUM
|
|
4700 |
| FLOAT_NUM |
|
4701 |
;
|
|
4702 |
||
4703 |
choice: |
|
4704 |
ulong_num { $$= $1 != 0 ? HA_CHOICE_YES : HA_CHOICE_NO; } |
|
4705 |
| DEFAULT { $$= HA_CHOICE_UNDEF; } |
|
4706 |
;
|
|
4707 |
||
4708 |
select_var_list_init: |
|
4709 |
{
|
|
4710 |
LEX *lex=Lex; |
|
4711 |
if (!lex->describe && (!(lex->result= new select_dumpvar()))) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4712 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4713 |
}
|
4714 |
select_var_list
|
|
4715 |
{}
|
|
4716 |
;
|
|
4717 |
||
4718 |
select_var_list: |
|
4719 |
select_var_list ',' select_var_ident |
|
4720 |
| select_var_ident {} |
|
4721 |
;
|
|
4722 |
||
4723 |
select_var_ident: |
|
4724 |
'@' ident_or_text |
|
4725 |
{
|
|
4726 |
LEX *lex=Lex; |
|
4727 |
if (lex->result) |
|
4728 |
((select_dumpvar *)lex->result)->var_list.push_back( new my_var($2,0,0,(enum_field_types)0)); |
|
4729 |
else
|
|
4730 |
/*
|
|
4731 |
The parser won't create select_result instance only |
|
4732 |
if it's an EXPLAIN. |
|
4733 |
*/
|
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
4734 |
assert(lex->describe); |
1
by brian
clean slate |
4735 |
}
|
4736 |
;
|
|
4737 |
||
4738 |
into: |
|
4739 |
INTO
|
|
4740 |
{
|
|
4741 |
if (! Lex->parsing_options.allows_select_into) |
|
4742 |
{
|
|
4743 |
my_error(ER_VIEW_SELECT_CLAUSE, MYF(0), "INTO"); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4744 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4745 |
}
|
4746 |
}
|
|
4747 |
into_destination
|
|
4748 |
;
|
|
4749 |
||
4750 |
into_destination: |
|
4751 |
OUTFILE TEXT_STRING_filesystem |
|
4752 |
{
|
|
4753 |
LEX *lex= Lex; |
|
4754 |
if (!(lex->exchange= new sql_exchange($2.str, 0)) || |
|
4755 |
!(lex->result= new select_export(lex->exchange))) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4756 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4757 |
}
|
4758 |
opt_field_term opt_line_term |
|
4759 |
| DUMPFILE TEXT_STRING_filesystem |
|
4760 |
{
|
|
4761 |
LEX *lex=Lex; |
|
4762 |
if (!lex->describe) |
|
4763 |
{
|
|
4764 |
if (!(lex->exchange= new sql_exchange($2.str,1))) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4765 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4766 |
if (!(lex->result= new select_dump(lex->exchange))) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4767 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4768 |
}
|
4769 |
}
|
|
4770 |
| select_var_list_init |
|
4771 |
{ } |
|
4772 |
;
|
|
4773 |
||
4774 |
/*
|
|
4775 |
Drop : delete tables or index or user |
|
4776 |
*/
|
|
4777 |
||
4778 |
drop: |
|
184
by Brian Aker
Dead debug code removal (and a compatible "never used") bit in the |
4779 |
DROP opt_temporary table_or_tables if_exists table_list |
1
by brian
clean slate |
4780 |
{
|
4781 |
LEX *lex=Lex; |
|
4782 |
lex->sql_command = SQLCOM_DROP_TABLE; |
|
4783 |
lex->drop_temporary= $2; |
|
4784 |
lex->drop_if_exists= $4; |
|
4785 |
}
|
|
4786 |
| DROP build_method INDEX_SYM ident ON table_ident {} |
|
4787 |
{
|
|
4788 |
LEX *lex=Lex; |
|
4789 |
lex->sql_command= SQLCOM_DROP_INDEX; |
|
4790 |
lex->alter_info.reset(); |
|
4791 |
lex->alter_info.flags= ALTER_DROP_INDEX; |
|
4792 |
lex->alter_info.build_method= $2; |
|
4793 |
lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY, |
|
4794 |
$4.str)); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
4795 |
if (!lex->current_select->add_table_to_list(lex->session, $6, NULL, |
1
by brian
clean slate |
4796 |
TL_OPTION_UPDATING)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4797 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4798 |
}
|
4799 |
| DROP DATABASE if_exists ident |
|
4800 |
{
|
|
4801 |
LEX *lex=Lex; |
|
4802 |
lex->sql_command= SQLCOM_DROP_DB; |
|
4803 |
lex->drop_if_exists=$3; |
|
4804 |
lex->name= $4; |
|
4805 |
}
|
|
4806 |
table_list: |
|
4807 |
table_name
|
|
4808 |
| table_list ',' table_name |
|
4809 |
;
|
|
4810 |
||
4811 |
table_name: |
|
4812 |
table_ident
|
|
4813 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
4814 |
if (!Select->add_table_to_list(YYSession, $1, NULL, TL_OPTION_UPDATING)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4815 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4816 |
}
|
4817 |
;
|
|
4818 |
||
4819 |
table_alias_ref_list: |
|
4820 |
table_alias_ref
|
|
4821 |
| table_alias_ref_list ',' table_alias_ref |
|
4822 |
;
|
|
4823 |
||
4824 |
table_alias_ref: |
|
4825 |
table_ident
|
|
4826 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
4827 |
if (!Select->add_table_to_list(YYSession, $1, NULL, |
1
by brian
clean slate |
4828 |
TL_OPTION_UPDATING | TL_OPTION_ALIAS, |
4829 |
Lex->lock_option )) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4830 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4831 |
}
|
4832 |
;
|
|
4833 |
||
4834 |
if_exists: |
|
4835 |
/* empty */ { $$= 0; } |
|
4836 |
| IF EXISTS { $$= 1; } |
|
4837 |
;
|
|
4838 |
||
4839 |
opt_temporary: |
|
4840 |
/* empty */ { $$= 0; } |
|
4841 |
| TEMPORARY { $$= 1; } |
|
4842 |
;
|
|
4843 |
/*
|
|
4844 |
** Insert : add new data to table |
|
4845 |
*/
|
|
4846 |
||
4847 |
insert: |
|
4848 |
INSERT
|
|
4849 |
{
|
|
4850 |
LEX *lex= Lex; |
|
4851 |
lex->sql_command= SQLCOM_INSERT; |
|
4852 |
lex->duplicates= DUP_ERROR; |
|
4853 |
mysql_init_select(lex); |
|
4854 |
/* for subselects */ |
|
604
by Brian Aker
Remove lock condition needed (we do row based replication, so... lock is |
4855 |
lex->lock_option= TL_READ; |
1
by brian
clean slate |
4856 |
}
|
4857 |
insert_lock_option
|
|
4858 |
opt_ignore insert2 |
|
4859 |
{
|
|
4860 |
Select->set_lock_for_tables($3); |
|
4861 |
Lex->current_select= &Lex->select_lex; |
|
4862 |
}
|
|
4863 |
insert_field_spec opt_insert_update |
|
4864 |
{}
|
|
4865 |
;
|
|
4866 |
||
4867 |
replace: |
|
4868 |
REPLACE
|
|
4869 |
{
|
|
4870 |
LEX *lex=Lex; |
|
4871 |
lex->sql_command = SQLCOM_REPLACE; |
|
4872 |
lex->duplicates= DUP_REPLACE; |
|
4873 |
mysql_init_select(lex); |
|
4874 |
}
|
|
4875 |
replace_lock_option insert2 |
|
4876 |
{
|
|
4877 |
Select->set_lock_for_tables($3); |
|
4878 |
Lex->current_select= &Lex->select_lex; |
|
4879 |
}
|
|
4880 |
insert_field_spec
|
|
4881 |
{}
|
|
4882 |
;
|
|
4883 |
||
4884 |
insert_lock_option: |
|
4885 |
/* empty */ |
|
4886 |
{
|
|
4887 |
$$= TL_WRITE_CONCURRENT_INSERT; |
|
4888 |
}
|
|
4889 |
| LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; } |
|
4890 |
| DELAYED_SYM { $$= TL_WRITE_LOW_PRIORITY; } |
|
4891 |
| HIGH_PRIORITY { $$= TL_WRITE; } |
|
4892 |
;
|
|
4893 |
||
4894 |
replace_lock_option: |
|
4895 |
opt_low_priority { $$= $1; } |
|
4896 |
| DELAYED_SYM { $$= TL_WRITE_LOW_PRIORITY; } |
|
4897 |
;
|
|
4898 |
||
4899 |
insert2: |
|
4900 |
INTO insert_table {} |
|
4901 |
| insert_table {} |
|
4902 |
;
|
|
4903 |
||
4904 |
insert_table: |
|
4905 |
table_name
|
|
4906 |
{
|
|
4907 |
LEX *lex=Lex; |
|
4908 |
lex->field_list.empty(); |
|
4909 |
lex->many_values.empty(); |
|
4910 |
lex->insert_list=0; |
|
4911 |
};
|
|
4912 |
||
4913 |
insert_field_spec: |
|
4914 |
insert_values {} |
|
4915 |
| '(' ')' insert_values {} |
|
4916 |
| '(' fields ')' insert_values {} |
|
4917 |
| SET |
|
4918 |
{
|
|
4919 |
LEX *lex=Lex; |
|
4920 |
if (!(lex->insert_list = new List_item) || |
|
4921 |
lex->many_values.push_back(lex->insert_list)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4922 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4923 |
}
|
4924 |
ident_eq_list
|
|
4925 |
;
|
|
4926 |
||
4927 |
fields: |
|
4928 |
fields ',' insert_ident { Lex->field_list.push_back($3); } |
|
4929 |
| insert_ident { Lex->field_list.push_back($1); } |
|
4930 |
;
|
|
4931 |
||
4932 |
insert_values: |
|
4933 |
VALUES values_list {} |
|
4934 |
| VALUE_SYM values_list {} |
|
4935 |
| create_select |
|
4936 |
{ Select->set_braces(0);} |
|
4937 |
union_clause {} |
|
4938 |
| '(' create_select ')' |
|
4939 |
{ Select->set_braces(1);} |
|
4940 |
union_opt {} |
|
4941 |
;
|
|
4942 |
||
4943 |
values_list: |
|
4944 |
values_list ',' no_braces |
|
4945 |
| no_braces |
|
4946 |
;
|
|
4947 |
||
4948 |
ident_eq_list: |
|
4949 |
ident_eq_list ',' ident_eq_value |
|
4950 |
| ident_eq_value |
|
4951 |
;
|
|
4952 |
||
4953 |
ident_eq_value: |
|
4954 |
simple_ident_nospvar equal expr_or_default |
|
4955 |
{
|
|
4956 |
LEX *lex=Lex; |
|
4957 |
if (lex->field_list.push_back($1) || |
|
4958 |
lex->insert_list->push_back($3)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4959 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4960 |
}
|
4961 |
;
|
|
4962 |
||
4963 |
equal: |
|
4964 |
EQ {} |
|
4965 |
| SET_VAR {} |
|
4966 |
;
|
|
4967 |
||
4968 |
opt_equal: |
|
4969 |
/* empty */ {} |
|
4970 |
| equal {} |
|
4971 |
;
|
|
4972 |
||
4973 |
no_braces: |
|
4974 |
'('
|
|
4975 |
{
|
|
4976 |
if (!(Lex->insert_list = new List_item)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4977 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4978 |
}
|
4979 |
opt_values ')' |
|
4980 |
{
|
|
4981 |
LEX *lex=Lex; |
|
4982 |
if (lex->many_values.push_back(lex->insert_list)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4983 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4984 |
}
|
4985 |
;
|
|
4986 |
||
4987 |
opt_values: |
|
4988 |
/* empty */ {} |
|
4989 |
| values |
|
4990 |
;
|
|
4991 |
||
4992 |
values: |
|
4993 |
values ',' expr_or_default |
|
4994 |
{
|
|
4995 |
if (Lex->insert_list->push_back($3)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4996 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4997 |
}
|
4998 |
| expr_or_default |
|
4999 |
{
|
|
5000 |
if (Lex->insert_list->push_back($1)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5001 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5002 |
}
|
5003 |
;
|
|
5004 |
||
5005 |
expr_or_default: |
|
5006 |
expr { $$= $1;} |
|
5007 |
| DEFAULT {$$= new Item_default_value(Lex->current_context()); } |
|
5008 |
;
|
|
5009 |
||
5010 |
opt_insert_update: |
|
5011 |
/* empty */ |
|
5012 |
| ON DUPLICATE_SYM { Lex->duplicates= DUP_UPDATE; } |
|
5013 |
KEY_SYM UPDATE_SYM insert_update_list |
|
5014 |
;
|
|
5015 |
||
5016 |
/* Update rows in a table */ |
|
5017 |
||
5018 |
update: |
|
5019 |
UPDATE_SYM
|
|
5020 |
{
|
|
5021 |
LEX *lex= Lex; |
|
5022 |
mysql_init_select(lex); |
|
5023 |
lex->sql_command= SQLCOM_UPDATE; |
|
5024 |
lex->lock_option= TL_UNLOCK; /* Will be set later */ |
|
5025 |
lex->duplicates= DUP_ERROR; |
|
5026 |
}
|
|
5027 |
opt_low_priority opt_ignore join_table_list |
|
5028 |
SET update_list |
|
5029 |
{
|
|
5030 |
LEX *lex= Lex; |
|
5031 |
if (lex->select_lex.table_list.elements > 1) |
|
5032 |
lex->sql_command= SQLCOM_UPDATE_MULTI; |
|
5033 |
else if (lex->select_lex.get_table_list()->derived) |
|
5034 |
{
|
|
5035 |
/* it is single table update and it is update of derived table */ |
|
5036 |
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), |
|
5037 |
lex->select_lex.get_table_list()->alias, "UPDATE"); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5038 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5039 |
}
|
5040 |
/*
|
|
5041 |
In case of multi-update setting write lock for all tables may |
|
5042 |
be too pessimistic. We will decrease lock level if possible in |
|
5043 |
mysql_multi_update(). |
|
5044 |
*/
|
|
5045 |
Select->set_lock_for_tables($3); |
|
5046 |
}
|
|
5047 |
where_clause opt_order_clause delete_limit_clause {} |
|
5048 |
;
|
|
5049 |
||
5050 |
update_list: |
|
5051 |
update_list ',' update_elem |
|
5052 |
| update_elem |
|
5053 |
;
|
|
5054 |
||
5055 |
update_elem: |
|
5056 |
simple_ident_nospvar equal expr_or_default |
|
5057 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5058 |
if (add_item_to_list(YYSession, $1) || add_value_to_list(YYSession, $3)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5059 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5060 |
}
|
5061 |
;
|
|
5062 |
||
5063 |
insert_update_list: |
|
5064 |
insert_update_list ',' insert_update_elem |
|
5065 |
| insert_update_elem |
|
5066 |
;
|
|
5067 |
||
5068 |
insert_update_elem: |
|
5069 |
simple_ident_nospvar equal expr_or_default |
|
5070 |
{
|
|
5071 |
LEX *lex= Lex; |
|
5072 |
if (lex->update_list.push_back($1) || |
|
5073 |
lex->value_list.push_back($3)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5074 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5075 |
}
|
5076 |
;
|
|
5077 |
||
5078 |
opt_low_priority: |
|
5079 |
/* empty */ { $$= TL_WRITE_DEFAULT; } |
|
5080 |
| LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; } |
|
5081 |
;
|
|
5082 |
||
5083 |
/* Delete rows from a table */ |
|
5084 |
||
5085 |
delete: |
|
5086 |
DELETE_SYM
|
|
5087 |
{
|
|
5088 |
LEX *lex= Lex; |
|
5089 |
lex->sql_command= SQLCOM_DELETE; |
|
5090 |
mysql_init_select(lex); |
|
5091 |
lex->lock_option= TL_WRITE_DEFAULT; |
|
5092 |
lex->ignore= 0; |
|
5093 |
lex->select_lex.init_order(); |
|
5094 |
}
|
|
5095 |
opt_delete_options single_multi |
|
5096 |
;
|
|
5097 |
||
5098 |
single_multi: |
|
5099 |
FROM table_ident |
|
5100 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5101 |
if (!Select->add_table_to_list(YYSession, $2, NULL, TL_OPTION_UPDATING, |
1
by brian
clean slate |
5102 |
Lex->lock_option)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5103 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5104 |
}
|
5105 |
where_clause opt_order_clause |
|
5106 |
delete_limit_clause {} |
|
5107 |
| table_wild_list |
|
5108 |
{ mysql_init_multi_delete(Lex); } |
|
5109 |
FROM join_table_list where_clause |
|
5110 |
{
|
|
5111 |
if (multi_delete_set_locks_and_link_aux_tables(Lex)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5112 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5113 |
}
|
5114 |
| FROM table_alias_ref_list |
|
5115 |
{ mysql_init_multi_delete(Lex); } |
|
5116 |
USING join_table_list where_clause |
|
5117 |
{
|
|
5118 |
if (multi_delete_set_locks_and_link_aux_tables(Lex)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5119 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5120 |
}
|
5121 |
;
|
|
5122 |
||
5123 |
table_wild_list: |
|
5124 |
table_wild_one
|
|
5125 |
| table_wild_list ',' table_wild_one |
|
5126 |
;
|
|
5127 |
||
5128 |
table_wild_one: |
|
5129 |
ident opt_wild |
|
5130 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5131 |
if (!Select->add_table_to_list(YYSession, new Table_ident($1), |
1
by brian
clean slate |
5132 |
NULL, |
5133 |
TL_OPTION_UPDATING | TL_OPTION_ALIAS, |
|
5134 |
Lex->lock_option)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5135 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5136 |
}
|
5137 |
| ident '.' ident opt_wild |
|
5138 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5139 |
if (!Select->add_table_to_list(YYSession, |
5140 |
new Table_ident(YYSession, $1, $3, 0), |
|
1
by brian
clean slate |
5141 |
NULL, |
5142 |
TL_OPTION_UPDATING | TL_OPTION_ALIAS, |
|
5143 |
Lex->lock_option)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5144 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5145 |
}
|
5146 |
;
|
|
5147 |
||
5148 |
opt_wild: |
|
5149 |
/* empty */ {} |
|
5150 |
| '.' '*' {} |
|
5151 |
;
|
|
5152 |
||
5153 |
opt_delete_options: |
|
5154 |
/* empty */ {} |
|
5155 |
| opt_delete_option opt_delete_options {} |
|
5156 |
;
|
|
5157 |
||
5158 |
opt_delete_option: |
|
5159 |
QUICK { Select->options|= OPTION_QUICK; } |
|
5160 |
| LOW_PRIORITY { Lex->lock_option= TL_WRITE_LOW_PRIORITY; } |
|
5161 |
| IGNORE_SYM { Lex->ignore= 1; } |
|
5162 |
;
|
|
5163 |
||
5164 |
truncate: |
|
5165 |
TRUNCATE_SYM opt_table_sym table_name |
|
5166 |
{
|
|
5167 |
LEX* lex= Lex; |
|
5168 |
lex->sql_command= SQLCOM_TRUNCATE; |
|
5169 |
lex->select_lex.options= 0; |
|
5170 |
lex->select_lex.init_order(); |
|
5171 |
}
|
|
5172 |
;
|
|
5173 |
||
5174 |
opt_table_sym: |
|
5175 |
/* empty */ |
|
5176 |
| TABLE_SYM |
|
5177 |
;
|
|
5178 |
||
5179 |
/* Show things */ |
|
5180 |
||
5181 |
show: |
|
5182 |
SHOW
|
|
5183 |
{
|
|
5184 |
LEX *lex=Lex; |
|
5185 |
lex->wild=0; |
|
5186 |
lex->lock_option= TL_READ; |
|
5187 |
mysql_init_select(lex); |
|
5188 |
lex->current_select->parsing_place= SELECT_LIST; |
|
212.6.6
by Mats Kindahl
Removing redundant use of casts in drizzled/ for memcmp(), memcpy(), memset(), and memmove(). |
5189 |
memset(&lex->create_info, 0, sizeof(lex->create_info)); |
1
by brian
clean slate |
5190 |
}
|
5191 |
show_param
|
|
5192 |
{}
|
|
5193 |
;
|
|
5194 |
||
5195 |
show_param: |
|
327.2.5
by Brian Aker
Refactoring show command |
5196 |
DATABASES show_wild |
1
by brian
clean slate |
5197 |
{
|
5198 |
LEX *lex= Lex; |
|
5199 |
lex->sql_command= SQLCOM_SHOW_DATABASES; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5200 |
if (prepare_schema_table(YYSession, lex, 0, SCH_SCHEMATA)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5201 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5202 |
}
|
327.2.5
by Brian Aker
Refactoring show command |
5203 |
| opt_full TABLES opt_db show_wild |
1
by brian
clean slate |
5204 |
{
|
5205 |
LEX *lex= Lex; |
|
5206 |
lex->sql_command= SQLCOM_SHOW_TABLES; |
|
5207 |
lex->select_lex.db= $3; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5208 |
if (prepare_schema_table(YYSession, lex, 0, SCH_TABLE_NAMES)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5209 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5210 |
}
|
327.2.5
by Brian Aker
Refactoring show command |
5211 |
| TABLE_SYM STATUS_SYM opt_db show_wild |
1
by brian
clean slate |
5212 |
{
|
5213 |
LEX *lex= Lex; |
|
5214 |
lex->sql_command= SQLCOM_SHOW_TABLE_STATUS; |
|
5215 |
lex->select_lex.db= $3; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5216 |
if (prepare_schema_table(YYSession, lex, 0, SCH_TABLES)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5217 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5218 |
}
|
327.2.5
by Brian Aker
Refactoring show command |
5219 |
| OPEN_SYM TABLES opt_db show_wild |
1
by brian
clean slate |
5220 |
{
|
5221 |
LEX *lex= Lex; |
|
5222 |
lex->sql_command= SQLCOM_SHOW_OPEN_TABLES; |
|
5223 |
lex->select_lex.db= $3; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5224 |
if (prepare_schema_table(YYSession, lex, 0, SCH_OPEN_TABLES)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5225 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5226 |
}
|
12.1.1
by Brian Aker
Cleaned up show status. |
5227 |
| ENGINE_SYM known_storage_engines STATUS_SYM /* This should either go... well it should go */ |
5228 |
{
|
|
5229 |
Lex->create_info.db_type= $2; |
|
5230 |
Lex->sql_command= SQLCOM_SHOW_ENGINE_STATUS; |
|
5231 |
}
|
|
327.2.5
by Brian Aker
Refactoring show command |
5232 |
| opt_full COLUMNS from_or_in table_ident opt_db show_wild |
1
by brian
clean slate |
5233 |
{
|
5234 |
LEX *lex= Lex; |
|
5235 |
lex->sql_command= SQLCOM_SHOW_FIELDS; |
|
5236 |
if ($5) |
|
5237 |
$4->change_db($5); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5238 |
if (prepare_schema_table(YYSession, lex, $4, SCH_COLUMNS)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5239 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5240 |
}
|
5241 |
| master_or_binary LOGS_SYM |
|
5242 |
{
|
|
5243 |
Lex->sql_command = SQLCOM_SHOW_BINLOGS; |
|
5244 |
}
|
|
5245 |
| keys_or_index from_or_in table_ident opt_db where_clause |
|
5246 |
{
|
|
5247 |
LEX *lex= Lex; |
|
5248 |
lex->sql_command= SQLCOM_SHOW_KEYS; |
|
5249 |
if ($4) |
|
5250 |
$3->change_db($4); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5251 |
if (prepare_schema_table(YYSession, lex, $3, SCH_STATISTICS)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5252 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5253 |
}
|
5254 |
| COUNT_SYM '(' '*' ')' WARNINGS |
|
5255 |
{ (void) create_select_for_variable("warning_count"); } |
|
5256 |
| COUNT_SYM '(' '*' ')' ERRORS |
|
5257 |
{ (void) create_select_for_variable("error_count"); } |
|
5258 |
| WARNINGS opt_limit_clause_init |
|
5259 |
{ Lex->sql_command = SQLCOM_SHOW_WARNS;} |
|
5260 |
| ERRORS opt_limit_clause_init |
|
5261 |
{ Lex->sql_command = SQLCOM_SHOW_ERRORS;} |
|
327.2.5
by Brian Aker
Refactoring show command |
5262 |
| opt_var_type STATUS_SYM show_wild |
1
by brian
clean slate |
5263 |
{
|
5264 |
LEX *lex= Lex; |
|
5265 |
lex->sql_command= SQLCOM_SHOW_STATUS; |
|
5266 |
lex->option_type= $1; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5267 |
if (prepare_schema_table(YYSession, lex, 0, SCH_STATUS)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5268 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5269 |
}
|
5270 |
| opt_full PROCESSLIST_SYM |
|
5271 |
{ Lex->sql_command= SQLCOM_SHOW_PROCESSLIST;} |
|
327.2.5
by Brian Aker
Refactoring show command |
5272 |
| opt_var_type VARIABLES show_wild |
1
by brian
clean slate |
5273 |
{
|
5274 |
LEX *lex= Lex; |
|
5275 |
lex->sql_command= SQLCOM_SHOW_VARIABLES; |
|
5276 |
lex->option_type= $1; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5277 |
if (prepare_schema_table(YYSession, lex, 0, SCH_VARIABLES)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5278 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5279 |
}
|
5280 |
| CREATE DATABASE opt_if_not_exists ident |
|
5281 |
{
|
|
5282 |
Lex->sql_command=SQLCOM_SHOW_CREATE_DB; |
|
5283 |
Lex->create_info.options=$3; |
|
5284 |
Lex->name= $4; |
|
5285 |
}
|
|
5286 |
| CREATE TABLE_SYM table_ident |
|
5287 |
{
|
|
5288 |
LEX *lex= Lex; |
|
5289 |
lex->sql_command = SQLCOM_SHOW_CREATE; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5290 |
if (!lex->select_lex.add_table_to_list(YYSession, $3, NULL,0)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5291 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5292 |
}
|
5293 |
| MASTER_SYM STATUS_SYM |
|
5294 |
{
|
|
5295 |
Lex->sql_command = SQLCOM_SHOW_MASTER_STAT; |
|
5296 |
}
|
|
5297 |
| SLAVE STATUS_SYM |
|
5298 |
{
|
|
5299 |
Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT; |
|
5300 |
}
|
|
5301 |
||
5302 |
master_or_binary: |
|
5303 |
MASTER_SYM
|
|
5304 |
| BINARY |
|
5305 |
;
|
|
5306 |
||
5307 |
opt_db: |
|
5308 |
/* empty */ { $$= 0; } |
|
5309 |
| from_or_in ident { $$= $2.str; } |
|
5310 |
;
|
|
5311 |
||
5312 |
opt_full: |
|
5313 |
/* empty */ { Lex->verbose=0; } |
|
5314 |
| FULL { Lex->verbose=1; } |
|
5315 |
;
|
|
5316 |
||
5317 |
from_or_in: |
|
5318 |
FROM
|
|
5319 |
| IN_SYM |
|
5320 |
;
|
|
5321 |
||
327.2.5
by Brian Aker
Refactoring show command |
5322 |
show_wild: |
1
by brian
clean slate |
5323 |
/* empty */ |
5324 |
| LIKE TEXT_STRING_sys |
|
5325 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5326 |
Lex->wild= new (YYSession->mem_root) String($2.str, $2.length, |
1
by brian
clean slate |
5327 |
system_charset_info); |
5328 |
}
|
|
5329 |
;
|
|
5330 |
||
5331 |
/* A Oracle compatible synonym for show */ |
|
5332 |
describe: |
|
5333 |
describe_command table_ident |
|
5334 |
{
|
|
5335 |
LEX *lex= Lex; |
|
5336 |
lex->lock_option= TL_READ; |
|
5337 |
mysql_init_select(lex); |
|
5338 |
lex->current_select->parsing_place= SELECT_LIST; |
|
5339 |
lex->sql_command= SQLCOM_SHOW_FIELDS; |
|
5340 |
lex->select_lex.db= 0; |
|
5341 |
lex->verbose= 0; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5342 |
if (prepare_schema_table(YYSession, lex, $2, SCH_COLUMNS)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5343 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5344 |
}
|
5345 |
opt_describe_column {} |
|
5346 |
| describe_command opt_extended_describe |
|
5347 |
{ Lex->describe|= DESCRIBE_NORMAL; } |
|
5348 |
select
|
|
5349 |
{
|
|
5350 |
LEX *lex=Lex; |
|
5351 |
lex->select_lex.options|= SELECT_DESCRIBE; |
|
5352 |
}
|
|
5353 |
;
|
|
5354 |
||
5355 |
describe_command: |
|
5356 |
DESC
|
|
5357 |
| DESCRIBE |
|
5358 |
;
|
|
5359 |
||
5360 |
opt_extended_describe: |
|
5361 |
/* empty */ {} |
|
5362 |
| EXTENDED_SYM { Lex->describe|= DESCRIBE_EXTENDED; } |
|
5363 |
;
|
|
5364 |
||
5365 |
opt_describe_column: |
|
5366 |
/* empty */ {} |
|
5367 |
| text_string { Lex->wild= $1; } |
|
5368 |
| ident |
|
5369 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5370 |
Lex->wild= new (YYSession->mem_root) String((const char*) $1.str, |
1
by brian
clean slate |
5371 |
$1.length, |
5372 |
system_charset_info); |
|
5373 |
}
|
|
5374 |
;
|
|
5375 |
||
5376 |
||
5377 |
/* flush things */ |
|
5378 |
||
5379 |
flush: |
|
383.1.26
by Brian Aker
Removed option for single command replication and have now left disable of |
5380 |
FLUSH_SYM
|
1
by brian
clean slate |
5381 |
{
|
5382 |
LEX *lex=Lex; |
|
5383 |
lex->sql_command= SQLCOM_FLUSH; |
|
5384 |
lex->type= 0; |
|
5385 |
}
|
|
5386 |
flush_options
|
|
5387 |
{}
|
|
5388 |
;
|
|
5389 |
||
5390 |
flush_options: |
|
5391 |
flush_options ',' flush_option |
|
5392 |
| flush_option |
|
5393 |
;
|
|
5394 |
||
5395 |
flush_option: |
|
5396 |
table_or_tables
|
|
5397 |
{ Lex->type|= REFRESH_TABLES; } |
|
5398 |
opt_table_list {} |
|
5399 |
| TABLES WITH READ_SYM LOCK_SYM |
|
5400 |
{ Lex->type|= REFRESH_TABLES | REFRESH_READ_LOCK; } |
|
5401 |
| QUERY_SYM CACHE_SYM |
|
5402 |
{ Lex->type|= REFRESH_QUERY_CACHE_FREE; } |
|
5403 |
| HOSTS_SYM |
|
5404 |
{ Lex->type|= REFRESH_HOSTS; } |
|
5405 |
| LOGS_SYM |
|
5406 |
{ Lex->type|= REFRESH_LOG; } |
|
5407 |
| STATUS_SYM |
|
5408 |
{ Lex->type|= REFRESH_STATUS; } |
|
5409 |
| SLAVE |
|
5410 |
{ Lex->type|= REFRESH_SLAVE; } |
|
5411 |
| MASTER_SYM |
|
5412 |
{ Lex->type|= REFRESH_MASTER; } |
|
5413 |
| RESOURCES |
|
5414 |
{ Lex->type|= REFRESH_USER_RESOURCES; } |
|
5415 |
;
|
|
5416 |
||
5417 |
opt_table_list: |
|
5418 |
/* empty */ {} |
|
5419 |
| table_list {} |
|
5420 |
;
|
|
5421 |
||
5422 |
reset: |
|
5423 |
RESET_SYM
|
|
5424 |
{
|
|
5425 |
LEX *lex=Lex; |
|
5426 |
lex->sql_command= SQLCOM_RESET; lex->type=0; |
|
5427 |
}
|
|
5428 |
reset_options
|
|
5429 |
{}
|
|
5430 |
;
|
|
5431 |
||
5432 |
reset_options: |
|
5433 |
reset_options ',' reset_option |
|
5434 |
| reset_option |
|
5435 |
;
|
|
5436 |
||
5437 |
reset_option: |
|
5438 |
SLAVE { Lex->type|= REFRESH_SLAVE; } |
|
5439 |
| MASTER_SYM { Lex->type|= REFRESH_MASTER; } |
|
5440 |
| QUERY_SYM CACHE_SYM { Lex->type|= REFRESH_QUERY_CACHE;} |
|
5441 |
;
|
|
5442 |
||
5443 |
purge: |
|
5444 |
PURGE
|
|
5445 |
{
|
|
5446 |
LEX *lex=Lex; |
|
5447 |
lex->type=0; |
|
5448 |
lex->sql_command = SQLCOM_PURGE; |
|
5449 |
}
|
|
5450 |
purge_options
|
|
5451 |
{}
|
|
5452 |
;
|
|
5453 |
||
5454 |
purge_options: |
|
5455 |
master_or_binary LOGS_SYM purge_option |
|
5456 |
;
|
|
5457 |
||
5458 |
purge_option: |
|
5459 |
TO_SYM TEXT_STRING_sys |
|
5460 |
{
|
|
5461 |
Lex->to_log = $2.str; |
|
5462 |
}
|
|
5463 |
| BEFORE_SYM expr |
|
5464 |
{
|
|
5465 |
LEX *lex= Lex; |
|
5466 |
lex->value_list.empty(); |
|
5467 |
lex->value_list.push_front($2); |
|
5468 |
lex->sql_command= SQLCOM_PURGE_BEFORE; |
|
5469 |
}
|
|
5470 |
;
|
|
5471 |
||
5472 |
/* kill threads */ |
|
5473 |
||
5474 |
kill: |
|
5475 |
KILL_SYM kill_option expr |
|
5476 |
{
|
|
5477 |
LEX *lex=Lex; |
|
5478 |
lex->value_list.empty(); |
|
5479 |
lex->value_list.push_front($3); |
|
5480 |
lex->sql_command= SQLCOM_KILL; |
|
5481 |
}
|
|
5482 |
;
|
|
5483 |
||
5484 |
kill_option: |
|
5485 |
/* empty */ { Lex->type= 0; } |
|
5486 |
| CONNECTION_SYM { Lex->type= 0; } |
|
5487 |
| QUERY_SYM { Lex->type= ONLY_KILL_QUERY; } |
|
5488 |
;
|
|
5489 |
||
5490 |
/* change database */ |
|
5491 |
||
5492 |
use: |
|
5493 |
USE_SYM ident |
|
5494 |
{
|
|
5495 |
LEX *lex=Lex; |
|
5496 |
lex->sql_command=SQLCOM_CHANGE_DB; |
|
5497 |
lex->select_lex.db= $2.str; |
|
5498 |
}
|
|
5499 |
;
|
|
5500 |
||
5501 |
/* import, export of files */ |
|
5502 |
||
5503 |
load: |
|
266.1.23
by Monty Taylor
Removed load xml infile. Hope nobody liked it. Now the only thing we need xml.c |
5504 |
LOAD data_file |
1
by brian
clean slate |
5505 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5506 |
Session *session= YYSession; |
5507 |
LEX *lex= session->lex; |
|
5508 |
Lex_input_stream *lip= session->m_lip; |
|
1
by brian
clean slate |
5509 |
|
5510 |
lex->fname_start= lip->get_ptr(); |
|
5511 |
}
|
|
5512 |
load_data_lock opt_local INFILE TEXT_STRING_filesystem |
|
5513 |
{
|
|
5514 |
LEX *lex=Lex; |
|
5515 |
lex->sql_command= SQLCOM_LOAD; |
|
5516 |
lex->lock_option= $4; |
|
5517 |
lex->local_file= $5; |
|
5518 |
lex->duplicates= DUP_ERROR; |
|
5519 |
lex->ignore= 0; |
|
5520 |
if (!(lex->exchange= new sql_exchange($7.str, 0, $2))) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5521 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5522 |
}
|
5523 |
opt_duplicate INTO |
|
5524 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5525 |
Session *session= YYSession; |
5526 |
LEX *lex= session->lex; |
|
5527 |
Lex_input_stream *lip= session->m_lip; |
|
1
by brian
clean slate |
5528 |
lex->fname_end= lip->get_ptr(); |
5529 |
}
|
|
5530 |
TABLE_SYM table_ident |
|
5531 |
{
|
|
5532 |
LEX *lex=Lex; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5533 |
if (!Select->add_table_to_list(YYSession, $13, NULL, TL_OPTION_UPDATING, |
1
by brian
clean slate |
5534 |
lex->lock_option)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5535 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5536 |
lex->field_list.empty(); |
5537 |
lex->update_list.empty(); |
|
5538 |
lex->value_list.empty(); |
|
5539 |
}
|
|
5540 |
opt_field_term opt_line_term opt_ignore_lines opt_field_or_var_spec |
|
5541 |
opt_load_data_set_spec
|
|
5542 |
{}
|
|
5543 |
;
|
|
5544 |
||
266.1.23
by Monty Taylor
Removed load xml infile. Hope nobody liked it. Now the only thing we need xml.c |
5545 |
data_file: |
5546 |
DATA_SYM { $$= FILETYPE_CSV; }; |
|
1
by brian
clean slate |
5547 |
|
5548 |
opt_local: |
|
5549 |
/* empty */ { $$=0;} |
|
5550 |
| LOCAL_SYM { $$=1;} |
|
5551 |
;
|
|
5552 |
||
5553 |
load_data_lock: |
|
5554 |
/* empty */ { $$= TL_WRITE_DEFAULT; } |
|
5555 |
| CONCURRENT |
|
5556 |
{
|
|
5557 |
$$= TL_WRITE_CONCURRENT_INSERT; |
|
5558 |
}
|
|
5559 |
| LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; } |
|
5560 |
;
|
|
5561 |
||
5562 |
opt_duplicate: |
|
5563 |
/* empty */ { Lex->duplicates=DUP_ERROR; } |
|
5564 |
| REPLACE { Lex->duplicates=DUP_REPLACE; } |
|
5565 |
| IGNORE_SYM { Lex->ignore= 1; } |
|
5566 |
;
|
|
5567 |
||
5568 |
opt_field_term: |
|
5569 |
/* empty */ |
|
5570 |
| COLUMNS field_term_list |
|
5571 |
;
|
|
5572 |
||
5573 |
field_term_list: |
|
5574 |
field_term_list field_term |
|
5575 |
| field_term |
|
5576 |
;
|
|
5577 |
||
5578 |
field_term: |
|
5579 |
TERMINATED BY text_string |
|
5580 |
{
|
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
5581 |
assert(Lex->exchange != 0); |
1
by brian
clean slate |
5582 |
Lex->exchange->field_term= $3; |
5583 |
}
|
|
5584 |
| OPTIONALLY ENCLOSED BY text_string |
|
5585 |
{
|
|
5586 |
LEX *lex= Lex; |
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
5587 |
assert(lex->exchange != 0); |
1
by brian
clean slate |
5588 |
lex->exchange->enclosed= $4; |
5589 |
lex->exchange->opt_enclosed= 1; |
|
5590 |
}
|
|
5591 |
| ENCLOSED BY text_string |
|
5592 |
{
|
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
5593 |
assert(Lex->exchange != 0); |
1
by brian
clean slate |
5594 |
Lex->exchange->enclosed= $3; |
5595 |
}
|
|
5596 |
| ESCAPED BY text_string |
|
5597 |
{
|
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
5598 |
assert(Lex->exchange != 0); |
1
by brian
clean slate |
5599 |
Lex->exchange->escaped= $3; |
5600 |
}
|
|
5601 |
;
|
|
5602 |
||
5603 |
opt_line_term: |
|
5604 |
/* empty */ |
|
5605 |
| LINES line_term_list |
|
5606 |
;
|
|
5607 |
||
5608 |
line_term_list: |
|
5609 |
line_term_list line_term |
|
5610 |
| line_term |
|
5611 |
;
|
|
5612 |
||
5613 |
line_term: |
|
5614 |
TERMINATED BY text_string |
|
5615 |
{
|
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
5616 |
assert(Lex->exchange != 0); |
1
by brian
clean slate |
5617 |
Lex->exchange->line_term= $3; |
5618 |
}
|
|
5619 |
| STARTING BY text_string |
|
5620 |
{
|
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
5621 |
assert(Lex->exchange != 0); |
1
by brian
clean slate |
5622 |
Lex->exchange->line_start= $3; |
5623 |
}
|
|
5624 |
;
|
|
5625 |
||
5626 |
opt_ignore_lines: |
|
5627 |
/* empty */ |
|
5628 |
| IGNORE_SYM NUM lines_or_rows |
|
5629 |
{
|
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
5630 |
assert(Lex->exchange != 0); |
1
by brian
clean slate |
5631 |
Lex->exchange->skip_lines= atol($2.str); |
5632 |
}
|
|
5633 |
;
|
|
5634 |
||
5635 |
lines_or_rows: |
|
5636 |
LINES { } |
|
5637 |
| ROWS_SYM { } |
|
5638 |
;
|
|
5639 |
||
5640 |
opt_field_or_var_spec: |
|
5641 |
/* empty */ {} |
|
5642 |
| '(' fields_or_vars ')' {} |
|
5643 |
| '(' ')' {} |
|
5644 |
;
|
|
5645 |
||
5646 |
fields_or_vars: |
|
5647 |
fields_or_vars ',' field_or_var |
|
5648 |
{ Lex->field_list.push_back($3); } |
|
5649 |
| field_or_var |
|
5650 |
{ Lex->field_list.push_back($1); } |
|
5651 |
;
|
|
5652 |
||
5653 |
field_or_var: |
|
5654 |
simple_ident_nospvar {$$= $1;} |
|
5655 |
| '@' ident_or_text |
|
5656 |
{ $$= new Item_user_var_as_out_param($2); } |
|
5657 |
;
|
|
5658 |
||
5659 |
opt_load_data_set_spec: |
|
5660 |
/* empty */ {} |
|
5661 |
| SET insert_update_list {} |
|
5662 |
;
|
|
5663 |
||
5664 |
/* Common definitions */ |
|
5665 |
||
5666 |
text_literal: |
|
5667 |
TEXT_STRING
|
|
5668 |
{
|
|
5669 |
LEX_STRING tmp; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5670 |
Session *session= YYSession; |
5671 |
const CHARSET_INFO * const cs_con= session->variables.collation_connection; |
|
5672 |
const CHARSET_INFO * const cs_cli= session->variables.character_set_client; |
|
5673 |
uint32_t repertoire= session->lex->text_string_is_7bit && |
|
1
by brian
clean slate |
5674 |
my_charset_is_ascii_based(cs_cli) ? |
5675 |
MY_REPERTOIRE_ASCII : MY_REPERTOIRE_UNICODE30; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5676 |
if (session->charset_is_collation_connection || |
1
by brian
clean slate |
5677 |
(repertoire == MY_REPERTOIRE_ASCII && |
5678 |
my_charset_is_ascii_based(cs_con))) |
|
5679 |
tmp= $1; |
|
5680 |
else
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5681 |
session->convert_string(&tmp, cs_con, $1.str, $1.length, cs_cli); |
1
by brian
clean slate |
5682 |
$$= new Item_string(tmp.str, tmp.length, cs_con, |
5683 |
DERIVATION_COERCIBLE, repertoire); |
|
5684 |
}
|
|
5685 |
| UNDERSCORE_CHARSET TEXT_STRING |
|
5686 |
{
|
|
5687 |
Item_string *str= new Item_string($2.str, $2.length, $1); |
|
5688 |
str->set_repertoire_from_value(); |
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
5689 |
str->set_cs_specified(true); |
1
by brian
clean slate |
5690 |
|
5691 |
$$= str; |
|
5692 |
}
|
|
5693 |
| text_literal TEXT_STRING_literal |
|
5694 |
{
|
|
5695 |
Item_string* item= (Item_string*) $1; |
|
5696 |
item->append($2.str, $2.length); |
|
5697 |
if (!(item->collation.repertoire & MY_REPERTOIRE_EXTENDED)) |
|
5698 |
{
|
|
5699 |
/*
|
|
5700 |
If the string has been pure ASCII so far, |
|
5701 |
check the new part. |
|
5702 |
*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5703 |
const CHARSET_INFO * const cs= YYSession->variables.collation_connection; |
1
by brian
clean slate |
5704 |
item->collation.repertoire|= my_string_repertoire(cs, |
5705 |
$2.str, |
|
5706 |
$2.length); |
|
5707 |
}
|
|
5708 |
}
|
|
5709 |
;
|
|
5710 |
||
5711 |
text_string: |
|
5712 |
TEXT_STRING_literal
|
|
5713 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5714 |
$$= new (YYSession->mem_root) String($1.str, |
1
by brian
clean slate |
5715 |
$1.length, |
520.1.22
by Brian Aker
Second pass of thd cleanup |
5716 |
YYSession->variables.collation_connection); |
1
by brian
clean slate |
5717 |
}
|
5718 |
| HEX_NUM |
|
5719 |
{
|
|
5720 |
Item *tmp= new Item_hex_string($1.str, $1.length); |
|
5721 |
/*
|
|
5722 |
it is OK only emulate fix_fields, because we need only |
|
5723 |
value of constant |
|
5724 |
*/
|
|
5725 |
$$= tmp ? |
|
5726 |
tmp->quick_fix_field(), tmp->val_str((String*) 0) : |
|
5727 |
(String*) 0; |
|
5728 |
}
|
|
5729 |
| BIN_NUM |
|
5730 |
{
|
|
5731 |
Item *tmp= new Item_bin_string($1.str, $1.length); |
|
5732 |
/*
|
|
5733 |
it is OK only emulate fix_fields, because we need only |
|
5734 |
value of constant |
|
5735 |
*/
|
|
5736 |
$$= tmp ? tmp->quick_fix_field(), tmp->val_str((String*) 0) : |
|
5737 |
(String*) 0; |
|
5738 |
}
|
|
5739 |
;
|
|
5740 |
||
5741 |
signed_literal: |
|
5742 |
literal { $$ = $1; } |
|
5743 |
| '+' NUM_literal { $$ = $2; } |
|
5744 |
| '-' NUM_literal |
|
5745 |
{
|
|
5746 |
$2->max_length++; |
|
5747 |
$$= $2->neg(); |
|
5748 |
}
|
|
5749 |
;
|
|
5750 |
||
5751 |
literal: |
|
5752 |
text_literal { $$ = $1; } |
|
5753 |
| NUM_literal { $$ = $1; } |
|
5754 |
| NULL_SYM |
|
5755 |
{
|
|
5756 |
$$ = new Item_null(); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5757 |
YYSession->m_lip->next_state=MY_LEX_OPERATOR_OR_IDENT; |
1
by brian
clean slate |
5758 |
}
|
5759 |
| FALSE_SYM { $$= new Item_int((char*) "FALSE",0,1); } |
|
5760 |
| TRUE_SYM { $$= new Item_int((char*) "TRUE",1,1); } |
|
5761 |
| HEX_NUM { $$ = new Item_hex_string($1.str, $1.length);} |
|
5762 |
| BIN_NUM { $$= new Item_bin_string($1.str, $1.length); } |
|
5763 |
| UNDERSCORE_CHARSET HEX_NUM |
|
5764 |
{
|
|
5765 |
Item *tmp= new Item_hex_string($2.str, $2.length); |
|
5766 |
/*
|
|
5767 |
it is OK only emulate fix_fieds, because we need only |
|
5768 |
value of constant |
|
5769 |
*/
|
|
5770 |
String *str= tmp ? |
|
5771 |
tmp->quick_fix_field(), tmp->val_str((String*) 0) : |
|
5772 |
(String*) 0; |
|
5773 |
||
5774 |
Item_string *item_str= |
|
5775 |
new Item_string(NULL, /* name will be set in select_item */ |
|
5776 |
str ? str->ptr() : "", |
|
5777 |
str ? str->length() : 0, |
|
5778 |
$1); |
|
5779 |
if (!item_str || |
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
5780 |
!item_str->check_well_formed_result(&item_str->str_value, true)) |
1
by brian
clean slate |
5781 |
{
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5782 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5783 |
}
|
5784 |
||
5785 |
item_str->set_repertoire_from_value(); |
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
5786 |
item_str->set_cs_specified(true); |
1
by brian
clean slate |
5787 |
|
5788 |
$$= item_str; |
|
5789 |
}
|
|
5790 |
| UNDERSCORE_CHARSET BIN_NUM |
|
5791 |
{
|
|
5792 |
Item *tmp= new Item_bin_string($2.str, $2.length); |
|
5793 |
/*
|
|
5794 |
it is OK only emulate fix_fieds, because we need only |
|
5795 |
value of constant |
|
5796 |
*/
|
|
5797 |
String *str= tmp ? |
|
5798 |
tmp->quick_fix_field(), tmp->val_str((String*) 0) : |
|
5799 |
(String*) 0; |
|
5800 |
||
5801 |
Item_string *item_str= |
|
5802 |
new Item_string(NULL, /* name will be set in select_item */ |
|
5803 |
str ? str->ptr() : "", |
|
5804 |
str ? str->length() : 0, |
|
5805 |
$1); |
|
5806 |
if (!item_str || |
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
5807 |
!item_str->check_well_formed_result(&item_str->str_value, true)) |
1
by brian
clean slate |
5808 |
{
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5809 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5810 |
}
|
5811 |
||
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
5812 |
item_str->set_cs_specified(true); |
1
by brian
clean slate |
5813 |
|
5814 |
$$= item_str; |
|
5815 |
}
|
|
5816 |
| DATE_SYM text_literal { $$ = $2; } |
|
5817 |
| TIME_SYM text_literal { $$ = $2; } |
|
5818 |
| TIMESTAMP text_literal { $$ = $2; } |
|
5819 |
;
|
|
5820 |
||
5821 |
NUM_literal: |
|
5822 |
NUM
|
|
5823 |
{
|
|
5824 |
int error; |
|
154
by Brian Aker
Removed oddball types in my_global.h |
5825 |
$$ = new Item_int($1.str, (int64_t) my_strtoll10($1.str, NULL, &error), $1.length); |
1
by brian
clean slate |
5826 |
}
|
5827 |
| LONG_NUM |
|
5828 |
{
|
|
5829 |
int error; |
|
154
by Brian Aker
Removed oddball types in my_global.h |
5830 |
$$ = new Item_int($1.str, (int64_t) my_strtoll10($1.str, NULL, &error), $1.length); |
1
by brian
clean slate |
5831 |
}
|
5832 |
| ULONGLONG_NUM |
|
5833 |
{ $$ = new Item_uint($1.str, $1.length); } |
|
5834 |
| DECIMAL_NUM |
|
5835 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5836 |
$$= new Item_decimal($1.str, $1.length, YYSession->charset()); |
5837 |
if (YYSession->is_error()) |
|
1
by brian
clean slate |
5838 |
{
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5839 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5840 |
}
|
5841 |
}
|
|
5842 |
| FLOAT_NUM |
|
5843 |
{
|
|
5844 |
$$ = new Item_float($1.str, $1.length); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5845 |
if (YYSession->is_error()) |
1
by brian
clean slate |
5846 |
{
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5847 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5848 |
}
|
5849 |
}
|
|
5850 |
;
|
|
5851 |
||
5852 |
/**********************************************************************
|
|
5853 |
** Creating different items. |
|
5854 |
**********************************************************************/
|
|
5855 |
||
5856 |
insert_ident: |
|
5857 |
simple_ident_nospvar { $$=$1; } |
|
5858 |
| table_wild { $$=$1; } |
|
5859 |
;
|
|
5860 |
||
5861 |
table_wild: |
|
5862 |
ident '.' '*' |
|
5863 |
{
|
|
5864 |
SELECT_LEX *sel= Select; |
|
461
by Monty Taylor
Removed NullS. bu-bye. |
5865 |
$$ = new Item_field(Lex->current_context(), NULL, $1.str, "*"); |
1
by brian
clean slate |
5866 |
sel->with_wild++; |
5867 |
}
|
|
5868 |
| ident '.' ident '.' '*' |
|
5869 |
{
|
|
5870 |
SELECT_LEX *sel= Select; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5871 |
$$ = new Item_field(Lex->current_context(), (YYSession->client_capabilities & |
461
by Monty Taylor
Removed NullS. bu-bye. |
5872 |
CLIENT_NO_SCHEMA ? NULL : $1.str), |
1
by brian
clean slate |
5873 |
$3.str,"*"); |
5874 |
sel->with_wild++; |
|
5875 |
}
|
|
5876 |
;
|
|
5877 |
||
5878 |
order_ident: |
|
5879 |
expr { $$=$1; } |
|
5880 |
;
|
|
5881 |
||
5882 |
simple_ident: |
|
5883 |
ident
|
|
5884 |
{
|
|
5885 |
{
|
|
5886 |
SELECT_LEX *sel=Select; |
|
5887 |
$$= (sel->parsing_place != IN_HAVING || |
|
5888 |
sel->get_in_sum_expr() > 0) ? |
|
461
by Monty Taylor
Removed NullS. bu-bye. |
5889 |
(Item*) new Item_field(Lex->current_context(), |
5890 |
(const char *)NULL, NULL, $1.str) : |
|
5891 |
(Item*) new Item_ref(Lex->current_context(), |
|
5892 |
(const char *)NULL, NULL, $1.str); |
|
1
by brian
clean slate |
5893 |
}
|
5894 |
}
|
|
5895 |
| simple_ident_q { $$= $1; } |
|
5896 |
;
|
|
5897 |
||
5898 |
simple_ident_nospvar: |
|
5899 |
ident
|
|
5900 |
{
|
|
5901 |
SELECT_LEX *sel=Select; |
|
5902 |
$$= (sel->parsing_place != IN_HAVING || |
|
5903 |
sel->get_in_sum_expr() > 0) ? |
|
461
by Monty Taylor
Removed NullS. bu-bye. |
5904 |
(Item*) new Item_field(Lex->current_context(), |
5905 |
(const char *)NULL, NULL, $1.str) : |
|
5906 |
(Item*) new Item_ref(Lex->current_context(), |
|
5907 |
(const char *)NULL, NULL, $1.str); |
|
1
by brian
clean slate |
5908 |
}
|
5909 |
| simple_ident_q { $$= $1; } |
|
5910 |
;
|
|
5911 |
||
5912 |
simple_ident_q: |
|
5913 |
ident '.' ident |
|
5914 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5915 |
Session *session= YYSession; |
5916 |
LEX *lex= session->lex; |
|
1
by brian
clean slate |
5917 |
|
5918 |
{
|
|
5919 |
SELECT_LEX *sel= lex->current_select; |
|
5920 |
if (sel->no_table_names_allowed) |
|
5921 |
{
|
|
5922 |
my_error(ER_TABLENAME_NOT_ALLOWED_HERE, |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5923 |
MYF(0), $1.str, session->where); |
1
by brian
clean slate |
5924 |
}
|
5925 |
$$= (sel->parsing_place != IN_HAVING || |
|
5926 |
sel->get_in_sum_expr() > 0) ? |
|
461
by Monty Taylor
Removed NullS. bu-bye. |
5927 |
(Item*) new Item_field(Lex->current_context(), |
5928 |
(const char *)NULL, $1.str, $3.str) : |
|
5929 |
(Item*) new Item_ref(Lex->current_context(), |
|
5930 |
(const char *)NULL, $1.str, $3.str); |
|
1
by brian
clean slate |
5931 |
}
|
5932 |
}
|
|
5933 |
| '.' ident '.' ident |
|
5934 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5935 |
Session *session= YYSession; |
5936 |
LEX *lex= session->lex; |
|
1
by brian
clean slate |
5937 |
SELECT_LEX *sel= lex->current_select; |
5938 |
if (sel->no_table_names_allowed) |
|
5939 |
{
|
|
5940 |
my_error(ER_TABLENAME_NOT_ALLOWED_HERE, |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5941 |
MYF(0), $2.str, session->where); |
1
by brian
clean slate |
5942 |
}
|
5943 |
$$= (sel->parsing_place != IN_HAVING || |
|
5944 |
sel->get_in_sum_expr() > 0) ? |
|
461
by Monty Taylor
Removed NullS. bu-bye. |
5945 |
(Item*) new Item_field(Lex->current_context(), NULL, $2.str, $4.str) : |
5946 |
(Item*) new Item_ref(Lex->current_context(), |
|
5947 |
(const char *)NULL, $2.str, $4.str); |
|
1
by brian
clean slate |
5948 |
}
|
5949 |
| ident '.' ident '.' ident |
|
5950 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5951 |
Session *session= YYSession; |
5952 |
LEX *lex= session->lex; |
|
1
by brian
clean slate |
5953 |
SELECT_LEX *sel= lex->current_select; |
5954 |
if (sel->no_table_names_allowed) |
|
5955 |
{
|
|
5956 |
my_error(ER_TABLENAME_NOT_ALLOWED_HERE, |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5957 |
MYF(0), $3.str, session->where); |
1
by brian
clean slate |
5958 |
}
|
5959 |
$$= (sel->parsing_place != IN_HAVING || |
|
5960 |
sel->get_in_sum_expr() > 0) ? |
|
5961 |
(Item*) new Item_field(Lex->current_context(), |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5962 |
(YYSession->client_capabilities & |
461
by Monty Taylor
Removed NullS. bu-bye. |
5963 |
CLIENT_NO_SCHEMA ? NULL : $1.str), |
1
by brian
clean slate |
5964 |
$3.str, $5.str) : |
5965 |
(Item*) new Item_ref(Lex->current_context(), |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5966 |
(YYSession->client_capabilities & |
461
by Monty Taylor
Removed NullS. bu-bye. |
5967 |
CLIENT_NO_SCHEMA ? NULL : $1.str), |
1
by brian
clean slate |
5968 |
$3.str, $5.str); |
5969 |
}
|
|
5970 |
;
|
|
5971 |
||
5972 |
field_ident: |
|
5973 |
ident { $$=$1;} |
|
5974 |
| ident '.' ident '.' ident |
|
5975 |
{
|
|
327.2.5
by Brian Aker
Refactoring show command |
5976 |
TableList *table= (TableList*) Select->table_list.first; |
1
by brian
clean slate |
5977 |
if (my_strcasecmp(table_alias_charset, $1.str, table->db)) |
5978 |
{
|
|
5979 |
my_error(ER_WRONG_DB_NAME, MYF(0), $1.str); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5980 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5981 |
}
|
5982 |
if (my_strcasecmp(table_alias_charset, $3.str, |
|
5983 |
table->table_name)) |
|
5984 |
{
|
|
5985 |
my_error(ER_WRONG_TABLE_NAME, MYF(0), $3.str); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5986 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5987 |
}
|
5988 |
$$=$5; |
|
5989 |
}
|
|
5990 |
| ident '.' ident |
|
5991 |
{
|
|
327.2.5
by Brian Aker
Refactoring show command |
5992 |
TableList *table= (TableList*) Select->table_list.first; |
1
by brian
clean slate |
5993 |
if (my_strcasecmp(table_alias_charset, $1.str, table->alias)) |
5994 |
{
|
|
5995 |
my_error(ER_WRONG_TABLE_NAME, MYF(0), $1.str); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5996 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5997 |
}
|
5998 |
$$=$3; |
|
5999 |
}
|
|
6000 |
| '.' ident { $$=$2;} /* For Delphi */ |
|
6001 |
;
|
|
6002 |
||
6003 |
table_ident: |
|
6004 |
ident { $$=new Table_ident($1); } |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6005 |
| ident '.' ident { $$=new Table_ident(YYSession, $1,$3,0);} |
1
by brian
clean slate |
6006 |
| '.' ident { $$=new Table_ident($2);} /* For Delphi */ |
6007 |
;
|
|
6008 |
||
6009 |
IDENT_sys: |
|
6010 |
IDENT { $$= $1; } |
|
6011 |
| IDENT_QUOTED |
|
6012 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6013 |
Session *session= YYSession; |
1
by brian
clean slate |
6014 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6015 |
if (session->charset_is_system_charset) |
1
by brian
clean slate |
6016 |
{
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
6017 |
const CHARSET_INFO * const cs= system_charset_info; |
1
by brian
clean slate |
6018 |
int dummy_error; |
482
by Brian Aker
Remove uint. |
6019 |
uint32_t wlen= cs->cset->well_formed_len(cs, $1.str, |
1
by brian
clean slate |
6020 |
$1.str+$1.length, |
6021 |
$1.length, &dummy_error); |
|
6022 |
if (wlen < $1.length) |
|
6023 |
{
|
|
6024 |
my_error(ER_INVALID_CHARACTER_STRING, MYF(0), |
|
6025 |
cs->csname, $1.str + wlen); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
6026 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
6027 |
}
|
6028 |
$$= $1; |
|
6029 |
}
|
|
6030 |
else
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6031 |
session->convert_string(&$$, system_charset_info, |
6032 |
$1.str, $1.length, session->charset()); |
|
1
by brian
clean slate |
6033 |
}
|
6034 |
;
|
|
6035 |
||
6036 |
TEXT_STRING_sys: |
|
6037 |
TEXT_STRING
|
|
6038 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6039 |
Session *session= YYSession; |
1
by brian
clean slate |
6040 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6041 |
if (session->charset_is_system_charset) |
1
by brian
clean slate |
6042 |
$$= $1; |
6043 |
else
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6044 |
session->convert_string(&$$, system_charset_info, |
6045 |
$1.str, $1.length, session->charset()); |
|
1
by brian
clean slate |
6046 |
}
|
6047 |
;
|
|
6048 |
||
6049 |
TEXT_STRING_literal: |
|
6050 |
TEXT_STRING
|
|
6051 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6052 |
Session *session= YYSession; |
1
by brian
clean slate |
6053 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6054 |
if (session->charset_is_collation_connection) |
1
by brian
clean slate |
6055 |
$$= $1; |
6056 |
else
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6057 |
session->convert_string(&$$, session->variables.collation_connection, |
6058 |
$1.str, $1.length, session->charset()); |
|
1
by brian
clean slate |
6059 |
}
|
6060 |
;
|
|
6061 |
||
6062 |
TEXT_STRING_filesystem: |
|
6063 |
TEXT_STRING
|
|
6064 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6065 |
Session *session= YYSession; |
1
by brian
clean slate |
6066 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6067 |
if (session->charset_is_character_set_filesystem) |
1
by brian
clean slate |
6068 |
$$= $1; |
6069 |
else
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6070 |
session->convert_string(&$$, session->variables.character_set_filesystem, |
6071 |
$1.str, $1.length, session->charset()); |
|
1
by brian
clean slate |
6072 |
}
|
6073 |
;
|
|
6074 |
||
6075 |
ident: |
|
6076 |
IDENT_sys { $$=$1; } |
|
6077 |
| keyword |
|
6078 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6079 |
Session *session= YYSession; |
6080 |
$$.str= session->strmake($1.str, $1.length); |
|
1
by brian
clean slate |
6081 |
$$.length= $1.length; |
6082 |
}
|
|
6083 |
;
|
|
6084 |
||
6085 |
ident_or_text: |
|
6086 |
ident { $$=$1;} |
|
6087 |
| TEXT_STRING_sys { $$=$1;} |
|
6088 |
| LEX_HOSTNAME { $$=$1;} |
|
6089 |
;
|
|
6090 |
||
6091 |
/* Keyword that we allow for identifiers (except SP labels) */ |
|
6092 |
keyword: |
|
6093 |
keyword_sp {} |
|
6094 |
| ASCII_SYM {} |
|
6095 |
| BEGIN_SYM {} |
|
6096 |
| BYTE_SYM {} |
|
6097 |
| CACHE_SYM {} |
|
6098 |
| CHARSET {} |
|
6099 |
| CHECKSUM_SYM {} |
|
6100 |
| CLOSE_SYM {} |
|
6101 |
| COMMENT_SYM {} |
|
6102 |
| COMMIT_SYM {} |
|
6103 |
| CONTAINS_SYM {} |
|
6104 |
| DEALLOCATE_SYM {} |
|
6105 |
| END {} |
|
6106 |
| FLUSH_SYM {} |
|
6107 |
| HANDLER_SYM {} |
|
6108 |
| HOST_SYM {} |
|
6109 |
| INSTALL_SYM {} |
|
6110 |
| NO_SYM {} |
|
6111 |
| OPEN_SYM {} |
|
6112 |
| OPTIONS_SYM {} |
|
6113 |
| PORT_SYM {} |
|
6114 |
| REMOVE_SYM {} |
|
6115 |
| REPAIR {} |
|
6116 |
| RESET_SYM {} |
|
6117 |
| ROLLBACK_SYM {} |
|
6118 |
| SAVEPOINT_SYM {} |
|
6119 |
| SECURITY_SYM {} |
|
6120 |
| SERVER_SYM {} |
|
6121 |
| SOCKET_SYM {} |
|
6122 |
| SLAVE {} |
|
6123 |
| SONAME_SYM {} |
|
6124 |
| START_SYM {} |
|
6125 |
| STOP_SYM {} |
|
6126 |
| TRUNCATE_SYM {} |
|
6127 |
| UPGRADE_SYM {} |
|
6128 |
;
|
|
6129 |
||
6130 |
/*
|
|
6131 |
* Keywords that we allow for labels in SPs. |
|
6132 |
* Anything that's the beginning of a statement or characteristics |
|
6133 |
* must be in keyword above, otherwise we get (harmful) shift/reduce |
|
6134 |
* conflicts. |
|
6135 |
*/
|
|
6136 |
keyword_sp: |
|
6137 |
ACTION {} |
|
6138 |
| ADDDATE_SYM {} |
|
6139 |
| AFTER_SYM {} |
|
6140 |
| AGGREGATE_SYM {} |
|
6141 |
| ALGORITHM_SYM {} |
|
6142 |
| ANY_SYM {} |
|
6143 |
| AT_SYM {} |
|
6144 |
| AUTHORS_SYM {} |
|
6145 |
| AUTO_INC {} |
|
6146 |
| AUTOEXTEND_SIZE_SYM {} |
|
6147 |
| AVG_ROW_LENGTH {} |
|
6148 |
| AVG_SYM {} |
|
6149 |
| BINLOG_SYM {} |
|
6150 |
| BIT_SYM {} |
|
244.1.1
by Harrison Fisk
Port Ebay/Google memory storage engine variable width columns. |
6151 |
| BLOCK_SIZE_SYM {} |
1
by brian
clean slate |
6152 |
| BLOCK_SYM {} |
6153 |
| BOOL_SYM {} |
|
6154 |
| BOOLEAN_SYM {} |
|
6155 |
| BTREE_SYM {} |
|
6156 |
| CASCADED {} |
|
6157 |
| CHAIN_SYM {} |
|
6158 |
| CHANGED {} |
|
6159 |
| COALESCE {} |
|
6160 |
| COLLATION_SYM {} |
|
6161 |
| COLUMN_FORMAT_SYM {} |
|
6162 |
| COLUMNS {} |
|
6163 |
| COMMITTED_SYM {} |
|
6164 |
| COMPACT_SYM {} |
|
6165 |
| COMPLETION_SYM {} |
|
6166 |
| COMPRESSED_SYM {} |
|
6167 |
| CONCURRENT {} |
|
6168 |
| CONNECTION_SYM {} |
|
6169 |
| CONSISTENT_SYM {} |
|
6170 |
| CONTEXT_SYM {} |
|
6171 |
| CUBE_SYM {} |
|
6172 |
| DATA_SYM {} |
|
6173 |
| DATAFILE_SYM {} |
|
6174 |
| DATETIME {} |
|
6175 |
| DATE_SYM {} |
|
6176 |
| DAY_SYM {} |
|
6177 |
| DELAY_KEY_WRITE_SYM {} |
|
6178 |
| DIRECTORY_SYM {} |
|
6179 |
| DISABLE_SYM {} |
|
6180 |
| DISCARD {} |
|
6181 |
| DUMPFILE {} |
|
6182 |
| DUPLICATE_SYM {} |
|
6183 |
| DYNAMIC_SYM {} |
|
6184 |
| ENDS_SYM {} |
|
6185 |
| ENUM {} |
|
6186 |
| ENGINE_SYM {} |
|
6187 |
| ERRORS {} |
|
6188 |
| ESCAPE_SYM {} |
|
6189 |
| EXCLUSIVE_SYM {} |
|
6190 |
| EXTENDED_SYM {} |
|
6191 |
| EXTENT_SIZE_SYM {} |
|
6192 |
| FAULTS_SYM {} |
|
6193 |
| FAST_SYM {} |
|
6194 |
| FOUND_SYM {} |
|
6195 |
| ENABLE_SYM {} |
|
6196 |
| FULL {} |
|
6197 |
| FILE_SYM {} |
|
6198 |
| FIRST_SYM {} |
|
6199 |
| FIXED_SYM {} |
|
6200 |
| FRAC_SECOND_SYM {} |
|
6201 |
| GET_FORMAT {} |
|
6202 |
| GLOBAL_SYM {} |
|
6203 |
| HASH_SYM {} |
|
6204 |
| HOSTS_SYM {} |
|
6205 |
| HOUR_SYM {} |
|
6206 |
| IDENTIFIED_SYM {} |
|
6207 |
| IMPORT {} |
|
6208 |
| INDEXES {} |
|
6209 |
| INITIAL_SIZE_SYM {} |
|
6210 |
| ISOLATION {} |
|
6211 |
| INSERT_METHOD {} |
|
6212 |
| KEY_BLOCK_SIZE {} |
|
6213 |
| LAST_SYM {} |
|
6214 |
| LEAVES {} |
|
6215 |
| LEVEL_SYM {} |
|
6216 |
| LINESTRING {} |
|
6217 |
| LIST_SYM {} |
|
6218 |
| LOCAL_SYM {} |
|
6219 |
| LOCKS_SYM {} |
|
6220 |
| LOGFILE_SYM {} |
|
6221 |
| LOGS_SYM {} |
|
6222 |
| MAX_ROWS {} |
|
6223 |
| MASTER_SYM {} |
|
6224 |
| MASTER_HOST_SYM {} |
|
6225 |
| MASTER_PORT_SYM {} |
|
6226 |
| MASTER_LOG_FILE_SYM {} |
|
6227 |
| MASTER_LOG_POS_SYM {} |
|
6228 |
| MASTER_USER_SYM {} |
|
6229 |
| MASTER_PASSWORD_SYM {} |
|
6230 |
| MASTER_SERVER_ID_SYM {} |
|
6231 |
| MASTER_CONNECT_RETRY_SYM {} |
|
6232 |
| MAX_CONNECTIONS_PER_HOUR {} |
|
6233 |
| MAX_QUERIES_PER_HOUR {} |
|
6234 |
| MAX_SIZE_SYM {} |
|
6235 |
| MAX_UPDATES_PER_HOUR {} |
|
6236 |
| MAX_USER_CONNECTIONS_SYM {} |
|
6237 |
| MAX_VALUE_SYM {} |
|
6238 |
| MEDIUM_SYM {} |
|
6239 |
| MERGE_SYM {} |
|
6240 |
| MICROSECOND_SYM {} |
|
6241 |
| MIGRATE_SYM {} |
|
6242 |
| MINUTE_SYM {} |
|
6243 |
| MIN_ROWS {} |
|
6244 |
| MODIFY_SYM {} |
|
6245 |
| MODE_SYM {} |
|
6246 |
| MONTH_SYM {} |
|
6247 |
| NAME_SYM {} |
|
6248 |
| NAMES_SYM {} |
|
6249 |
| NATIONAL_SYM {} |
|
6250 |
| NEXT_SYM {} |
|
6251 |
| NEW_SYM {} |
|
6252 |
| NO_WAIT_SYM {} |
|
6253 |
| NODEGROUP_SYM {} |
|
6254 |
| NONE_SYM {} |
|
6255 |
| NOWAIT_SYM {} |
|
6256 |
| OFFLINE_SYM {} |
|
6257 |
| OFFSET_SYM {} |
|
6258 |
| ONE_SHOT_SYM {} |
|
6259 |
| ONE_SYM {} |
|
6260 |
| ONLINE_SYM {} |
|
6261 |
| PACK_KEYS_SYM {} |
|
6262 |
| PAGE_SYM {} |
|
6263 |
| PAGE_CHECKSUM_SYM {} |
|
6264 |
| PARTIAL {} |
|
6265 |
| PHASE_SYM {} |
|
6266 |
| PLUGIN_SYM {} |
|
6267 |
| PLUGINS_SYM {} |
|
6268 |
| POINT_SYM {} |
|
6269 |
| PREV_SYM {} |
|
6270 |
| PROCESS {} |
|
6271 |
| PROCESSLIST_SYM {} |
|
6272 |
| QUARTER_SYM {} |
|
6273 |
| QUERY_SYM {} |
|
6274 |
| QUICK {} |
|
6275 |
| READ_ONLY_SYM {} |
|
6276 |
| REBUILD_SYM {} |
|
6277 |
| RECOVER_SYM {} |
|
6278 |
| REDO_BUFFER_SIZE_SYM {} |
|
6279 |
| REDOFILE_SYM {} |
|
6280 |
| REDUNDANT_SYM {} |
|
6281 |
| RELAY_LOG_FILE_SYM {} |
|
6282 |
| RELAY_LOG_POS_SYM {} |
|
6283 |
| RELAY_THREAD {} |
|
6284 |
| RELOAD {} |
|
6285 |
| REORGANIZE_SYM {} |
|
6286 |
| REPEATABLE_SYM {} |
|
6287 |
| REPLICATION {} |
|
6288 |
| RESOURCES {} |
|
6289 |
| RESUME_SYM {} |
|
6290 |
| RETURNS_SYM {} |
|
6291 |
| REVERSE_SYM {} |
|
6292 |
| ROLLUP_SYM {} |
|
6293 |
| ROUTINE_SYM {} |
|
6294 |
| ROWS_SYM {} |
|
6295 |
| ROW_FORMAT_SYM {} |
|
6296 |
| ROW_SYM {} |
|
6297 |
| SECOND_SYM {} |
|
6298 |
| SERIAL_SYM {} |
|
6299 |
| SERIALIZABLE_SYM {} |
|
6300 |
| SESSION_SYM {} |
|
6301 |
| SIMPLE_SYM {} |
|
6302 |
| SHARE_SYM {} |
|
6303 |
| SHUTDOWN {} |
|
6304 |
| SNAPSHOT_SYM {} |
|
6305 |
| SOURCE_SYM {} |
|
6306 |
| SQL_BUFFER_RESULT {} |
|
6307 |
| SQL_THREAD {} |
|
6308 |
| STARTS_SYM {} |
|
6309 |
| STATUS_SYM {} |
|
6310 |
| STORAGE_SYM {} |
|
6311 |
| STRING_SYM {} |
|
6312 |
| SUBDATE_SYM {} |
|
6313 |
| SUBJECT_SYM {} |
|
6314 |
| SUPER_SYM {} |
|
6315 |
| SUSPEND_SYM {} |
|
6316 |
| SWAPS_SYM {} |
|
6317 |
| SWITCHES_SYM {} |
|
6318 |
| TABLES {} |
|
6319 |
| TABLE_CHECKSUM_SYM {} |
|
108
by Brian Aker
Removed unwanted ALTER TABLESPACE, left in valuable bits. |
6320 |
| TABLESPACE {} |
1
by brian
clean slate |
6321 |
| TEMPORARY {} |
6322 |
| TEMPTABLE_SYM {} |
|
6323 |
| TEXT_SYM {} |
|
6324 |
| THAN_SYM {} |
|
6325 |
| TRANSACTION_SYM {} |
|
6326 |
| TRANSACTIONAL_SYM {} |
|
6327 |
| TIMESTAMP {} |
|
6328 |
| TIMESTAMP_ADD {} |
|
6329 |
| TIMESTAMP_DIFF {} |
|
6330 |
| TIME_SYM {} |
|
6331 |
| TYPES_SYM {} |
|
6332 |
| TYPE_SYM {} |
|
6333 |
| UNCOMMITTED_SYM {} |
|
6334 |
| UNDEFINED_SYM {} |
|
6335 |
| UNDOFILE_SYM {} |
|
6336 |
| UNKNOWN_SYM {} |
|
6337 |
| UNTIL_SYM {} |
|
6338 |
| USER {} |
|
6339 |
| USE_FRM {} |
|
6340 |
| VARIABLES {} |
|
6341 |
| VALUE_SYM {} |
|
6342 |
| WARNINGS {} |
|
6343 |
| WAIT_SYM {} |
|
6344 |
| WEEK_SYM {} |
|
6345 |
| WEIGHT_STRING_SYM {} |
|
6346 |
| WORK_SYM {} |
|
6347 |
| YEAR_SYM {} |
|
6348 |
;
|
|
6349 |
||
6350 |
/* Option functions */ |
|
6351 |
||
6352 |
set: |
|
6353 |
SET opt_option |
|
6354 |
{
|
|
6355 |
LEX *lex=Lex; |
|
6356 |
lex->sql_command= SQLCOM_SET_OPTION; |
|
6357 |
mysql_init_select(lex); |
|
6358 |
lex->option_type=OPT_SESSION; |
|
6359 |
lex->var_list.empty(); |
|
6360 |
lex->one_shot_set= 0; |
|
6361 |
lex->autocommit= 0; |
|
6362 |
}
|
|
6363 |
option_value_list
|
|
6364 |
{}
|
|
6365 |
;
|
|
6366 |
||
6367 |
opt_option: |
|
6368 |
/* empty */ {} |
|
6369 |
| OPTION {} |
|
6370 |
;
|
|
6371 |
||
6372 |
option_value_list: |
|
6373 |
option_type_value
|
|
6374 |
| option_value_list ',' option_type_value |
|
6375 |
;
|
|
6376 |
||
6377 |
option_type_value: |
|
6378 |
{
|
|
6379 |
}
|
|
6380 |
ext_option_value
|
|
6381 |
{
|
|
6382 |
}
|
|
6383 |
;
|
|
6384 |
||
6385 |
option_type: |
|
6386 |
option_type2 {} |
|
6387 |
| GLOBAL_SYM { $$=OPT_GLOBAL; } |
|
6388 |
| LOCAL_SYM { $$=OPT_SESSION; } |
|
6389 |
| SESSION_SYM { $$=OPT_SESSION; } |
|
6390 |
;
|
|
6391 |
||
6392 |
option_type2: |
|
6393 |
/* empty */ { $$= OPT_DEFAULT; } |
|
6394 |
| ONE_SHOT_SYM { Lex->one_shot_set= 1; $$= OPT_SESSION; } |
|
6395 |
;
|
|
6396 |
||
6397 |
opt_var_type: |
|
6398 |
/* empty */ { $$=OPT_SESSION; } |
|
6399 |
| GLOBAL_SYM { $$=OPT_GLOBAL; } |
|
6400 |
| LOCAL_SYM { $$=OPT_SESSION; } |
|
6401 |
| SESSION_SYM { $$=OPT_SESSION; } |
|
6402 |
;
|
|
6403 |
||
6404 |
opt_var_ident_type: |
|
6405 |
/* empty */ { $$=OPT_DEFAULT; } |
|
6406 |
| GLOBAL_SYM '.' { $$=OPT_GLOBAL; } |
|
6407 |
| LOCAL_SYM '.' { $$=OPT_SESSION; } |
|
6408 |
| SESSION_SYM '.' { $$=OPT_SESSION; } |
|
6409 |
;
|
|
6410 |
||
6411 |
ext_option_value: |
|
6412 |
sys_option_value
|
|
6413 |
| option_type2 option_value |
|
6414 |
;
|
|
6415 |
||
6416 |
sys_option_value: |
|
6417 |
option_type internal_variable_name equal set_expr_or_default |
|
6418 |
{
|
|
6419 |
LEX *lex=Lex; |
|
6420 |
||
6421 |
if ($2.var) |
|
6422 |
{ /* System variable */ |
|
6423 |
if ($1) |
|
6424 |
lex->option_type= $1; |
|
6425 |
lex->var_list.push_back(new set_var(lex->option_type, $2.var, |
|
6426 |
&$2.base_name, $4)); |
|
6427 |
}
|
|
6428 |
}
|
|
6429 |
| option_type TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types |
|
6430 |
{
|
|
6431 |
LEX *lex=Lex; |
|
6432 |
lex->option_type= $1; |
|
6433 |
lex->var_list.push_back(new set_var(lex->option_type, |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6434 |
find_sys_var(YYSession, "tx_isolation"), |
1
by brian
clean slate |
6435 |
&null_lex_str, |
205
by Brian Aker
uint32 -> uin32_t |
6436 |
new Item_int((int32_t) $5))); |
1
by brian
clean slate |
6437 |
}
|
6438 |
;
|
|
6439 |
||
6440 |
option_value: |
|
6441 |
'@' ident_or_text equal expr |
|
6442 |
{
|
|
6443 |
Lex->var_list.push_back(new set_var_user(new Item_func_set_user_var($2,$4))); |
|
6444 |
}
|
|
6445 |
| '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default |
|
6446 |
{
|
|
6447 |
LEX *lex=Lex; |
|
6448 |
lex->var_list.push_back(new set_var($3, $4.var, &$4.base_name, $6)); |
|
6449 |
}
|
|
383.1.27
by Brian Aker
Next pass in the unending saga of UTF-8.. now we can set in SQL collation |
6450 |
| NAMES_SYM COLLATE_SYM collation_name_or_default |
1
by brian
clean slate |
6451 |
{
|
6452 |
LEX *lex= Lex; |
|
383.1.27
by Brian Aker
Next pass in the unending saga of UTF-8.. now we can set in SQL collation |
6453 |
$3= $3 ? $3 : global_system_variables.character_set_client; |
1
by brian
clean slate |
6454 |
lex->var_list.push_back(new set_var_collation_client($3,$3,$3)); |
6455 |
}
|
|
6456 |
;
|
|
6457 |
||
6458 |
internal_variable_name: |
|
6459 |
ident
|
|
6460 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6461 |
Session *session= YYSession; |
1
by brian
clean slate |
6462 |
|
6463 |
/* We have to lookup here since local vars can shadow sysvars */ |
|
6464 |
{
|
|
6465 |
/* Not an SP local variable */ |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6466 |
sys_var *tmp=find_sys_var(session, $1.str, $1.length); |
1
by brian
clean slate |
6467 |
if (!tmp) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
6468 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
6469 |
$$.var= tmp; |
6470 |
$$.base_name= null_lex_str; |
|
6471 |
}
|
|
6472 |
}
|
|
6473 |
| ident '.' ident |
|
6474 |
{
|
|
6475 |
if (check_reserved_words(&$1)) |
|
6476 |
{
|
|
6477 |
my_parse_error(ER(ER_SYNTAX_ERROR)); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
6478 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
6479 |
}
|
6480 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6481 |
sys_var *tmp=find_sys_var(YYSession, $3.str, $3.length); |
1
by brian
clean slate |
6482 |
if (!tmp) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
6483 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
6484 |
if (!tmp->is_struct()) |
6485 |
my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), $3.str); |
|
6486 |
$$.var= tmp; |
|
6487 |
$$.base_name= $1; |
|
6488 |
}
|
|
6489 |
}
|
|
6490 |
| DEFAULT '.' ident |
|
6491 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6492 |
sys_var *tmp=find_sys_var(YYSession, $3.str, $3.length); |
1
by brian
clean slate |
6493 |
if (!tmp) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
6494 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
6495 |
if (!tmp->is_struct()) |
6496 |
my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), $3.str); |
|
6497 |
$$.var= tmp; |
|
6498 |
$$.base_name.str= (char*) "default"; |
|
6499 |
$$.base_name.length= 7; |
|
6500 |
}
|
|
6501 |
;
|
|
6502 |
||
6503 |
isolation_types: |
|
6504 |
READ_SYM UNCOMMITTED_SYM { $$= ISO_READ_UNCOMMITTED; } |
|
6505 |
| READ_SYM COMMITTED_SYM { $$= ISO_READ_COMMITTED; } |
|
6506 |
| REPEATABLE_SYM READ_SYM { $$= ISO_REPEATABLE_READ; } |
|
6507 |
| SERIALIZABLE_SYM { $$= ISO_SERIALIZABLE; } |
|
6508 |
;
|
|
6509 |
||
6510 |
set_expr_or_default: |
|
6511 |
expr { $$=$1; } |
|
6512 |
| DEFAULT { $$=0; } |
|
6513 |
| ON { $$=new Item_string("ON", 2, system_charset_info); } |
|
6514 |
| ALL { $$=new Item_string("ALL", 3, system_charset_info); } |
|
6515 |
| BINARY { $$=new Item_string("binary", 6, system_charset_info); } |
|
6516 |
;
|
|
6517 |
||
6518 |
/* Lock function */ |
|
6519 |
||
6520 |
lock: |
|
6521 |
LOCK_SYM
|
|
6522 |
{
|
|
6523 |
/*
|
|
6524 |
Transactional locks can be taken only if all requested locks |
|
6525 |
are transactional. Initialize lex->lock_transactional as |
|
6526 |
TRUE. Any non-transactional lock request turns this to FALSE. |
|
6527 |
Table specific variables keep track of the locking method |
|
6528 |
requested for the table. This is used to warn about a |
|
6529 |
changed locking method later. |
|
6530 |
*/
|
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
6531 |
Lex->lock_transactional= true; |
1
by brian
clean slate |
6532 |
}
|
6533 |
table_or_tables
|
|
6534 |
{
|
|
6535 |
LEX *lex= Lex; |
|
6536 |
lex->sql_command= SQLCOM_LOCK_TABLES; |
|
6537 |
}
|
|
6538 |
table_lock_list
|
|
6539 |
{}
|
|
6540 |
;
|
|
6541 |
||
6542 |
table_or_tables: |
|
6543 |
TABLE_SYM
|
|
6544 |
| TABLES |
|
6545 |
;
|
|
6546 |
||
6547 |
table_lock_list: |
|
6548 |
table_lock
|
|
6549 |
| table_lock_list ',' table_lock |
|
6550 |
;
|
|
6551 |
||
6552 |
table_lock: |
|
6553 |
table_ident opt_table_alias table_lock_info |
|
6554 |
{
|
|
327.2.5
by Brian Aker
Refactoring show command |
6555 |
TableList *tlist; |
520.1.22
by Brian Aker
Second pass of thd cleanup |
6556 |
if (!(tlist= Select->add_table_to_list(YYSession, $1, $2, 0, |
1
by brian
clean slate |
6557 |
$3.lock_type))) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
6558 |
DRIZZLE_YYABORT; /* purecov: inspected */ |
1
by brian
clean slate |
6559 |
tlist->lock_timeout= $3.lock_timeout; |
6560 |
/* Store the requested lock method for later warning. */ |
|
6561 |
tlist->lock_transactional= $3.lock_transactional; |
|
6562 |
/* Compute the resulting lock method for all tables. */ |
|
6563 |
if (!$3.lock_transactional) |
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
6564 |
Lex->lock_transactional= false; |
1
by brian
clean slate |
6565 |
}
|
6566 |
;
|
|
6567 |
||
6568 |
table_lock_info: |
|
6569 |
READ_SYM
|
|
6570 |
{
|
|
6571 |
$$.lock_type= TL_READ_NO_INSERT; |
|
6572 |
$$.lock_timeout= -1; |
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
6573 |
$$.lock_transactional= false; |
1
by brian
clean slate |
6574 |
}
|
6575 |
| WRITE_SYM |
|
6576 |
{
|
|
6577 |
$$.lock_type= TL_WRITE_DEFAULT; |
|
6578 |
$$.lock_timeout= -1; |
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
6579 |
$$.lock_transactional= false; |
1
by brian
clean slate |
6580 |
}
|
6581 |
| LOW_PRIORITY WRITE_SYM |
|
6582 |
{
|
|
6583 |
$$.lock_type= TL_WRITE_LOW_PRIORITY; |
|
6584 |
$$.lock_timeout= -1; |
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
6585 |
$$.lock_transactional= false; |
1
by brian
clean slate |
6586 |
}
|
6587 |
| READ_SYM LOCAL_SYM |
|
6588 |
{
|
|
6589 |
$$.lock_type= TL_READ; |
|
6590 |
$$.lock_timeout= -1; |
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
6591 |
$$.lock_transactional= false; |
1
by brian
clean slate |
6592 |
}
|
6593 |
| IN_SYM transactional_lock_mode MODE_SYM opt_transactional_lock_timeout |
|
6594 |
{
|
|
6595 |
$$.lock_type= $2; |
|
6596 |
$$.lock_timeout= $4; |
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
6597 |
$$.lock_transactional= true; |
1
by brian
clean slate |
6598 |
}
|
6599 |
;
|
|
6600 |
||
6601 |
/* Use thr_lock_type here for easier fallback to non-trans locking. */ |
|
6602 |
transactional_lock_mode: |
|
6603 |
SHARE_SYM { $$= TL_READ_NO_INSERT; } |
|
6604 |
| EXCLUSIVE_SYM { $$= TL_WRITE_DEFAULT; } |
|
6605 |
;
|
|
6606 |
||
6607 |
opt_transactional_lock_timeout: |
|
6608 |
/* empty */ { $$= -1; } |
|
6609 |
| NOWAIT_SYM { $$= 0; } |
|
6610 |
/* | WAIT_SYM opt_lock_timeout_value { $$= $2; } */ |
|
6611 |
;
|
|
6612 |
||
6613 |
/*
|
|
6614 |
We have a timeout resolution of milliseconds. The WAIT argument is in |
|
6615 |
seconds with decimal fragments for sub-second resolution. E.g. 22.5, 0.015 |
|
6616 |
*/
|
|
6617 |
/* opt_lock_timeout_value: */ |
|
6618 |
/* empty { $$= -1; } */ |
|
6619 |
/* | NUM { $$= (int) (atof($1.str) * 1000.0 + 0.5); } */ |
|
6620 |
||
6621 |
unlock: |
|
6622 |
UNLOCK_SYM
|
|
6623 |
{
|
|
6624 |
LEX *lex= Lex; |
|
6625 |
lex->sql_command= SQLCOM_UNLOCK_TABLES; |
|
6626 |
}
|
|
6627 |
table_or_tables
|
|
6628 |
{}
|
|
6629 |
;
|
|
6630 |
||
6631 |
begin: |
|
6632 |
BEGIN_SYM
|
|
6633 |
{
|
|
6634 |
LEX *lex=Lex; |
|
6635 |
lex->sql_command = SQLCOM_BEGIN; |
|
6636 |
lex->start_transaction_opt= 0; |
|
6637 |
}
|
|
6638 |
opt_work {} |
|
6639 |
;
|
|
6640 |
||
6641 |
opt_work: |
|
6642 |
/* empty */ {} |
|
6643 |
| WORK_SYM {} |
|
6644 |
;
|
|
6645 |
||
6646 |
opt_chain: |
|
6647 |
/* empty */ |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6648 |
{ $$= (YYSession->variables.completion_type == 1); } |
1
by brian
clean slate |
6649 |
| AND_SYM NO_SYM CHAIN_SYM { $$=0; } |
6650 |
| AND_SYM CHAIN_SYM { $$=1; } |
|
6651 |
;
|
|
6652 |
||
6653 |
opt_release: |
|
6654 |
/* empty */ |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6655 |
{ $$= (YYSession->variables.completion_type == 2); } |
1
by brian
clean slate |
6656 |
| RELEASE_SYM { $$=1; } |
6657 |
| NO_SYM RELEASE_SYM { $$=0; } |
|
6658 |
;
|
|
6659 |
||
6660 |
opt_savepoint: |
|
6661 |
/* empty */ {} |
|
6662 |
| SAVEPOINT_SYM {} |
|
6663 |
;
|
|
6664 |
||
6665 |
commit: |
|
6666 |
COMMIT_SYM opt_work opt_chain opt_release |
|
6667 |
{
|
|
6668 |
LEX *lex=Lex; |
|
6669 |
lex->sql_command= SQLCOM_COMMIT; |
|
6670 |
lex->tx_chain= $3; |
|
6671 |
lex->tx_release= $4; |
|
6672 |
}
|
|
6673 |
;
|
|
6674 |
||
6675 |
rollback: |
|
6676 |
ROLLBACK_SYM opt_work opt_chain opt_release |
|
6677 |
{
|
|
6678 |
LEX *lex=Lex; |
|
6679 |
lex->sql_command= SQLCOM_ROLLBACK; |
|
6680 |
lex->tx_chain= $3; |
|
6681 |
lex->tx_release= $4; |
|
6682 |
}
|
|
6683 |
| ROLLBACK_SYM opt_work |
|
6684 |
TO_SYM opt_savepoint ident |
|
6685 |
{
|
|
6686 |
LEX *lex=Lex; |
|
6687 |
lex->sql_command= SQLCOM_ROLLBACK_TO_SAVEPOINT; |
|
6688 |
lex->ident= $5; |
|
6689 |
}
|
|
6690 |
;
|
|
6691 |
||
6692 |
savepoint: |
|
6693 |
SAVEPOINT_SYM ident |
|
6694 |
{
|
|
6695 |
LEX *lex=Lex; |
|
6696 |
lex->sql_command= SQLCOM_SAVEPOINT; |
|
6697 |
lex->ident= $2; |
|
6698 |
}
|
|
6699 |
;
|
|
6700 |
||
6701 |
release: |
|
6702 |
RELEASE_SYM SAVEPOINT_SYM ident |
|
6703 |
{
|
|
6704 |
LEX *lex=Lex; |
|
6705 |
lex->sql_command= SQLCOM_RELEASE_SAVEPOINT; |
|
6706 |
lex->ident= $3; |
|
6707 |
}
|
|
6708 |
;
|
|
6709 |
||
6710 |
/*
|
|
6711 |
UNIONS : glue selects together |
|
6712 |
*/
|
|
6713 |
||
6714 |
||
6715 |
union_clause: |
|
6716 |
/* empty */ {} |
|
6717 |
| union_list |
|
6718 |
;
|
|
6719 |
||
6720 |
union_list: |
|
6721 |
UNION_SYM union_option |
|
6722 |
{
|
|
6723 |
if (add_select_to_union_list(Lex, (bool)$2)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
6724 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
6725 |
}
|
6726 |
select_init
|
|
6727 |
{
|
|
6728 |
/*
|
|
6729 |
Remove from the name resolution context stack the context of the |
|
6730 |
last select in the union. |
|
6731 |
*/
|
|
6732 |
Lex->pop_context(); |
|
6733 |
}
|
|
6734 |
;
|
|
6735 |
||
6736 |
union_opt: |
|
6737 |
/* Empty */ { $$= 0; } |
|
6738 |
| union_list { $$= 1; } |
|
6739 |
| union_order_or_limit { $$= 1; } |
|
6740 |
;
|
|
6741 |
||
6742 |
union_order_or_limit: |
|
6743 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6744 |
Session *session= YYSession; |
6745 |
LEX *lex= session->lex; |
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
6746 |
assert(lex->current_select->linkage != GLOBAL_OPTIONS_TYPE); |
1
by brian
clean slate |
6747 |
SELECT_LEX *sel= lex->current_select; |
6748 |
SELECT_LEX_UNIT *unit= sel->master_unit(); |
|
6749 |
SELECT_LEX *fake= unit->fake_select_lex; |
|
6750 |
if (fake) |
|
6751 |
{
|
|
6752 |
unit->global_parameters= fake; |
|
6753 |
fake->no_table_names_allowed= 1; |
|
6754 |
lex->current_select= fake; |
|
6755 |
}
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6756 |
session->where= "global ORDER clause"; |
1
by brian
clean slate |
6757 |
}
|
6758 |
order_or_limit
|
|
6759 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
6760 |
Session *session= YYSession; |
6761 |
session->lex->current_select->no_table_names_allowed= 0; |
|
6762 |
session->where= ""; |
|
1
by brian
clean slate |
6763 |
}
|
6764 |
;
|
|
6765 |
||
6766 |
order_or_limit: |
|
6767 |
order_clause opt_limit_clause_init |
|
6768 |
| limit_clause |
|
6769 |
;
|
|
6770 |
||
6771 |
union_option: |
|
6772 |
/* empty */ { $$=1; } |
|
6773 |
| DISTINCT { $$=1; } |
|
6774 |
| ALL { $$=0; } |
|
6775 |
;
|
|
6776 |
||
6777 |
query_specification: |
|
6778 |
SELECT_SYM select_init2_derived |
|
6779 |
{
|
|
6780 |
$$= Lex->current_select->master_unit()->first_select(); |
|
6781 |
}
|
|
6782 |
| '(' select_paren_derived ')' |
|
6783 |
{
|
|
6784 |
$$= Lex->current_select->master_unit()->first_select(); |
|
6785 |
}
|
|
6786 |
;
|
|
6787 |
||
6788 |
query_expression_body: |
|
6789 |
query_specification
|
|
6790 |
| query_expression_body |
|
6791 |
UNION_SYM union_option |
|
6792 |
{
|
|
6793 |
if (add_select_to_union_list(Lex, (bool)$3)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
6794 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
6795 |
}
|
6796 |
query_specification
|
|
6797 |
{
|
|
6798 |
Lex->pop_context(); |
|
6799 |
$$= $1; |
|
6800 |
}
|
|
6801 |
;
|
|
6802 |
||
6803 |
/* Corresponds to <query expression> in the SQL:2003 standard. */ |
|
6804 |
subselect: |
|
6805 |
subselect_start query_expression_body subselect_end |
|
6806 |
{
|
|
6807 |
$$= $2; |
|
6808 |
}
|
|
6809 |
;
|
|
6810 |
||
6811 |
subselect_start: |
|
6812 |
{
|
|
6813 |
LEX *lex=Lex; |
|
6814 |
if (!lex->expr_allows_subselect || |
|
6815 |
lex->sql_command == (int)SQLCOM_PURGE) |
|
6816 |
{
|
|
6817 |
my_parse_error(ER(ER_SYNTAX_ERROR)); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
6818 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
6819 |
}
|
6820 |
/*
|
|
6821 |
we are making a "derived table" for the parenthesis |
|
6822 |
as we need to have a lex level to fit the union |
|
6823 |
after the parenthesis, e.g. |
|
6824 |
(SELECT .. ) UNION ... becomes |
|
6825 |
SELECT * FROM ((SELECT ...) UNION ...) |
|
6826 |
*/
|
|
6827 |
if (mysql_new_select(Lex, 1)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
6828 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
6829 |
}
|
6830 |
;
|
|
6831 |
||
6832 |
subselect_end: |
|
6833 |
{
|
|
6834 |
LEX *lex=Lex; |
|
6835 |
lex->pop_context(); |
|
6836 |
SELECT_LEX *child= lex->current_select; |
|
6837 |
lex->current_select = lex->current_select->return_after_parsing(); |
|
6838 |
lex->nest_level--; |
|
6839 |
lex->current_select->n_child_sum_items += child->n_sum_items; |
|
6840 |
/*
|
|
6841 |
A subselect can add fields to an outer select. Reserve space for |
|
6842 |
them. |
|
6843 |
*/
|
|
6844 |
lex->current_select->select_n_where_fields+= |
|
6845 |
child->select_n_where_fields; |
|
6846 |
}
|
|
6847 |
;
|
|
6848 |
/**
|
|
6849 |
@} (end of group Parser) |
|
6850 |
*/
|