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 |
|
1802.10.2
by Monty Taylor
Update all of the copyright headers to include the correct address. |
14 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
1
by brian
clean slate |
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 |
*/
|
2172.3.8
by Brian Aker
Modernize our call to the parser, no more casting required. |
28 |
|
2172.3.9
by Brian Aker
Dead-ish the macro for YYSession since we no longer cast. |
29 |
#define YYSession (session)
|
1
by brian
clean slate |
30 |
|
77.1.45
by Monty Taylor
Warning fixes. |
31 |
#define YYENABLE_NLS 0
|
32 |
#define YYLTYPE_IS_TRIVIAL 0
|
|
33 |
||
1
by brian
clean slate |
34 |
#define YYINITDEPTH 100
|
35 |
#define YYMAXDEPTH 3200 /* Because of 64K stack */
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
36 |
#define Lex (session->lex())
|
1285
by Brian Aker
Remove giant include header to its own file. |
37 |
|
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
38 |
#include <config.h>
|
1530.5.10
by Monty Taylor
Fixed build errors on FreeBSD. |
39 |
#include <cstdio>
|
2172.3.6
by Brian Aker
Namespace the parser just a bit, and update our call for the type of parser |
40 |
#include <drizzled/parser.h>
|
2207.8.4
by Olaf van der Spek
Refactor includes |
41 |
#include <drizzled/session.h>
|
2198.1.1
by Olaf van der Spek
Remove unnecessary alter* includes |
42 |
#include <drizzled/alter_column.h>
|
43 |
#include <drizzled/alter_info.h>
|
|
2200.2.12
by Stewart Smith
set RenameTable and AlterKeysOnOff protobuf messages inside the AlterTable protobuf message for ALTER TABLE in parser |
44 |
#include <drizzled/message/alter_table.pb.h>
|
2198.1.2
by Olaf van der Spek
Refactor includes |
45 |
#include <drizzled/item/subselect.h>
|
2239.1.9
by Olaf van der Spek
Refactor includes |
46 |
#include <drizzled/table_ident.h>
|
2241.2.11
by Olaf van der Spek
Refactor |
47 |
#include <drizzled/var.h>
|
2241.3.2
by Olaf van der Spek
Refactor Session::variables |
48 |
#include <drizzled/system_variables.h>
|
1100.3.1
by Padraig O'Sullivan
Beginnings of reworking the mysql_execute_command() method. |
49 |
|
2172.3.10
by Brian Aker
Fix parser type to not be a void. |
50 |
int yylex(union ParserType *yylval, drizzled::Session *session);
|
1
by brian
clean slate |
51 |
|
52 |
#define yyoverflow(A,B,C,D,E,F) \
|
|
53 |
{ \
|
|
2104.3.1
by Brian Aker
Merge in ulong typedef used. |
54 |
unsigned long val= *(F); \
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
55 |
if (drizzled::my_yyoverflow((B), (D), &val)) \
|
1
by brian
clean slate |
56 |
{ \
|
2172.3.8
by Brian Aker
Modernize our call to the parser, no more casting required. |
57 |
yyerror(NULL, (char*) (A)); \
|
1
by brian
clean slate |
58 |
return 2; \
|
59 |
} \
|
|
60 |
else \
|
|
61 |
{ \
|
|
62 |
*(F)= (YYSIZE_T)val; \
|
|
63 |
} \
|
|
64 |
}
|
|
65 |
||
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
66 |
#define DRIZZLE_YYABORT \
|
1
by brian
clean slate |
67 |
do \
|
68 |
{ \
|
|
69 |
YYABORT; \
|
|
70 |
} while (0)
|
|
71 |
||
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
72 |
#define DRIZZLE_YYABORT_UNLESS(A) \
|
1
by brian
clean slate |
73 |
if (!(A)) \
|
74 |
{ \
|
|
2104.3.5
by Brian Aker
Fixed case where parser error message might be null. |
75 |
parser::my_parse_error(YYSession->m_lip);\
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
76 |
DRIZZLE_YYABORT; \
|
1
by brian
clean slate |
77 |
}
|
78 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
79 |
namespace drizzled
|
80 |
{
|
|
81 |
||
82 |
class Table_ident;
|
|
83 |
class Item;
|
|
84 |
class Item_num;
|
|
85 |
||
2035.1.2
by Brian Aker
Make the item call a bit friendlier. |
86 |
namespace item
|
87 |
{
|
|
88 |
class Boolean;
|
|
89 |
class True;
|
|
90 |
class False;
|
|
91 |
}
|
|
92 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
93 |
|
1
by brian
clean slate |
94 |
/**
|
95 |
@brief Bison callback to report a syntax/OOM error
|
|
96 |
||
97 |
This function is invoked by the bison-generated parser
|
|
98 |
when a syntax error, a parse error or an out-of-memory
|
|
99 |
condition occurs. This function is not invoked when the
|
|
100 |
parser is requested to abort by semantic action code
|
|
101 |
by means of YYABORT or YYACCEPT macros. This is why these
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
102 |
macros should not be used (use DRIZZLE_YYABORT/DRIZZLE_YYACCEPT
|
1
by brian
clean slate |
103 |
instead).
|
104 |
||
105 |
The parser will abort immediately after invoking this callback.
|
|
106 |
||
107 |
This function is not for use in semantic actions and is internal to
|
|
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
108 |
the parser, as it performs some pre-return cleanup.
|
2096.1.14
by Brian Aker
Pull in more C code from parser. |
109 |
In semantic actions, please use parser::my_parse_error or my_error to
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
110 |
push an error into the error stack and DRIZZLE_YYABORT
|
1
by brian
clean slate |
111 |
to abort from the parser.
|
112 |
*/
|
|
113 |
||
2172.3.8
by Brian Aker
Modernize our call to the parser, no more casting required. |
114 |
static void base_sql_error(drizzled::Session *session, const char *s)
|
1
by brian
clean slate |
115 |
{
|
2172.3.8
by Brian Aker
Modernize our call to the parser, no more casting required. |
116 |
parser::errorOn(session, s);
|
1300.4.2
by Stewart Smith
make REVERSE() a plugin instead of built in function. Generalise the code for such keyword functions otu into reserved_keyword_function() in sql_yacc. |
117 |
}
|
118 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
119 |
} /* namespace drizzled; */
|
120 |
||
121 |
using namespace drizzled;
|
|
1
by brian
clean slate |
122 |
%}
|
2172.3.10
by Brian Aker
Fix parser type to not be a void. |
123 |
%union ParserType {
|
2029.1.12
by Brian Aker
Merge in boolean type that has been added to the parser. |
124 |
bool boolean; |
1
by brian
clean slate |
125 |
int num; |
2104.3.1
by Brian Aker
Merge in ulong typedef used. |
126 |
unsigned long ulong_num; |
151
by Brian Aker
Ulonglong to uint64_t |
127 |
uint64_t ulonglong_number; |
154
by Brian Aker
Removed oddball types in my_global.h |
128 |
int64_t longlong_number; |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
129 |
drizzled::LEX_STRING lex_str; |
130 |
drizzled::LEX_STRING *lex_str_ptr; |
|
131 |
drizzled::LEX_SYMBOL symbol; |
|
132 |
drizzled::Table_ident *table; |
|
1
by brian
clean slate |
133 |
char *simple_string; |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
134 |
drizzled::Item *item; |
135 |
drizzled::Item_num *item_num; |
|
136 |
drizzled::List<drizzled::Item> *item_list; |
|
137 |
drizzled::List<drizzled::String> *string_list; |
|
138 |
drizzled::String *string; |
|
139 |
drizzled::Key_part_spec *key_part; |
|
140 |
const drizzled::plugin::Function *udf; |
|
141 |
drizzled::TableList *table_list; |
|
2096.1.15
by Brian Aker
Additional parser cleanup. |
142 |
drizzled::enum_field_types field_val; |
143 |
drizzled::sys_var_with_base variable; |
|
144 |
drizzled::sql_var_t var_type; |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
145 |
drizzled::Key::Keytype key_type; |
2096.1.15
by Brian Aker
Additional parser cleanup. |
146 |
drizzled::ha_key_alg key_alg; |
147 |
drizzled::ha_rkey_function ha_rkey_mode; |
|
148 |
drizzled::enum_tx_isolation tx_isolation; |
|
149 |
drizzled::Cast_target cast_type; |
|
2254
by Brian Aker
Shift CHARSET_INFO to charset_info_st |
150 |
const drizzled::charset_info_st *charset; |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
151 |
drizzled::thr_lock_type lock_type; |
152 |
drizzled::interval_type interval, interval_time_st; |
|
2088.8.9
by Brian Aker
Merge in namespace of enum. |
153 |
drizzled::type::timestamp_t date_time_type; |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
154 |
drizzled::Select_Lex *select_lex; |
155 |
drizzled::chooser_compare_func_creator boolfunc2creator; |
|
2252.1.25
by Olaf van der Spek
Common fwd |
156 |
drizzled::LEX *lex; |
2096.1.15
by Brian Aker
Additional parser cleanup. |
157 |
drizzled::index_hint_type index_hint; |
158 |
drizzled::enum_filetype filetype; |
|
1638.9.2
by Stewart Smith
use the ENUM in the table proto instead of duplicating it for Foreign key options and match option. A move in the direction of just having foreign keys in the proto |
159 |
drizzled::message::Table::ForeignKeyConstraint::ForeignKeyOption m_fk_option; |
1921.4.1
by Brian Aker
Adding in support for EXECUTE to have WITH NO RETURN. |
160 |
drizzled::execute_string_t execute_string; |
1
by brian
clean slate |
161 |
}
|
162 |
||
163 |
%{
|
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
164 |
namespace drizzled
|
165 |
{
|
|
2172.3.10
by Brian Aker
Fix parser type to not be a void. |
166 |
bool my_yyoverflow(short **a, union ParserType **b, unsigned long *yystacksize);
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
167 |
}
|
1
by brian
clean slate |
168 |
%}
|
169 |
||
2029.1.21
by Brian Aker
Reduce dependency on LEX_HOME. |
170 |
%debug
|
2178.1.3
by Brian Aker
Merge in additional throw back in syntax for bison |
171 |
%require "2.2"
|
2178.1.2
by Brian Aker
Go back a version and see if this will make the bison on RHEL happy. |
172 |
%pure-parser
|
2178.1.3
by Brian Aker
Merge in additional throw back in syntax for bison |
173 |
%name-prefix="base_sql_"
|
2172.3.8
by Brian Aker
Modernize our call to the parser, no more casting required. |
174 |
%parse-param { drizzled::Session *session }
|
2172.3.11
by Brian Aker
Fix lex to use modern param type add. |
175 |
%lex-param { drizzled::Session *session }
|
2172.3.12
by Brian Aker
Adding verbose to be explicit in the parser. |
176 |
%verbose
|
2172.3.8
by Brian Aker
Modernize our call to the parser, no more casting required. |
177 |
|
2029.1.21
by Brian Aker
Reduce dependency on LEX_HOME. |
178 |
|
1
by brian
clean slate |
179 |
/*
|
2068.6.2
by Brian Aker
Cleanup issue of OR in tests. |
180 |
Currently there are 70 shift/reduce conflicts. |
1
by brian
clean slate |
181 |
We should not introduce new conflicts any more. |
182 |
*/
|
|
2198.6.9
by Brian Aker
Break out index types. |
183 |
%expect 79
|
1
by brian
clean slate |
184 |
|
185 |
/*
|
|
186 |
Comments for TOKENS. |
|
187 |
For each token, please include in the same line a comment that contains |
|
188 |
the following tags: |
|
189 |
SQL-2003-R : Reserved keyword as per SQL-2003 |
|
190 |
SQL-2003-N : Non Reserved keyword as per SQL-2003 |
|
191 |
SQL-1999-R : Reserved keyword as per SQL-1999 |
|
192 |
SQL-1999-N : Non Reserved keyword as per SQL-1999 |
|
193 |
MYSQL : MySQL extention (unspecified) |
|
194 |
MYSQL-FUNC : MySQL extention, function |
|
195 |
INTERNAL : Not a real token, lex optimization |
|
196 |
OPERATOR : SQL operator |
|
197 |
FUTURE-USE : Reserved for futur use |
|
198 |
||
199 |
This makes the code grep-able, and helps maintenance. |
|
200 |
*/
|
|
201 |
||
202 |
%token ABORT_SYM /* INTERNAL (used in lex) */
|
|
203 |
%token ACTION /* SQL-2003-N */
|
|
2030.1.1
by Brian Aker
Small set of symbol updates. |
204 |
%token ADD_SYM /* SQL-2003-R */
|
1
by brian
clean slate |
205 |
%token ADDDATE_SYM /* MYSQL-FUNC */
|
206 |
%token AFTER_SYM /* SQL-2003-N */
|
|
207 |
%token AGGREGATE_SYM
|
|
208 |
%token ALL /* SQL-2003-R */
|
|
2030.1.1
by Brian Aker
Small set of symbol updates. |
209 |
%token ALTER_SYM /* SQL-2003-R */
|
1
by brian
clean slate |
210 |
%token ANALYZE_SYM
|
211 |
%token AND_SYM /* SQL-2003-R */
|
|
212 |
%token ANY_SYM /* SQL-2003-R */
|
|
213 |
%token AS /* SQL-2003-R */
|
|
214 |
%token ASC /* SQL-2003-N */
|
|
215 |
%token ASENSITIVE_SYM /* FUTURE-USE */
|
|
216 |
%token AT_SYM /* SQL-2003-R */
|
|
217 |
%token AUTO_INC
|
|
218 |
%token AVG_SYM /* SQL-2003-N */
|
|
219 |
%token BEFORE_SYM /* SQL-2003-N */
|
|
220 |
%token BEGIN_SYM /* SQL-2003-R */
|
|
221 |
%token BETWEEN_SYM /* SQL-2003-R */
|
|
1008.3.17
by Stewart Smith
Start work to construct table proto in parser: |
222 |
%token BIGINT_SYM /* SQL-2003-R */
|
1
by brian
clean slate |
223 |
%token BINARY /* SQL-2003-R */
|
224 |
%token BIN_NUM
|
|
225 |
%token BIT_SYM /* MYSQL-FUNC */
|
|
226 |
%token BLOB_SYM /* SQL-2003-R */
|
|
227 |
%token BOOLEAN_SYM /* SQL-2003-R */
|
|
228 |
%token BOOL_SYM
|
|
229 |
%token BOTH /* SQL-2003-R */
|
|
230 |
%token BTREE_SYM
|
|
231 |
%token BY /* SQL-2003-R */
|
|
232 |
%token CALL_SYM /* SQL-2003-R */
|
|
233 |
%token CASCADE /* SQL-2003-N */
|
|
234 |
%token CASCADED /* SQL-2003-R */
|
|
235 |
%token CASE_SYM /* SQL-2003-R */
|
|
236 |
%token CAST_SYM /* SQL-2003-R */
|
|
2073.1.2
by Brian Aker
Basic DDL for catalog. |
237 |
%token CATALOG_SYM
|
1
by brian
clean slate |
238 |
%token CHAIN_SYM /* SQL-2003-N */
|
2030.1.1
by Brian Aker
Small set of symbol updates. |
239 |
%token CHANGE_SYM
|
1
by brian
clean slate |
240 |
%token CHAR_SYM /* SQL-2003-R */
|
241 |
%token CHECKSUM_SYM
|
|
242 |
%token CHECK_SYM /* SQL-2003-R */
|
|
243 |
%token CLOSE_SYM /* SQL-2003-R */
|
|
244 |
%token COALESCE /* SQL-2003-N */
|
|
245 |
%token COLLATE_SYM /* SQL-2003-R */
|
|
246 |
%token COLLATION_SYM /* SQL-2003-N */
|
|
247 |
%token COLUMNS
|
|
248 |
%token COLUMN_SYM /* SQL-2003-R */
|
|
249 |
%token COMMENT_SYM
|
|
250 |
%token COMMITTED_SYM /* SQL-2003-N */
|
|
251 |
%token COMMIT_SYM /* SQL-2003-R */
|
|
252 |
%token COMPACT_SYM
|
|
253 |
%token COMPRESSED_SYM
|
|
254 |
%token CONCURRENT
|
|
255 |
%token CONDITION_SYM /* SQL-2003-N */
|
|
256 |
%token CONNECTION_SYM
|
|
257 |
%token CONSISTENT_SYM
|
|
258 |
%token CONSTRAINT /* SQL-2003-R */
|
|
259 |
%token CONTAINS_SYM /* SQL-2003-N */
|
|
260 |
%token CONVERT_SYM /* SQL-2003-N */
|
|
261 |
%token COUNT_SYM /* SQL-2003-N */
|
|
262 |
%token CREATE /* SQL-2003-R */
|
|
263 |
%token CROSS /* SQL-2003-R */
|
|
264 |
%token CUBE_SYM /* SQL-2003-R */
|
|
265 |
%token CURDATE /* MYSQL-FUNC */
|
|
266 |
%token CURRENT_USER /* SQL-2003-R */
|
|
267 |
%token CURSOR_SYM /* SQL-2003-R */
|
|
268 |
%token DATABASE
|
|
269 |
%token DATABASES
|
|
270 |
%token DATA_SYM /* SQL-2003-N */
|
|
1008.3.17
by Stewart Smith
Start work to construct table proto in parser: |
271 |
%token DATETIME_SYM
|
1
by brian
clean slate |
272 |
%token DATE_ADD_INTERVAL /* MYSQL-FUNC */
|
273 |
%token DATE_SUB_INTERVAL /* MYSQL-FUNC */
|
|
274 |
%token DATE_SYM /* SQL-2003-R */
|
|
275 |
%token DAY_HOUR_SYM
|
|
276 |
%token DAY_MICROSECOND_SYM
|
|
277 |
%token DAY_MINUTE_SYM
|
|
278 |
%token DAY_SECOND_SYM
|
|
279 |
%token DAY_SYM /* SQL-2003-R */
|
|
280 |
%token DEALLOCATE_SYM /* SQL-2003-R */
|
|
281 |
%token DECIMAL_NUM
|
|
282 |
%token DECIMAL_SYM /* SQL-2003-R */
|
|
283 |
%token DECLARE_SYM /* SQL-2003-R */
|
|
284 |
%token DEFAULT /* SQL-2003-R */
|
|
285 |
%token DELETE_SYM /* SQL-2003-R */
|
|
286 |
%token DESC /* SQL-2003-N */
|
|
287 |
%token DESCRIBE /* SQL-2003-R */
|
|
288 |
%token DETERMINISTIC_SYM /* SQL-2003-R */
|
|
289 |
%token DISABLE_SYM
|
|
290 |
%token DISCARD
|
|
291 |
%token DISTINCT /* SQL-2003-R */
|
|
292 |
%token DIV_SYM
|
|
2029.1.24
by Brian Aker
Reduce the conflicts based on engine options. |
293 |
%token DO_SYM
|
1
by brian
clean slate |
294 |
%token DOUBLE_SYM /* SQL-2003-R */
|
295 |
%token DROP /* SQL-2003-R */
|
|
296 |
%token DUMPFILE
|
|
297 |
%token DUPLICATE_SYM
|
|
298 |
%token DYNAMIC_SYM /* SQL-2003-R */
|
|
299 |
%token EACH_SYM /* SQL-2003-R */
|
|
300 |
%token ELSE /* SQL-2003-R */
|
|
301 |
%token ENABLE_SYM
|
|
302 |
%token ENCLOSED
|
|
303 |
%token END /* SQL-2003-R */
|
|
304 |
%token ENDS_SYM
|
|
305 |
%token END_OF_INPUT /* INTERNAL */
|
|
306 |
%token ENGINE_SYM
|
|
1008.3.17
by Stewart Smith
Start work to construct table proto in parser: |
307 |
%token ENUM_SYM
|
1
by brian
clean slate |
308 |
%token EQUAL_SYM /* OPERATOR */
|
309 |
%token ERRORS
|
|
310 |
%token ESCAPED
|
|
311 |
%token ESCAPE_SYM /* SQL-2003-R */
|
|
312 |
%token EXCLUSIVE_SYM
|
|
2029.1.25
by Brian Aker
Remove dead keywords from MySQL. |
313 |
%token EXECUTE_SYM /* SQL-2003-R */
|
1
by brian
clean slate |
314 |
%token EXISTS /* SQL-2003-R */
|
315 |
%token EXTENDED_SYM
|
|
316 |
%token EXTRACT_SYM /* SQL-2003-N */
|
|
317 |
%token FALSE_SYM /* SQL-2003-R */
|
|
318 |
%token FILE_SYM
|
|
319 |
%token FIRST_SYM /* SQL-2003-N */
|
|
320 |
%token FIXED_SYM
|
|
321 |
%token FLOAT_NUM
|
|
322 |
%token FLUSH_SYM
|
|
323 |
%token FORCE_SYM
|
|
324 |
%token FOREIGN /* SQL-2003-R */
|
|
325 |
%token FOR_SYM /* SQL-2003-R */
|
|
326 |
%token FOUND_SYM /* SQL-2003-R */
|
|
327 |
%token FRAC_SECOND_SYM
|
|
328 |
%token FROM
|
|
329 |
%token FULL /* SQL-2003-R */
|
|
330 |
%token GE
|
|
331 |
%token GLOBAL_SYM /* SQL-2003-R */
|
|
332 |
%token GROUP_SYM /* SQL-2003-R */
|
|
333 |
%token GROUP_CONCAT_SYM
|
|
334 |
%token HASH_SYM
|
|
335 |
%token HAVING /* SQL-2003-R */
|
|
336 |
%token HEX_NUM
|
|
337 |
%token HOUR_MICROSECOND_SYM
|
|
338 |
%token HOUR_MINUTE_SYM
|
|
339 |
%token HOUR_SECOND_SYM
|
|
340 |
%token HOUR_SYM /* SQL-2003-R */
|
|
341 |
%token IDENT
|
|
342 |
%token IDENTIFIED_SYM
|
|
2029.1.26
by Brian Aker
Merge in work for reserved words in SQL standard. |
343 |
%token IDENTITY_SYM /* SQL-2003-R */
|
1
by brian
clean slate |
344 |
%token IDENT_QUOTED
|
345 |
%token IF
|
|
346 |
%token IGNORE_SYM
|
|
347 |
%token IMPORT
|
|
348 |
%token INDEXES
|
|
349 |
%token INDEX_SYM
|
|
350 |
%token INFILE
|
|
351 |
%token INNER_SYM /* SQL-2003-R */
|
|
352 |
%token INOUT_SYM /* SQL-2003-R */
|
|
353 |
%token INSENSITIVE_SYM /* SQL-2003-R */
|
|
354 |
%token INSERT /* SQL-2003-R */
|
|
355 |
%token INTERVAL_SYM /* SQL-2003-R */
|
|
356 |
%token INTO /* SQL-2003-R */
|
|
357 |
%token INT_SYM /* SQL-2003-R */
|
|
358 |
%token IN_SYM /* SQL-2003-R */
|
|
359 |
%token IS /* SQL-2003-R */
|
|
360 |
%token ISOLATION /* SQL-2003-R */
|
|
361 |
%token ITERATE_SYM
|
|
362 |
%token JOIN_SYM /* SQL-2003-R */
|
|
363 |
%token KEYS
|
|
364 |
%token KEY_BLOCK_SIZE
|
|
365 |
%token KEY_SYM /* SQL-2003-N */
|
|
366 |
%token KILL_SYM
|
|
367 |
%token LAST_SYM /* SQL-2003-N */
|
|
368 |
%token LE /* OPERATOR */
|
|
369 |
%token LEADING /* SQL-2003-R */
|
|
370 |
%token LEFT /* SQL-2003-R */
|
|
371 |
%token LEVEL_SYM
|
|
372 |
%token LEX_HOSTNAME
|
|
373 |
%token LIKE /* SQL-2003-R */
|
|
374 |
%token LIMIT
|
|
375 |
%token LINES
|
|
376 |
%token LOAD
|
|
377 |
%token LOCAL_SYM /* SQL-2003-R */
|
|
378 |
%token LOCKS_SYM
|
|
379 |
%token LOCK_SYM
|
|
380 |
%token LOGS_SYM
|
|
381 |
%token LONG_NUM
|
|
382 |
%token LONG_SYM
|
|
383 |
%token MATCH /* SQL-2003-R */
|
|
384 |
%token MAX_SYM /* SQL-2003-N */
|
|
385 |
%token MAX_VALUE_SYM /* SQL-2003-N */
|
|
386 |
%token MEDIUM_SYM
|
|
387 |
%token MERGE_SYM /* SQL-2003-R */
|
|
388 |
%token MICROSECOND_SYM /* MYSQL-FUNC */
|
|
389 |
%token MINUTE_MICROSECOND_SYM
|
|
390 |
%token MINUTE_SECOND_SYM
|
|
391 |
%token MINUTE_SYM /* SQL-2003-R */
|
|
392 |
%token MIN_SYM /* SQL-2003-N */
|
|
393 |
%token MODE_SYM
|
|
394 |
%token MODIFIES_SYM /* SQL-2003-R */
|
|
395 |
%token MODIFY_SYM
|
|
396 |
%token MOD_SYM /* SQL-2003-N */
|
|
397 |
%token MONTH_SYM /* SQL-2003-R */
|
|
398 |
%token NAMES_SYM /* SQL-2003-N */
|
|
399 |
%token NAME_SYM /* SQL-2003-N */
|
|
400 |
%token NATIONAL_SYM /* SQL-2003-R */
|
|
401 |
%token NATURAL /* SQL-2003-R */
|
|
402 |
%token NE /* OPERATOR */
|
|
403 |
%token NEW_SYM /* SQL-2003-R */
|
|
404 |
%token NEXT_SYM /* SQL-2003-N */
|
|
405 |
%token NONE_SYM /* SQL-2003-R */
|
|
406 |
%token NOT_SYM /* SQL-2003-R */
|
|
407 |
%token NOW_SYM
|
|
408 |
%token NO_SYM /* SQL-2003-R */
|
|
409 |
%token NULL_SYM /* SQL-2003-R */
|
|
410 |
%token NUM
|
|
411 |
%token NUMERIC_SYM /* SQL-2003-R */
|
|
412 |
%token OFFLINE_SYM
|
|
413 |
%token OFFSET_SYM
|
|
414 |
%token ON /* SQL-2003-R */
|
|
415 |
%token ONE_SHOT_SYM
|
|
416 |
%token ONE_SYM
|
|
417 |
%token ONLINE_SYM
|
|
418 |
%token OPEN_SYM /* SQL-2003-R */
|
|
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
419 |
%token OPTIMIZE /* Leave assuming we might add it back */
|
1
by brian
clean slate |
420 |
%token OPTION /* SQL-2003-N */
|
421 |
%token OPTIONALLY
|
|
422 |
%token ORDER_SYM /* SQL-2003-R */
|
|
423 |
%token OR_SYM /* SQL-2003-R */
|
|
424 |
%token OUTER
|
|
425 |
%token OUTFILE
|
|
426 |
%token OUT_SYM /* SQL-2003-R */
|
|
427 |
%token PARTIAL /* SQL-2003-N */
|
|
428 |
%token POSITION_SYM /* SQL-2003-N */
|
|
429 |
%token PRECISION /* SQL-2003-R */
|
|
430 |
%token PREV_SYM
|
|
431 |
%token PRIMARY_SYM /* SQL-2003-R */
|
|
432 |
%token PROCESS
|
|
433 |
%token PROCESSLIST_SYM
|
|
434 |
%token QUARTER_SYM
|
|
435 |
%token QUERY_SYM
|
|
436 |
%token RANGE_SYM /* SQL-2003-R */
|
|
437 |
%token READS_SYM /* SQL-2003-R */
|
|
438 |
%token READ_SYM /* SQL-2003-N */
|
|
439 |
%token READ_WRITE_SYM
|
|
440 |
%token REAL /* SQL-2003-R */
|
|
441 |
%token REDUNDANT_SYM
|
|
1976.7.1
by Brian Aker
Added compatible REGEX for Drizzle to MySQL's syntax. |
442 |
%token REGEXP_SYM
|
1
by brian
clean slate |
443 |
%token REFERENCES /* SQL-2003-R */
|
444 |
%token RELEASE_SYM /* SQL-2003-R */
|
|
445 |
%token RENAME
|
|
446 |
%token REPEATABLE_SYM /* SQL-2003-N */
|
|
447 |
%token REPEAT_SYM /* MYSQL-FUNC */
|
|
448 |
%token REPLACE /* MYSQL-FUNC */
|
|
2187.7.4
by Brian Aker
Merge in change from REPLICATION to REPLICATE as keyword. |
449 |
%token REPLICATE
|
2168.3.1
by Brian Aker
Basic DDL working for replication. |
450 |
%token REPLICATION
|
1
by brian
clean slate |
451 |
%token RESTRICT
|
452 |
%token RETURNS_SYM /* SQL-2003-R */
|
|
453 |
%token RETURN_SYM /* SQL-2003-R */
|
|
454 |
%token REVOKE /* SQL-2003-R */
|
|
455 |
%token RIGHT /* SQL-2003-R */
|
|
456 |
%token ROLLBACK_SYM /* SQL-2003-R */
|
|
457 |
%token ROLLUP_SYM /* SQL-2003-R */
|
|
458 |
%token ROUTINE_SYM /* SQL-2003-N */
|
|
459 |
%token ROWS_SYM /* SQL-2003-R */
|
|
460 |
%token ROW_FORMAT_SYM
|
|
461 |
%token ROW_SYM /* SQL-2003-R */
|
|
462 |
%token SAVEPOINT_SYM /* SQL-2003-R */
|
|
463 |
%token SECOND_MICROSECOND_SYM
|
|
464 |
%token SECOND_SYM /* SQL-2003-R */
|
|
465 |
%token SECURITY_SYM /* SQL-2003-N */
|
|
466 |
%token SELECT_SYM /* SQL-2003-R */
|
|
467 |
%token SENSITIVE_SYM /* FUTURE-USE */
|
|
468 |
%token SEPARATOR_SYM
|
|
469 |
%token SERIALIZABLE_SYM /* SQL-2003-N */
|
|
470 |
%token SERIAL_SYM
|
|
471 |
%token SESSION_SYM /* SQL-2003-N */
|
|
472 |
%token SERVER_SYM
|
|
2030.1.1
by Brian Aker
Small set of symbol updates. |
473 |
%token SET_SYM /* SQL-2003-R */
|
1
by brian
clean slate |
474 |
%token SET_VAR
|
475 |
%token SHARE_SYM
|
|
476 |
%token SHOW
|
|
2008.2.3
by Brian Aker
Fixing up a, somewhat, hidden unsigned type to solve a few issues around |
477 |
%token SIGNED_SYM
|
1
by brian
clean slate |
478 |
%token SIMPLE_SYM /* SQL-2003-N */
|
479 |
%token SNAPSHOT_SYM
|
|
480 |
%token SPECIFIC_SYM /* SQL-2003-R */
|
|
481 |
%token SQLEXCEPTION_SYM /* SQL-2003-R */
|
|
482 |
%token SQLSTATE_SYM /* SQL-2003-R */
|
|
483 |
%token SQLWARNING_SYM /* SQL-2003-R */
|
|
484 |
%token SQL_BIG_RESULT
|
|
485 |
%token SQL_BUFFER_RESULT
|
|
486 |
%token SQL_CALC_FOUND_ROWS
|
|
487 |
%token SQL_SMALL_RESULT
|
|
488 |
%token SQL_SYM /* SQL-2003-R */
|
|
489 |
%token STARTING
|
|
490 |
%token START_SYM /* SQL-2003-R */
|
|
491 |
%token STATUS_SYM
|
|
492 |
%token STDDEV_SAMP_SYM /* SQL-2003-N */
|
|
493 |
%token STD_SYM
|
|
494 |
%token STOP_SYM
|
|
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
495 |
%token STORED_SYM
|
1
by brian
clean slate |
496 |
%token STRAIGHT_JOIN
|
497 |
%token STRING_SYM
|
|
498 |
%token SUBDATE_SYM
|
|
499 |
%token SUBJECT_SYM
|
|
500 |
%token SUBSTRING /* SQL-2003-N */
|
|
501 |
%token SUM_SYM /* SQL-2003-N */
|
|
502 |
%token SUSPEND_SYM
|
|
503 |
%token SYSDATE
|
|
504 |
%token TABLES
|
|
108
by Brian Aker
Removed unwanted ALTER TABLESPACE, left in valuable bits. |
505 |
%token TABLESPACE
|
1
by brian
clean slate |
506 |
%token TABLE_REF_PRIORITY
|
507 |
%token TABLE_SYM /* SQL-2003-R */
|
|
1008.3.17
by Stewart Smith
Start work to construct table proto in parser: |
508 |
%token TEMPORARY_SYM /* SQL-2003-N */
|
1
by brian
clean slate |
509 |
%token TERMINATED
|
510 |
%token TEXT_STRING
|
|
511 |
%token TEXT_SYM
|
|
512 |
%token THEN_SYM /* SQL-2003-R */
|
|
1999.4.7
by Brian Aker
Merge in first pass of TIME type (closer to EPOCH time). |
513 |
%token TIME_SYM /* SQL-2003-R */
|
1008.3.17
by Stewart Smith
Start work to construct table proto in parser: |
514 |
%token TIMESTAMP_SYM /* SQL-2003-R */
|
1
by brian
clean slate |
515 |
%token TIMESTAMP_ADD
|
516 |
%token TIMESTAMP_DIFF
|
|
517 |
%token TO_SYM /* SQL-2003-R */
|
|
518 |
%token TRAILING /* SQL-2003-R */
|
|
519 |
%token TRANSACTION_SYM
|
|
520 |
%token TRIM /* SQL-2003-N */
|
|
521 |
%token TRUE_SYM /* SQL-2003-R */
|
|
522 |
%token TRUNCATE_SYM
|
|
523 |
%token TYPE_SYM /* SQL-2003-N */
|
|
524 |
%token ULONGLONG_NUM
|
|
525 |
%token UNCOMMITTED_SYM /* SQL-2003-N */
|
|
526 |
%token UNDOFILE_SYM
|
|
527 |
%token UNDO_SYM /* FUTURE-USE */
|
|
528 |
%token UNION_SYM /* SQL-2003-R */
|
|
529 |
%token UNIQUE_SYM
|
|
530 |
%token UNKNOWN_SYM /* SQL-2003-R */
|
|
531 |
%token UNLOCK_SYM
|
|
2008.2.3
by Brian Aker
Fixing up a, somewhat, hidden unsigned type to solve a few issues around |
532 |
%token UNSIGNED_SYM
|
1
by brian
clean slate |
533 |
%token UPDATE_SYM /* SQL-2003-R */
|
534 |
%token USAGE /* SQL-2003-N */
|
|
535 |
%token USER /* SQL-2003-R */
|
|
536 |
%token USE_SYM
|
|
537 |
%token USING /* SQL-2003-R */
|
|
538 |
%token UTC_DATE_SYM
|
|
539 |
%token UTC_TIMESTAMP_SYM
|
|
1996.2.1
by Brian Aker
uuid type code. |
540 |
%token UUID_SYM
|
1
by brian
clean slate |
541 |
%token VALUES /* SQL-2003-R */
|
542 |
%token VALUE_SYM /* SQL-2003-R */
|
|
543 |
%token VARBINARY
|
|
1008.3.17
by Stewart Smith
Start work to construct table proto in parser: |
544 |
%token VARCHAR_SYM /* SQL-2003-R */
|
1
by brian
clean slate |
545 |
%token VARIABLES
|
546 |
%token VARIANCE_SYM
|
|
547 |
%token VARYING /* SQL-2003-R */
|
|
548 |
%token VAR_SAMP_SYM
|
|
1958.1.1
by Brian Aker
Fix clash in parser with wait(). |
549 |
%token WAIT_SYM
|
1
by brian
clean slate |
550 |
%token WARNINGS
|
551 |
%token WEEK_SYM
|
|
552 |
%token WHEN_SYM /* SQL-2003-R */
|
|
553 |
%token WHERE /* SQL-2003-R */
|
|
554 |
%token WITH /* SQL-2003-R */
|
|
555 |
%token WITH_ROLLUP_SYM /* INTERNAL */
|
|
556 |
%token WORK_SYM /* SQL-2003-N */
|
|
557 |
%token WRITE_SYM /* SQL-2003-N */
|
|
558 |
%token XOR
|
|
559 |
%token YEAR_MONTH_SYM
|
|
560 |
%token YEAR_SYM /* SQL-2003-R */
|
|
2008.2.3
by Brian Aker
Fixing up a, somewhat, hidden unsigned type to solve a few issues around |
561 |
%token ZEROFILL_SYM
|
1
by brian
clean slate |
562 |
|
2172.3.15
by Brian Aker
Cleanup additional precedence rules. |
563 |
/* Lowest to highest */ |
1
by brian
clean slate |
564 |
%left JOIN_SYM INNER_SYM STRAIGHT_JOIN CROSS LEFT RIGHT
|
565 |
/* A dummy token to force the priority of table_ref production in a join. */ |
|
2172.3.15
by Brian Aker
Cleanup additional precedence rules. |
566 |
%left TABLE_REF_PRIORITY
|
567 |
%left SET_VAR
|
|
568 |
%left OR_SYM
|
|
569 |
%left XOR
|
|
570 |
%left AND_SYM
|
|
571 |
%right NOT_SYM
|
|
2172.3.16
by Brian Aker
Remove greedy use = for table alias allowance. |
572 |
%right '='
|
2194.4.2
by Brian Aker
Bit functions/fix for << |
573 |
%nonassoc EQUAL_SYM GE GREATER_THAN LE LESS_THAN NE
|
2172.3.14
by Brian Aker
Small cleanup for precendense |
574 |
%nonassoc LIKE REGEXP_SYM
|
575 |
%nonassoc BETWEEN_SYM
|
|
576 |
%nonassoc IN_SYM
|
|
2172.3.15
by Brian Aker
Cleanup additional precedence rules. |
577 |
%nonassoc IS NULL_SYM TRUE_SYM FALSE_SYM
|
2194.4.2
by Brian Aker
Bit functions/fix for << |
578 |
|
2198.6.1
by Brian Aker
Add in an ANSI || operator. |
579 |
%nonassoc CONCAT
|
2194.4.2
by Brian Aker
Bit functions/fix for << |
580 |
%nonassoc '|'
|
581 |
%nonassoc '&'
|
|
582 |
%nonassoc SHIFT_LEFT SHIFT_RIGHT
|
|
583 |
||
1
by brian
clean slate |
584 |
%left '-' '+'
|
585 |
%left '*' '/' '%' DIV_SYM MOD_SYM
|
|
2194.4.2
by Brian Aker
Bit functions/fix for << |
586 |
%nonassoc '^'
|
587 |
%nonassoc '~'
|
|
1
by brian
clean slate |
588 |
%right BINARY COLLATE_SYM
|
589 |
%left INTERVAL_SYM
|
|
2172.3.15
by Brian Aker
Cleanup additional precedence rules. |
590 |
%right UMINUS
|
591 |
%left '(' ')'
|
|
2172.3.18
by Brian Aker
Additional clean up on non-typed terms |
592 |
%left '{' '}'
|
1
by brian
clean slate |
593 |
|
594 |
%type <lex_str>
|
|
595 |
IDENT IDENT_QUOTED TEXT_STRING DECIMAL_NUM FLOAT_NUM NUM LONG_NUM HEX_NUM |
|
2029.1.26
by Brian Aker
Merge in work for reserved words in SQL standard. |
596 |
LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias |
597 |
ident
|
|
2029.1.24
by Brian Aker
Reduce the conflicts based on engine options. |
598 |
ident_or_text
|
2029.1.26
by Brian Aker
Merge in work for reserved words in SQL standard. |
599 |
internal_variable_ident
|
600 |
user_variable_ident
|
|
2029.1.22
by Brian Aker
Merge in change to use row_format spefically *this is backward compatible |
601 |
row_format_or_text
|
1
by brian
clean slate |
602 |
IDENT_sys TEXT_STRING_sys TEXT_STRING_literal |
2060.2.5
by Brian Aker
Adjust name, we aren't really return an ident, it is just a name. |
603 |
schema_name
|
2073.1.2
by Brian Aker
Basic DDL for catalog. |
604 |
catalog_name
|
1106.4.1
by Brian Aker
Remove user level key_cache |
605 |
opt_component
|
2029.1.24
by Brian Aker
Reduce the conflicts based on engine options. |
606 |
engine_option_value
|
2029.1.29
by Brian Aker
Modify savepoint to not allow keyword usage. |
607 |
savepoint_ident
|
2029.1.19
by Brian Aker
Remove the "no name" option from ALTER SCHEMA. |
608 |
BIN_NUM TEXT_STRING_filesystem |
1921.4.1
by Brian Aker
Adding in support for EXECUTE to have WITH NO RETURN. |
609 |
opt_constraint constraint opt_ident |
610 |
||
611 |
%type <execute_string>
|
|
1835.1.6
by Brian Aker
This patch returns dynamic SQL into the core (through SQL-Server syntax). |
612 |
execute_var_or_string
|
1
by brian
clean slate |
613 |
|
614 |
%type <lex_str_ptr> |
|
615 |
opt_table_alias
|
|
616 |
||
617 |
%type <table> |
|
618 |
table_ident references |
|
619 |
||
620 |
%type <simple_string>
|
|
621 |
remember_name remember_end opt_db |
|
622 |
||
623 |
%type <string>
|
|
624 |
text_string opt_gconcat_separator |
|
625 |
||
2029.1.3
by Brian Aker
Valid with enum in parser for type |
626 |
%type <field_val>
|
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
627 |
field_def
|
2029.1.3
by Brian Aker
Valid with enum in parser for type |
628 |
int_type
|
629 |
real_type
|
|
630 |
||
2029.1.12
by Brian Aker
Merge in boolean type that has been added to the parser. |
631 |
%type <boolean> |
632 |
opt_wait
|
|
633 |
opt_concurrent
|
|
634 |
opt_status
|
|
635 |
opt_zerofill
|
|
636 |
opt_if_not_exists
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
637 |
if_exists
|
638 |
opt_temporary
|
|
2029.1.13
by Brian Aker
Additional boolean usae in the parser. |
639 |
opt_field_number_signed
|
2029.1.12
by Brian Aker
Merge in boolean type that has been added to the parser. |
640 |
|
1
by brian
clean slate |
641 |
%type <num>
|
2029.1.13
by Brian Aker
Additional boolean usae in the parser. |
642 |
order_dir
|
2029.1.12
by Brian Aker
Merge in boolean type that has been added to the parser. |
643 |
opt_table_options
|
644 |
all_or_any opt_distinct |
|
59
by Brian Aker
Removed preload from parser. |
645 |
union_option
|
1
by brian
clean slate |
646 |
start_transaction_opts opt_chain opt_release |
647 |
union_opt select_derived_init option_type2 |
|
1963.2.1
by Brian Aker
Fixing up the kill function. |
648 |
kill_option
|
1
by brian
clean slate |
649 |
|
650 |
%type <m_fk_option> |
|
651 |
delete_option
|
|
652 |
||
653 |
%type <ulong_num> |
|
1296
by Brian Aker
Remove WEIGHT_STRING() from parser (where it does not belong). If someone |
654 |
ulong_num
|
1
by brian
clean slate |
655 |
|
656 |
%type <ulonglong_number> |
|
657 |
ulonglong_num
|
|
658 |
||
659 |
%type <lock_type> |
|
1008.1.5
by Brian Aker
Remove LOW_PRIORITY call. |
660 |
load_data_lock
|
1
by brian
clean slate |
661 |
|
662 |
%type <item> |
|
663 |
literal text_literal insert_ident order_ident |
|
664 |
simple_ident expr opt_expr opt_else sum_expr in_sum_expr |
|
665 |
variable variable_aux bool_pri |
|
666 |
predicate bit_expr |
|
667 |
table_wild simple_expr udf_expr |
|
668 |
expr_or_default set_expr_or_default |
|
2198.6.13
by Brian Aker
Merge fix such that default is better defined on numbers. |
669 |
opt_escape
|
670 |
signed_literal
|
|
671 |
integer_literal
|
|
2198.6.10
by Brian Aker
Scope out timestamp to only take certain types of values as default. |
672 |
date_literal
|
2198.6.11
by Brian Aker
Have the parser enforce propper default values for boolean. |
673 |
boolean_literal
|
2114.4.8
by Brian Aker
Merge in additional parser encapsulation. |
674 |
simple_ident_q
|
1
by brian
clean slate |
675 |
field_or_var limit_option |
676 |
function_call_keyword
|
|
677 |
function_call_nonkeyword
|
|
678 |
function_call_generic
|
|
679 |
function_call_conflict
|
|
680 |
||
681 |
%type <item_num>
|
|
682 |
NUM_literal
|
|
683 |
||
684 |
%type <item_list> |
|
685 |
expr_list opt_udf_expr_list udf_expr_list when_list |
|
686 |
||
687 |
%type <var_type>
|
|
688 |
option_type opt_var_type opt_var_ident_type |
|
689 |
||
690 |
%type <key_type>
|
|
691 |
key_type opt_unique constraint_key_type |
|
692 |
||
693 |
%type <key_alg>
|
|
694 |
btree_or_rtree
|
|
695 |
||
696 |
%type <string_list> |
|
697 |
using_list
|
|
698 |
||
699 |
%type <key_part> |
|
700 |
key_part
|
|
701 |
||
702 |
%type <table_list> |
|
703 |
join_table_list join_table |
|
704 |
table_factor table_ref esc_table_ref |
|
705 |
select_derived derived_table_list |
|
706 |
select_derived_union
|
|
707 |
||
708 |
%type <interval> interval |
|
709 |
||
710 |
%type <interval_time_st> interval_time_st
|
|
711 |
||
712 |
%type <interval_time_st> interval_time_stamp
|
|
713 |
||
714 |
%type <tx_isolation> isolation_types
|
|
715 |
||
716 |
%type <cast_type> cast_type
|
|
717 |
||
2029.1.22
by Brian Aker
Merge in change to use row_format spefically *this is backward compatible |
718 |
%type <symbol>
|
719 |
keyword
|
|
720 |
keyword_sp
|
|
2029.1.26
by Brian Aker
Merge in work for reserved words in SQL standard. |
721 |
keyword_exception_for_variable
|
2029.1.22
by Brian Aker
Merge in change to use row_format spefically *this is backward compatible |
722 |
row_format
|
1
by brian
clean slate |
723 |
|
724 |
%type <charset>
|
|
725 |
collation_name
|
|
726 |
collation_name_or_default
|
|
727 |
||
728 |
%type <variable> internal_variable_name
|
|
729 |
||
730 |
%type <select_lex> subselect
|
|
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
731 |
get_select_lex query_specification |
1
by brian
clean slate |
732 |
query_expression_body
|
733 |
||
734 |
%type <boolfunc2creator> comp_op |
|
735 |
||
736 |
%type <NONE>
|
|
798.2.4
by Brian Aker
Removed CHANGE |
737 |
query verb_clause create select drop insert replace insert2 |
1
by brian
clean slate |
738 |
insert_values update delete truncate rename |
1222.1.14
by Brian Aker
Remove OPTIMIZE, place in ALTER TABLE (which does the same thing). |
739 |
show describe load alter flush |
798.2.2
by Brian Aker
Removed purge |
740 |
begin commit rollback savepoint release |
1455.1.1
by Stewart Smith
remove CHECKSUM TABLE |
741 |
analyze check start |
1
by brian
clean slate |
742 |
field_list field_list_item field_spec kill column_def key_def |
743 |
select_item_list select_item values_list no_braces |
|
744 |
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 |
745 |
opt_precision opt_ignore opt_column |
1054.1.1
by Brian Aker
Remove guts in parser for LOCK TABLE. |
746 |
set unlock string_list |
1
by brian
clean slate |
747 |
ref_list opt_match_clause opt_on_update_delete use |
2172.3.19
by Brian Aker
Refactor DELETE so that it is a simple statement. |
748 |
opt_delete_option varchar |
1108.1.1
by Brian Aker
Remove multi-update from parser/tests. |
749 |
opt_outer table_list table_name |
1
by brian
clean slate |
750 |
opt_option opt_place |
2198.6.12
by Brian Aker
Clean up the declaraion on attribute. |
751 |
opt_attribute
|
2198.6.11
by Brian Aker
Have the parser enforce propper default values for boolean. |
752 |
opt_attribute_boolean
|
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
753 |
opt_attribute_timestamp
|
754 |
opt_attribute_number
|
|
755 |
opt_attribute_string
|
|
1
by brian
clean slate |
756 |
flush_options flush_option |
757 |
equal optional_braces |
|
1222.1.10
by Brian Aker
Removes options from DDL left in Cursor for admin operations (they were |
758 |
normal_join
|
2029.1.6
by Brian Aker
Refactor create table into sections. |
759 |
table_to_table_list table_to_table opt_table_list |
1
by brian
clean slate |
760 |
union_clause union_list |
520.1.1
by Brian Aker
Removed dead variables/dead parser piece. |
761 |
precision subselect_start |
1
by brian
clean slate |
762 |
subselect_end select_var_list select_var_list_init opt_len |
763 |
opt_extended_describe
|
|
764 |
statement
|
|
1874.2.3
by Brian Aker
Remove warning on EXECUTE |
765 |
execute
|
1
by brian
clean slate |
766 |
opt_field_or_var_spec fields_or_vars opt_load_data_set_spec |
767 |
init_key_options key_options key_opts key_opt key_using_alg |
|
768 |
END_OF_INPUT
|
|
769 |
||
770 |
%type <index_hint> index_hint_type |
|
771 |
%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 |
772 |
%type <filetype> data_file
|
1
by brian
clean slate |
773 |
|
774 |
%%
|
|
775 |
||
776 |
/*
|
|
777 |
Indentation of grammar rules: |
|
778 |
||
779 |
rule: <-- starts at col 1 |
|
780 |
rule1a rule1b rule1c <-- starts at col 11 |
|
781 |
{ <-- starts at col 11 |
|
782 |
code <-- starts at col 13, indentation is 2 spaces |
|
783 |
}
|
|
784 |
| rule2a rule2b |
|
785 |
{
|
|
786 |
code
|
|
787 |
}
|
|
788 |
; <-- on a line by itself, starts at col 9 |
|
789 |
||
790 |
Also, please do not use any <TAB>, but spaces. |
|
791 |
Having a uniform indentation in this file helps |
|
792 |
code reviews, patches, merges, and make maintenance easier. |
|
793 |
Tip: grep [[:cntrl:]] sql_yacc.yy |
|
794 |
Thanks. |
|
795 |
*/
|
|
796 |
||
797 |
query: |
|
798 |
END_OF_INPUT
|
|
799 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
800 |
if (!(YYSession->lex().select_lex.options & OPTION_FOUND_COMMENT)) |
1
by brian
clean slate |
801 |
{
|
802 |
my_message(ER_EMPTY_QUERY, ER(ER_EMPTY_QUERY), MYF(0)); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
803 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
804 |
}
|
805 |
else
|
|
806 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
807 |
YYSession->lex().statement= new statement::EmptyQuery(YYSession); |
1
by brian
clean slate |
808 |
}
|
809 |
}
|
|
810 |
| verb_clause END_OF_INPUT {} |
|
811 |
;
|
|
812 |
||
813 |
verb_clause: |
|
814 |
statement
|
|
815 |
| begin |
|
816 |
;
|
|
817 |
||
818 |
/* Verb clauses, except begin */ |
|
819 |
statement: |
|
820 |
alter
|
|
821 |
| analyze |
|
822 |
| check |
|
823 |
| commit |
|
824 |
| create |
|
825 |
| delete |
|
826 |
| describe |
|
827 |
| drop |
|
1835.1.6
by Brian Aker
This patch returns dynamic SQL into the core (through SQL-Server syntax). |
828 |
| execute |
1
by brian
clean slate |
829 |
| flush |
830 |
| insert |
|
831 |
| kill |
|
832 |
| load |
|
833 |
| release |
|
834 |
| rename |
|
835 |
| replace |
|
836 |
| rollback |
|
837 |
| savepoint |
|
838 |
| select |
|
839 |
| set |
|
840 |
| show |
|
841 |
| start |
|
842 |
| truncate |
|
843 |
| unlock |
|
844 |
| update |
|
845 |
| use |
|
846 |
;
|
|
847 |
||
848 |
/* create a table */ |
|
849 |
||
850 |
create: |
|
2073.1.2
by Brian Aker
Basic DDL for catalog. |
851 |
CREATE CATALOG_SYM catalog_name |
852 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
853 |
Lex.statement= new statement::catalog::Create(YYSession, $3); |
2073.1.2
by Brian Aker
Basic DDL for catalog. |
854 |
}
|
855 |
| CREATE opt_table_options TABLE_SYM opt_if_not_exists table_ident |
|
1
by brian
clean slate |
856 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
857 |
Lex.statement= new statement::CreateTable(YYSession, $5, $2); |
2029.1.9
by Brian Aker
Remove usage of localized variable. |
858 |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
859 |
if (not Lex.select_lex.add_table_to_list(YYSession, $5, NULL, |
2029.1.9
by Brian Aker
Remove usage of localized variable. |
860 |
TL_OPTION_UPDATING, |
861 |
TL_WRITE)) |
|
862 |
DRIZZLE_YYABORT; |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
863 |
Lex.col_list.clear(); |
1
by brian
clean slate |
864 |
}
|
2029.1.7
by Brian Aker
Clear up names in parser around create table |
865 |
create_table_definition
|
1
by brian
clean slate |
866 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
867 |
Lex.current_select= &Lex.select_lex; |
1
by brian
clean slate |
868 |
}
|
1128.2.9
by Brian Aker
Remove KEY_CREATE_INFO from global lex. |
869 |
| CREATE build_method |
1
by brian
clean slate |
870 |
{
|
2200.2.25
by Stewart Smith
Merge refactoring of default values work |
871 |
Lex.statement= new statement::CreateIndex(YYSession); |
1128.2.9
by Brian Aker
Remove KEY_CREATE_INFO from global lex. |
872 |
}
|
873 |
opt_unique INDEX_SYM ident key_alg ON table_ident '(' key_list ')' key_options |
|
874 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
875 |
if (not Lex.current_select->add_table_to_list(Lex.session, $9, |
2029.1.16
by Brian Aker
Fix unneeded move of Lex to a local variable. |
876 |
NULL, |
877 |
TL_OPTION_UPDATING)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
878 |
DRIZZLE_YYABORT; |
2148.5.7
by Brian Aker
Make additional use of buildKey() |
879 |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
880 |
parser::buildKey(&Lex, $4, $6); |
1
by brian
clean slate |
881 |
}
|
2060.2.5
by Brian Aker
Adjust name, we aren't really return an ident, it is just a name. |
882 |
| CREATE DATABASE opt_if_not_exists schema_name |
1
by brian
clean slate |
883 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
884 |
Lex.statement= new statement::CreateSchema(YYSession); |
1
by brian
clean slate |
885 |
}
|
886 |
opt_create_database_options
|
|
887 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
888 |
Lex.name= $4; |
1
by brian
clean slate |
889 |
}
|
890 |
;
|
|
891 |
||
2029.1.7
by Brian Aker
Clear up names in parser around create table |
892 |
create_table_definition: |
2029.1.10
by Brian Aker
Merged in field_list rule. |
893 |
'(' field_list ')' opt_create_table_options create_select_as |
894 |
{ } |
|
2029.1.11
by Brian Aker
PAren shift |
895 |
| '(' create_select ')' |
896 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
897 |
Lex.current_select->set_braces(1); |
2029.1.11
by Brian Aker
PAren shift |
898 |
}
|
899 |
union_opt {} |
|
900 |
| '(' create_like ')' opt_create_table_options |
|
2029.1.10
by Brian Aker
Merged in field_list rule. |
901 |
{ } |
2029.1.6
by Brian Aker
Refactor create table into sections. |
902 |
| create_like opt_create_table_options |
903 |
{ } |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
904 |
| opt_create_table_options create_select_as |
2029.1.12
by Brian Aker
Merge in boolean type that has been added to the parser. |
905 |
{ } |
1
by brian
clean slate |
906 |
;
|
907 |
||
2029.1.7
by Brian Aker
Clear up names in parser around create table |
908 |
create_select_as: |
1
by brian
clean slate |
909 |
/* empty */ {} |
2029.1.6
by Brian Aker
Refactor create table into sections. |
910 |
| opt_duplicate_as create_select |
2029.1.5
by Brian Aker
Move exists into LEX. |
911 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
912 |
Lex.current_select->set_braces(0); |
2029.1.5
by Brian Aker
Move exists into LEX. |
913 |
}
|
1
by brian
clean slate |
914 |
union_clause {} |
2029.1.6
by Brian Aker
Refactor create table into sections. |
915 |
| opt_duplicate_as '(' create_select ')' |
2029.1.5
by Brian Aker
Move exists into LEX. |
916 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
917 |
Lex.current_select->set_braces(1); |
2029.1.5
by Brian Aker
Move exists into LEX. |
918 |
}
|
1
by brian
clean slate |
919 |
union_opt {} |
920 |
;
|
|
921 |
||
2029.1.6
by Brian Aker
Refactor create table into sections. |
922 |
create_like: |
2029.1.7
by Brian Aker
Clear up names in parser around create table |
923 |
LIKE table_ident |
924 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
925 |
((statement::CreateTable *)(YYSession->lex().statement))->is_create_table_like= true; |
2029.1.6
by Brian Aker
Refactor create table into sections. |
926 |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
927 |
if (not YYSession->lex().select_lex.add_table_to_list(YYSession, $2, NULL, 0, TL_READ)) |
2029.1.7
by Brian Aker
Clear up names in parser around create table |
928 |
DRIZZLE_YYABORT; |
929 |
}
|
|
930 |
;
|
|
2029.1.6
by Brian Aker
Refactor create table into sections. |
931 |
|
1
by brian
clean slate |
932 |
create_select: |
2029.1.8
by Brian Aker
Cleanup naming. |
933 |
stored_select
|
934 |
{
|
|
935 |
}
|
|
936 |
;
|
|
937 |
||
938 |
/*
|
|
939 |
This rule is used for both CREATE TABLE .. SELECT, AND INSERT ... SELECT |
|
940 |
*/
|
|
941 |
stored_select: |
|
1
by brian
clean slate |
942 |
SELECT_SYM
|
943 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
944 |
Lex.lock_option= TL_READ; |
945 |
if (Lex.sql_command == SQLCOM_INSERT) |
|
1100.3.66
by Padraig O'Sullivan
Extracted the last commands....Finally removed that gigantic switch |
946 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
947 |
delete Lex.statement; |
948 |
Lex.statement= new statement::InsertSelect(YYSession); |
|
1100.3.66
by Padraig O'Sullivan
Extracted the last commands....Finally removed that gigantic switch |
949 |
}
|
2227.4.10
by Olaf van der Spek
Session::lex() |
950 |
else if (Lex.sql_command == SQLCOM_REPLACE) |
1100.3.66
by Padraig O'Sullivan
Extracted the last commands....Finally removed that gigantic switch |
951 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
952 |
delete Lex.statement; |
953 |
Lex.statement= new statement::ReplaceSelect(YYSession); |
|
1100.3.66
by Padraig O'Sullivan
Extracted the last commands....Finally removed that gigantic switch |
954 |
}
|
1
by brian
clean slate |
955 |
/*
|
956 |
The following work only with the local list, the global list |
|
957 |
is created correctly in this case |
|
958 |
*/
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
959 |
Lex.current_select->table_list.save_and_clear(&Lex.save_list); |
960 |
init_select(&Lex); |
|
961 |
Lex.current_select->parsing_place= SELECT_LIST; |
|
1
by brian
clean slate |
962 |
}
|
963 |
select_options select_item_list |
|
964 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
965 |
Lex.current_select->parsing_place= NO_MATTER; |
1
by brian
clean slate |
966 |
}
|
967 |
opt_select_from
|
|
968 |
{
|
|
969 |
/*
|
|
970 |
The following work only with the local list, the global list |
|
971 |
is created correctly in this case |
|
972 |
*/
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
973 |
Lex.current_select->table_list.push_front(&Lex.save_list); |
1
by brian
clean slate |
974 |
}
|
975 |
;
|
|
976 |
||
977 |
opt_create_database_options: |
|
978 |
/* empty */ {} |
|
1128.2.7
by Brian Aker
Cleanup previous issues in create sql_yacc |
979 |
| default_collation_schema {} |
1241.17.1
by Stewart Smith
simple key,value options for CREATE DATABASE. All options are currently unknown. |
980 |
| opt_database_custom_options {} |
981 |
;
|
|
982 |
||
983 |
opt_database_custom_options: |
|
984 |
custom_database_option
|
|
985 |
| custom_database_option ',' opt_database_custom_options |
|
986 |
;
|
|
987 |
||
988 |
custom_database_option: |
|
989 |
ident_or_text
|
|
2114.4.3
by Brian Aker
Merge in schema options enum. |
990 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
991 |
statement::CreateSchema *statement= (statement::CreateSchema *)Lex.statement; |
2114.4.3
by Brian Aker
Merge in schema options enum. |
992 |
statement->schema_message.mutable_engine()->add_options()->set_name($1.str); |
993 |
}
|
|
2239.4.2
by Brian Aker
Fix issue where the wrong sort of "=" could be used in some cases. |
994 |
| REPLICATE '=' TRUE_SYM |
2168.3.1
by Brian Aker
Basic DDL working for replication. |
995 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
996 |
parser::buildReplicationOption(&Lex, true); |
2168.3.1
by Brian Aker
Basic DDL working for replication. |
997 |
}
|
2239.4.2
by Brian Aker
Fix issue where the wrong sort of "=" could be used in some cases. |
998 |
| REPLICATE '=' FALSE_SYM |
2168.3.1
by Brian Aker
Basic DDL working for replication. |
999 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1000 |
parser::buildReplicationOption(&Lex, false); |
2168.3.1
by Brian Aker
Basic DDL working for replication. |
1001 |
}
|
2239.4.2
by Brian Aker
Fix issue where the wrong sort of "=" could be used in some cases. |
1002 |
| ident_or_text '=' ident_or_text |
2114.4.3
by Brian Aker
Merge in schema options enum. |
1003 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1004 |
parser::buildSchemaOption(&Lex, $1.str, $3); |
2114.4.3
by Brian Aker
Merge in schema options enum. |
1005 |
}
|
2239.4.2
by Brian Aker
Fix issue where the wrong sort of "=" could be used in some cases. |
1006 |
| ident_or_text '=' ulonglong_num |
2114.4.3
by Brian Aker
Merge in schema options enum. |
1007 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1008 |
parser::buildSchemaOption(&Lex, $1.str, $3); |
2114.4.3
by Brian Aker
Merge in schema options enum. |
1009 |
}
|
1
by brian
clean slate |
1010 |
;
|
1011 |
||
1012 |
opt_table_options: |
|
1222.2.2
by Brian Aker
Remove last ofl HA_CREATE_INFO being involved with temporary tables (always |
1013 |
/* empty */ { $$= false; } |
1014 |
| TEMPORARY_SYM { $$= true; } |
|
1
by brian
clean slate |
1015 |
;
|
1016 |
||
1017 |
opt_if_not_exists: |
|
1222.2.3
by Brian Aker
Remove a few more options, from options in HA_CREATE_INFO. |
1018 |
/* empty */ { $$= false; } |
2227.4.10
by Olaf van der Spek
Session::lex() |
1019 |
| IF NOT_SYM EXISTS { $$= true; YYSession->lex().setExists(); } |
1
by brian
clean slate |
1020 |
;
|
1021 |
||
1022 |
opt_create_table_options: |
|
1023 |
/* empty */ |
|
1024 |
| create_table_options |
|
1025 |
;
|
|
1026 |
||
1027 |
create_table_options_space_separated: |
|
1028 |
create_table_option
|
|
1029 |
| create_table_option create_table_options_space_separated |
|
1030 |
;
|
|
1031 |
||
1032 |
create_table_options: |
|
1033 |
create_table_option
|
|
1034 |
| create_table_option create_table_options |
|
1035 |
| create_table_option ',' create_table_options |
|
1245.3.2
by Stewart Smith
small addition of custom engine options in parser and statement/create_table. No error checking performed yet (although the list is constructed). We are parsing them in () after ENGINE=FOO in CREATE TABLE and not as first class options to CREATE TABLE (like ENGINE=) currently due to shift/reduce conflicts in parser if we do. We must first reimpliment the existing CREATE TABLE options as these options before we can have this. |
1036 |
|
1
by brian
clean slate |
1037 |
create_table_option: |
1502.1.30
by Brian Aker
First pass on cleanup of Stewart's patch, plus re-engineer to make it work a |
1038 |
custom_engine_option; |
1
by brian
clean slate |
1039 |
|
1245.3.2
by Stewart Smith
small addition of custom engine options in parser and statement/create_table. No error checking performed yet (although the list is constructed). We are parsing them in () after ENGINE=FOO in CREATE TABLE and not as first class options to CREATE TABLE (like ENGINE=) currently due to shift/reduce conflicts in parser if we do. We must first reimpliment the existing CREATE TABLE options as these options before we can have this. |
1040 |
custom_engine_option: |
2239.4.2
by Brian Aker
Fix issue where the wrong sort of "=" could be used in some cases. |
1041 |
ENGINE_SYM '=' ident_or_text |
1
by brian
clean slate |
1042 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1043 |
Lex.table()->mutable_engine()->set_name($3.str); |
1
by brian
clean slate |
1044 |
}
|
1045 |
| COMMENT_SYM opt_equal TEXT_STRING_sys |
|
1046 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1047 |
Lex.table()->mutable_options()->set_comment($3.str); |
1
by brian
clean slate |
1048 |
}
|
1049 |
| AUTO_INC opt_equal ulonglong_num |
|
1050 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1051 |
Lex.table()->mutable_options()->set_auto_increment_value($3); |
1
by brian
clean slate |
1052 |
}
|
2239.4.2
by Brian Aker
Fix issue where the wrong sort of "=" could be used in some cases. |
1053 |
| REPLICATE '=' TRUE_SYM |
2168.3.1
by Brian Aker
Basic DDL working for replication. |
1054 |
{
|
2227.4.15
by Olaf van der Spek
Merge trunk |
1055 |
message::set_is_replicated(*Lex.table(), true); |
2168.3.1
by Brian Aker
Basic DDL working for replication. |
1056 |
}
|
2239.4.2
by Brian Aker
Fix issue where the wrong sort of "=" could be used in some cases. |
1057 |
| REPLICATE '=' FALSE_SYM |
2168.3.1
by Brian Aker
Basic DDL working for replication. |
1058 |
{
|
2227.4.15
by Olaf van der Spek
Merge trunk |
1059 |
message::set_is_replicated(*Lex.table(), false); |
2168.3.1
by Brian Aker
Basic DDL working for replication. |
1060 |
}
|
2239.4.2
by Brian Aker
Fix issue where the wrong sort of "=" could be used in some cases. |
1061 |
| ROW_FORMAT_SYM '=' row_format_or_text |
2029.1.22
by Brian Aker
Merge in change to use row_format spefically *this is backward compatible |
1062 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1063 |
parser::buildEngineOption(&Lex, "ROW_FORMAT", $3); |
2029.1.22
by Brian Aker
Merge in change to use row_format spefically *this is backward compatible |
1064 |
}
|
2239.4.2
by Brian Aker
Fix issue where the wrong sort of "=" could be used in some cases. |
1065 |
| FILE_SYM '=' TEXT_STRING_sys |
2029.1.24
by Brian Aker
Reduce the conflicts based on engine options. |
1066 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1067 |
parser::buildEngineOption(&Lex, "FILE", $3); |
2029.1.24
by Brian Aker
Reduce the conflicts based on engine options. |
1068 |
}
|
2239.4.2
by Brian Aker
Fix issue where the wrong sort of "=" could be used in some cases. |
1069 |
| ident_or_text '=' engine_option_value |
1245.3.2
by Stewart Smith
small addition of custom engine options in parser and statement/create_table. No error checking performed yet (although the list is constructed). We are parsing them in () after ENGINE=FOO in CREATE TABLE and not as first class options to CREATE TABLE (like ENGINE=) currently due to shift/reduce conflicts in parser if we do. We must first reimpliment the existing CREATE TABLE options as these options before we can have this. |
1070 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1071 |
parser::buildEngineOption(&Lex, $1.str, $3); |
1245.3.2
by Stewart Smith
small addition of custom engine options in parser and statement/create_table. No error checking performed yet (although the list is constructed). We are parsing them in () after ENGINE=FOO in CREATE TABLE and not as first class options to CREATE TABLE (like ENGINE=) currently due to shift/reduce conflicts in parser if we do. We must first reimpliment the existing CREATE TABLE options as these options before we can have this. |
1072 |
}
|
2239.4.2
by Brian Aker
Fix issue where the wrong sort of "=" could be used in some cases. |
1073 |
| ident_or_text '=' ulonglong_num |
1245.3.2
by Stewart Smith
small addition of custom engine options in parser and statement/create_table. No error checking performed yet (although the list is constructed). We are parsing them in () after ENGINE=FOO in CREATE TABLE and not as first class options to CREATE TABLE (like ENGINE=) currently due to shift/reduce conflicts in parser if we do. We must first reimpliment the existing CREATE TABLE options as these options before we can have this. |
1074 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1075 |
parser::buildEngineOption(&Lex, $1.str, $3); |
1
by brian
clean slate |
1076 |
}
|
1077 |
| default_collation |
|
1078 |
;
|
|
1079 |
||
1080 |
default_collation: |
|
1081 |
opt_default COLLATE_SYM opt_equal collation_name_or_default |
|
1082 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1083 |
if (not parser::buildCollation(&Lex, $4)) |
2148.5.4
by Brian Aker
Move over the collation test to a function outside of the parser. |
1084 |
{
|
1085 |
DRIZZLE_YYABORT; |
|
1086 |
}
|
|
1245.3.2
by Stewart Smith
small addition of custom engine options in parser and statement/create_table. No error checking performed yet (although the list is constructed). We are parsing them in () after ENGINE=FOO in CREATE TABLE and not as first class options to CREATE TABLE (like ENGINE=) currently due to shift/reduce conflicts in parser if we do. We must first reimpliment the existing CREATE TABLE options as these options before we can have this. |
1087 |
}
|
1088 |
;
|
|
1089 |
||
1128.2.3
by Brian Aker
Remove create_info from global |
1090 |
default_collation_schema: |
1091 |
opt_default COLLATE_SYM opt_equal collation_name_or_default |
|
1092 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1093 |
((statement::CreateSchema *)Lex.statement)->schema_message.set_collation($4->name); |
1128.2.3
by Brian Aker
Remove create_info from global |
1094 |
}
|
1095 |
;
|
|
1096 |
||
2029.1.22
by Brian Aker
Merge in change to use row_format spefically *this is backward compatible |
1097 |
row_format: |
1098 |
COMPACT_SYM {} |
|
1099 |
| COMPRESSED_SYM {} |
|
1100 |
| DEFAULT {} |
|
1101 |
| DYNAMIC_SYM {} |
|
1102 |
| FIXED_SYM {} |
|
1103 |
| REDUNDANT_SYM {} |
|
1104 |
;
|
|
1105 |
||
1106 |
row_format_or_text: |
|
2029.1.23
by Brian Aker
Shuffle ROW_FORMAT. |
1107 |
row_format
|
2029.1.22
by Brian Aker
Merge in change to use row_format spefically *this is backward compatible |
1108 |
{
|
1109 |
$$.str= YYSession->strmake($1.str, $1.length); |
|
1110 |
$$.length= $1.length; |
|
1111 |
}
|
|
1112 |
;
|
|
1113 |
||
1
by brian
clean slate |
1114 |
opt_select_from: |
1115 |
opt_limit_clause {} |
|
1116 |
| select_from select_lock_type |
|
1117 |
;
|
|
1118 |
||
1119 |
field_list: |
|
1120 |
field_list_item
|
|
1121 |
| field_list ',' field_list_item |
|
1122 |
;
|
|
1123 |
||
1124 |
field_list_item: |
|
1125 |
column_def
|
|
1126 |
| key_def |
|
1127 |
;
|
|
1128 |
||
1129 |
column_def: |
|
1130 |
field_spec opt_check_constraint |
|
1131 |
| field_spec references |
|
1132 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1133 |
Lex.col_list.clear(); /* Alloced by memory::sql_alloc */ |
1
by brian
clean slate |
1134 |
}
|
1135 |
;
|
|
1136 |
||
1137 |
key_def: |
|
1138 |
key_type opt_ident key_alg '(' key_list ')' key_options |
|
1139 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1140 |
parser::buildKey(&Lex, $1, $2); |
1
by brian
clean slate |
1141 |
}
|
1142 |
| opt_constraint constraint_key_type opt_ident key_alg |
|
1143 |
'(' key_list ')' key_options |
|
1144 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1145 |
parser::buildKey(&Lex, $2, $3.str ? $3 : $1); |
1
by brian
clean slate |
1146 |
}
|
1147 |
| opt_constraint FOREIGN KEY_SYM opt_ident '(' key_list ')' references |
|
1148 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1149 |
parser::buildForeignKey(&Lex, $1.str ? $1 : $4, $8); |
1
by brian
clean slate |
1150 |
}
|
1151 |
| constraint opt_check_constraint |
|
1152 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1153 |
Lex.col_list.clear(); /* Alloced by memory::sql_alloc */ |
1
by brian
clean slate |
1154 |
}
|
1155 |
| opt_constraint check_constraint |
|
1156 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1157 |
Lex.col_list.clear(); /* Alloced by memory::sql_alloc */ |
1
by brian
clean slate |
1158 |
}
|
1159 |
;
|
|
1160 |
||
1161 |
opt_check_constraint: |
|
1162 |
/* empty */ |
|
1163 |
| check_constraint |
|
1164 |
;
|
|
1165 |
||
1166 |
check_constraint: |
|
1167 |
CHECK_SYM expr |
|
1168 |
;
|
|
1169 |
||
1170 |
opt_constraint: |
|
1171 |
/* empty */ { $$= null_lex_str; } |
|
1172 |
| constraint { $$= $1; } |
|
1173 |
;
|
|
1174 |
||
1175 |
constraint: |
|
1176 |
CONSTRAINT opt_ident { $$=$2; } |
|
1177 |
;
|
|
1178 |
||
1179 |
field_spec: |
|
1180 |
field_ident
|
|
1181 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1182 |
parser::buildCreateFieldIdent(&Lex); |
1
by brian
clean slate |
1183 |
}
|
2198.6.6
by Brian Aker
Merge in comments. |
1184 |
field_def opt_attribute_comment |
1
by brian
clean slate |
1185 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1186 |
statement::CreateTable *statement= (statement::CreateTable *)Lex.statement; |
1215.1.3
by stewart at flamingspork
[patch 03/17] set field name in parser, assert that its correct when filling out the rest of the table proto |
1187 |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1188 |
if (Lex.field()) |
2029.1.20
by Brian Aker
Make use of lex for its pointer for field creation. |
1189 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1190 |
Lex.field()->set_name($1.str); |
2029.1.20
by Brian Aker
Make use of lex for its pointer for field creation. |
1191 |
}
|
1215.1.3
by stewart at flamingspork
[patch 03/17] set field name in parser, assert that its correct when filling out the rest of the table proto |
1192 |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1193 |
if (add_field_to_list(Lex.session, &$1, (enum enum_field_types) $3, |
1194 |
Lex.length, Lex.dec, Lex.type, |
|
1128.2.11
by Brian Aker
More rework of Lex for "how tiny can she be..." |
1195 |
statement->column_format, |
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
1196 |
statement->default_value, statement->on_update_value, |
1128.2.11
by Brian Aker
More rework of Lex for "how tiny can she be..." |
1197 |
&statement->comment, |
2227.4.10
by Olaf van der Spek
Session::lex() |
1198 |
statement->change, &Lex.interval_list, Lex.charset)) |
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
1199 |
DRIZZLE_YYABORT; |
1215.1.1
by stewart at flamingspork
[patch 01/17] horrible hack to have one lonely codepath produce Fields in the table proto |
1200 |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1201 |
Lex.setField(NULL); |
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
1202 |
}
|
1203 |
;
|
|
2114.4.9
by Brian Aker
Try not to pass session quite as often |
1204 |
|
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
1205 |
field_def: |
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1206 |
TIMESTAMP_SYM opt_attribute_timestamp |
2198.6.4
by Brian Aker
First pass making sure parser enforces types. |
1207 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1208 |
$$=parser::buildTimestampColumn(&Lex, NULL); |
2198.6.4
by Brian Aker
First pass making sure parser enforces types. |
1209 |
}
|
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1210 |
| TIMESTAMP_SYM '(' NUM ')' opt_attribute_timestamp |
2198.6.4
by Brian Aker
First pass making sure parser enforces types. |
1211 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1212 |
$$=parser::buildTimestampColumn(&Lex, $3.str); |
1213 |
}
|
|
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1214 |
| DATETIME_SYM opt_attribute_timestamp |
2198.6.4
by Brian Aker
First pass making sure parser enforces types. |
1215 |
{
|
1216 |
$$=DRIZZLE_TYPE_DATETIME; |
|
1217 |
||
2227.4.10
by Olaf van der Spek
Session::lex() |
1218 |
if (Lex.field()) |
1219 |
Lex.field()->set_type(message::Table::Field::DATETIME); |
|
1220 |
}
|
|
2198.6.7
by Brian Aker
Push logic of int down into the type and remove BOOL as being different from |
1221 |
| int_type opt_attribute_number |
2227.4.10
by Olaf van der Spek
Session::lex() |
1222 |
{
|
2198.6.7
by Brian Aker
Push logic of int down into the type and remove BOOL as being different from |
1223 |
$$= $1; |
1215.1.5
by stewart at flamingspork
[patch 05/17] Set Field type in proto in parser. |
1224 |
}
|
2198.6.8
by Brian Aker
Clean up the varchar made type. |
1225 |
| CHAR_SYM opt_attribute_string |
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1226 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1227 |
$$= parser::buildVarcharColumn(&Lex, "1"); |
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1228 |
}
|
1229 |
| varchar '(' NUM ')' opt_attribute_string |
|
1230 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1231 |
$$= parser::buildVarcharColumn(&Lex, $3.str); |
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1232 |
}
|
1233 |
| TEXT_SYM opt_attribute_string |
|
1234 |
{
|
|
1235 |
$$=DRIZZLE_TYPE_BLOB; |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1236 |
Lex.length=(char*) 0; /* use default length */ |
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1237 |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1238 |
if (Lex.field()) |
1239 |
Lex.field()->set_type(message::Table::Field::BLOB); |
|
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1240 |
}
|
1241 |
| ENUM_SYM |
|
1242 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1243 |
Lex.interval_list.clear(); |
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1244 |
}
|
1245 |
'(' string_list ')' opt_attribute_string |
|
1246 |
{
|
|
1247 |
$$=DRIZZLE_TYPE_ENUM; |
|
1248 |
||
2227.4.10
by Olaf van der Spek
Session::lex() |
1249 |
if (Lex.field()) |
1250 |
Lex.field()->set_type(message::Table::Field::ENUM); |
|
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1251 |
}
|
1252 |
| VARBINARY '(' NUM ')' opt_attribute |
|
1253 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1254 |
$$= parser::buildVarbinaryColumn(&Lex, $3.str); |
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1255 |
}
|
2198.6.7
by Brian Aker
Push logic of int down into the type and remove BOOL as being different from |
1256 |
| real_type opt_attribute_number |
1215.1.5
by stewart at flamingspork
[patch 05/17] Set Field type in proto in parser. |
1257 |
{
|
2148.5.11
by Brian Aker
Merge in varbinary build method. |
1258 |
assert ($1 == DRIZZLE_TYPE_DOUBLE); |
2227.4.10
by Olaf van der Spek
Session::lex() |
1259 |
$$= parser::buildDoubleColumn(&Lex); |
1260 |
}
|
|
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1261 |
| DATE_SYM opt_attribute |
2136.3.4
by Brian Aker
Add documentation for BOOL/BOOLEAN type, and add a mysql compatible BOOL for |
1262 |
{
|
1263 |
$$=DRIZZLE_TYPE_DATE; |
|
1264 |
||
2227.4.10
by Olaf van der Spek
Session::lex() |
1265 |
if (Lex.field()) |
1266 |
Lex.field()->set_type(message::Table::Field::DATE); |
|
2136.3.4
by Brian Aker
Add documentation for BOOL/BOOLEAN type, and add a mysql compatible BOOL for |
1267 |
}
|
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1268 |
| TIME_SYM opt_attribute |
2136.3.4
by Brian Aker
Add documentation for BOOL/BOOLEAN type, and add a mysql compatible BOOL for |
1269 |
{
|
1270 |
$$=DRIZZLE_TYPE_TIME; |
|
1271 |
||
2227.4.10
by Olaf van der Spek
Session::lex() |
1272 |
if (Lex.field()) |
1273 |
Lex.field()->set_type(message::Table::Field::TIME); |
|
2136.3.4
by Brian Aker
Add documentation for BOOL/BOOLEAN type, and add a mysql compatible BOOL for |
1274 |
}
|
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1275 |
| BLOB_SYM opt_attribute |
2136.3.4
by Brian Aker
Add documentation for BOOL/BOOLEAN type, and add a mysql compatible BOOL for |
1276 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1277 |
$$= parser::buildBlobColumn(&Lex); |
2136.3.4
by Brian Aker
Add documentation for BOOL/BOOLEAN type, and add a mysql compatible BOOL for |
1278 |
}
|
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1279 |
| DECIMAL_SYM float_options opt_attribute_number |
1280 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1281 |
$$= parser::buildDecimalColumn(&Lex); |
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1282 |
}
|
1283 |
| NUMERIC_SYM float_options opt_attribute_number |
|
1284 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1285 |
$$= parser::buildDecimalColumn(&Lex); |
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1286 |
}
|
1287 |
| FIXED_SYM float_options opt_attribute_number |
|
1288 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1289 |
$$= parser::buildDecimalColumn(&Lex); |
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1290 |
}
|
1291 |
| UUID_SYM opt_attribute |
|
1996.2.1
by Brian Aker
uuid type code. |
1292 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1293 |
$$= parser::buildUuidColumn(&Lex); |
1996.2.1
by Brian Aker
uuid type code. |
1294 |
}
|
2198.6.11
by Brian Aker
Have the parser enforce propper default values for boolean. |
1295 |
| BOOLEAN_SYM opt_attribute_boolean |
2060.2.1
by Brian Aker
Merge in SQL reserved word patch |
1296 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1297 |
$$= parser::buildBooleanColumn(&Lex); |
2060.2.1
by Brian Aker
Merge in SQL reserved word patch |
1298 |
}
|
2198.6.6
by Brian Aker
Merge in comments. |
1299 |
| SERIAL_SYM |
1
by brian
clean slate |
1300 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1301 |
$$= parser::buildSerialColumn(&Lex); |
1
by brian
clean slate |
1302 |
}
|
1303 |
;
|
|
1304 |
||
1305 |
varchar: |
|
2198.6.8
by Brian Aker
Clean up the varchar made type. |
1306 |
CHAR_SYM VARYING |
1307 |
{ } |
|
1308 |
| CHAR_SYM |
|
1309 |
{ } |
|
1310 |
| VARCHAR_SYM |
|
1311 |
{ } |
|
1
by brian
clean slate |
1312 |
;
|
1313 |
||
1314 |
int_type: |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1315 |
INT_SYM ignored_field_number_length opt_field_number_signed opt_zerofill |
2198.6.7
by Brian Aker
Push logic of int down into the type and remove BOOL as being different from |
1316 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1317 |
$$= parser::buildIntegerColumn(&Lex, DRIZZLE_TYPE_LONG, ($3 or $4)); |
2198.6.7
by Brian Aker
Push logic of int down into the type and remove BOOL as being different from |
1318 |
}
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1319 |
| BIGINT_SYM ignored_field_number_length opt_field_number_signed opt_zerofill |
2198.6.7
by Brian Aker
Push logic of int down into the type and remove BOOL as being different from |
1320 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1321 |
$$= parser::buildIntegerColumn(&Lex, DRIZZLE_TYPE_LONGLONG, ($3 or $4)); |
2136.3.4
by Brian Aker
Add documentation for BOOL/BOOLEAN type, and add a mysql compatible BOOL for |
1322 |
}
|
1
by brian
clean slate |
1323 |
;
|
1324 |
||
1325 |
real_type: |
|
2198.6.7
by Brian Aker
Push logic of int down into the type and remove BOOL as being different from |
1326 |
REAL opt_precision |
1327 |
{
|
|
1328 |
$$= DRIZZLE_TYPE_DOUBLE; |
|
1329 |
}
|
|
1330 |
| DOUBLE_SYM opt_precision |
|
1331 |
{
|
|
1332 |
$$= DRIZZLE_TYPE_DOUBLE; |
|
1333 |
}
|
|
1334 |
| DOUBLE_SYM PRECISION opt_precision |
|
2136.3.4
by Brian Aker
Add documentation for BOOL/BOOLEAN type, and add a mysql compatible BOOL for |
1335 |
{
|
1336 |
$$= DRIZZLE_TYPE_DOUBLE; |
|
1337 |
}
|
|
1
by brian
clean slate |
1338 |
;
|
1339 |
||
1340 |
float_options: |
|
1341 |
/* empty */ |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1342 |
{ Lex.dec=Lex.length= (char*)0; } |
1
by brian
clean slate |
1343 |
| '(' NUM ')' |
2227.4.10
by Olaf van der Spek
Session::lex() |
1344 |
{ Lex.length=$2.str; Lex.dec= (char*)0; } |
1
by brian
clean slate |
1345 |
| precision |
1346 |
{}
|
|
1347 |
;
|
|
1348 |
||
1349 |
precision: |
|
1350 |
'(' NUM ',' NUM ')' |
|
1351 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1352 |
Lex.length= $2.str; |
1353 |
Lex.dec= $4.str; |
|
1
by brian
clean slate |
1354 |
}
|
1355 |
;
|
|
1356 |
||
1357 |
opt_len: |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1358 |
/* empty */ { Lex.length=(char*) 0; /* use default length */ } |
1359 |
| '(' NUM ')' { Lex.length= $2.str; } |
|
1
by brian
clean slate |
1360 |
;
|
1361 |
||
2008.2.3
by Brian Aker
Fixing up a, somewhat, hidden unsigned type to solve a few issues around |
1362 |
opt_field_number_signed: |
2029.1.13
by Brian Aker
Additional boolean usae in the parser. |
1363 |
/* empty */ { $$= false; } |
1364 |
| SIGNED_SYM { $$= false; } |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1365 |
| UNSIGNED_SYM { $$= true; Lex.type|= UNSIGNED_FLAG; } |
2008.2.3
by Brian Aker
Fixing up a, somewhat, hidden unsigned type to solve a few issues around |
1366 |
;
|
1367 |
||
1368 |
ignored_field_number_length: |
|
1369 |
/* empty */ { } |
|
1370 |
| '(' NUM ')' { } |
|
1371 |
;
|
|
1372 |
||
1373 |
opt_zerofill: |
|
2029.1.12
by Brian Aker
Merge in boolean type that has been added to the parser. |
1374 |
/* empty */ { $$= false; } |
2227.4.10
by Olaf van der Spek
Session::lex() |
1375 |
| ZEROFILL_SYM { $$= true; Lex.type|= UNSIGNED_FLAG; } |
2008.2.3
by Brian Aker
Fixing up a, somewhat, hidden unsigned type to solve a few issues around |
1376 |
;
|
1377 |
||
1
by brian
clean slate |
1378 |
opt_precision: |
2114.7.1
by Andrew Hutchings
Support float(N) in a create table statment, ignore the braces |
1379 |
/* empty */ |
2227.4.10
by Olaf van der Spek
Session::lex() |
1380 |
{ Lex.dec=Lex.length= (char*)0; } |
2114.7.1
by Andrew Hutchings
Support float(N) in a create table statment, ignore the braces |
1381 |
| '(' NUM ')' |
2227.4.10
by Olaf van der Spek
Session::lex() |
1382 |
{ Lex.length=Lex.dec= (char*)0; } |
2114.7.1
by Andrew Hutchings
Support float(N) in a create table statment, ignore the braces |
1383 |
| precision |
1384 |
{}
|
|
1
by brian
clean slate |
1385 |
;
|
1386 |
||
2198.6.9
by Brian Aker
Break out index types. |
1387 |
opt_attribute_not_null: |
1388 |
NULL_SYM
|
|
1389 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1390 |
Lex.type&= ~ NOT_NULL_FLAG; |
2198.6.9
by Brian Aker
Break out index types. |
1391 |
}
|
1392 |
| NOT_SYM NULL_SYM |
|
1393 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1394 |
Lex.type|= NOT_NULL_FLAG; |
2198.6.9
by Brian Aker
Break out index types. |
1395 |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1396 |
if (Lex.field()) |
2198.6.9
by Brian Aker
Break out index types. |
1397 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1398 |
Lex.field()->mutable_constraints()->set_is_notnull(true); |
2198.6.9
by Brian Aker
Break out index types. |
1399 |
}
|
1400 |
}
|
|
1401 |
;
|
|
1402 |
||
1403 |
opt_attribute_index: |
|
1404 |
opt_primary KEY_SYM |
|
1405 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1406 |
parser::buildPrimaryOnColumn(&Lex); |
2198.6.9
by Brian Aker
Break out index types. |
1407 |
}
|
1408 |
| UNIQUE_SYM |
|
1409 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1410 |
parser::buildKeyOnColumn(&Lex); |
2198.6.9
by Brian Aker
Break out index types. |
1411 |
}
|
1412 |
| UNIQUE_SYM KEY_SYM |
|
1413 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1414 |
parser::buildKeyOnColumn(&Lex); |
2198.6.9
by Brian Aker
Break out index types. |
1415 |
}
|
1416 |
;
|
|
1417 |
||
1
by brian
clean slate |
1418 |
opt_attribute: |
1419 |
/* empty */ {} |
|
2198.6.12
by Brian Aker
Clean up the declaraion on attribute. |
1420 |
| opt_attribute opt_attribute_not_null |
2198.6.9
by Brian Aker
Break out index types. |
1421 |
{ } |
2198.6.12
by Brian Aker
Clean up the declaraion on attribute. |
1422 |
| opt_attribute DEFAULT signed_literal |
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
1423 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1424 |
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement; |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
1425 |
|
2198.6.12
by Brian Aker
Clean up the declaraion on attribute. |
1426 |
statement->default_value= $3; |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
1427 |
statement->alter_info.flags.set(ALTER_COLUMN_DEFAULT); |
1
by brian
clean slate |
1428 |
}
|
2198.6.12
by Brian Aker
Clean up the declaraion on attribute. |
1429 |
| opt_attribute opt_attribute_index |
2198.6.9
by Brian Aker
Break out index types. |
1430 |
{ } |
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1431 |
;
|
1432 |
||
2198.6.11
by Brian Aker
Have the parser enforce propper default values for boolean. |
1433 |
opt_attribute_boolean: |
1434 |
/* empty */ { } |
|
1435 |
| opt_attribute_boolean opt_attribute_not_null |
|
1436 |
{ } |
|
1437 |
| opt_attribute_boolean DEFAULT boolean_literal |
|
1438 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1439 |
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement; |
2198.6.11
by Brian Aker
Have the parser enforce propper default values for boolean. |
1440 |
|
1441 |
statement->default_value= $3; |
|
1442 |
statement->alter_info.flags.set(ALTER_COLUMN_DEFAULT); |
|
1443 |
}
|
|
1444 |
| opt_attribute_boolean opt_attribute_index |
|
1445 |
{ } |
|
1446 |
;
|
|
1447 |
||
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1448 |
opt_attribute_string: |
1449 |
/* empty */ {} |
|
1450 |
| opt_attribute_list_string {} |
|
1451 |
;
|
|
1452 |
||
1453 |
opt_attribute_list_string: |
|
1454 |
opt_attribute_list_string attribute_string {} |
|
1455 |
| attribute_string |
|
1456 |
;
|
|
1457 |
||
1458 |
attribute_string: |
|
2198.6.9
by Brian Aker
Break out index types. |
1459 |
opt_attribute_not_null
|
1460 |
{ } |
|
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1461 |
| DEFAULT signed_literal |
1215.1.4
by stewart at flamingspork
[patch 04/17] field comment set in table proto in parser |
1462 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1463 |
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement; |
1215.1.4
by stewart at flamingspork
[patch 04/17] field comment set in table proto in parser |
1464 |
|
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1465 |
statement->default_value=$2; |
1466 |
statement->alter_info.flags.set(ALTER_COLUMN_DEFAULT); |
|
1467 |
}
|
|
1
by brian
clean slate |
1468 |
| COLLATE_SYM collation_name |
1469 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1470 |
if (Lex.charset && !my_charset_same(Lex.charset,$2)) |
1
by brian
clean slate |
1471 |
{
|
1472 |
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0), |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1473 |
$2->name,Lex.charset->csname); |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
1474 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
1475 |
}
|
1476 |
else
|
|
1477 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1478 |
Lex.charset=$2; |
1
by brian
clean slate |
1479 |
}
|
1480 |
}
|
|
2198.6.9
by Brian Aker
Break out index types. |
1481 |
| opt_attribute_index |
1482 |
{ } |
|
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1483 |
;
|
1484 |
||
1485 |
opt_attribute_number: |
|
1486 |
/* empty */ {} |
|
1487 |
| opt_attribute_list_integer {} |
|
1488 |
;
|
|
1489 |
||
1490 |
opt_attribute_list_integer: |
|
1491 |
opt_attribute_list_integer attribute_integer {} |
|
1492 |
| attribute_integer |
|
1493 |
;
|
|
1494 |
||
1495 |
attribute_integer: |
|
2198.6.9
by Brian Aker
Break out index types. |
1496 |
opt_attribute_not_null
|
1497 |
{ } |
|
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1498 |
| AUTO_INC |
1499 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1500 |
parser::buildAutoOnColumn(&Lex); |
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1501 |
}
|
1502 |
| SERIAL_SYM DEFAULT VALUE_SYM |
|
1503 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1504 |
(void)parser::buildSerialColumn(&Lex); |
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1505 |
}
|
2198.6.13
by Brian Aker
Merge fix such that default is better defined on numbers. |
1506 |
| DEFAULT integer_literal |
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1507 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1508 |
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement; |
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1509 |
|
1510 |
statement->default_value=$2; |
|
1511 |
statement->alter_info.flags.set(ALTER_COLUMN_DEFAULT); |
|
1512 |
}
|
|
2198.6.9
by Brian Aker
Break out index types. |
1513 |
| opt_attribute_index |
1514 |
{ } |
|
1
by brian
clean slate |
1515 |
;
|
1516 |
||
2198.6.4
by Brian Aker
First pass making sure parser enforces types. |
1517 |
opt_attribute_timestamp: |
1518 |
/* empty */ {} |
|
1519 |
| opt_attribute_list_timestamp {} |
|
1520 |
;
|
|
1521 |
||
1522 |
opt_attribute_list_timestamp: |
|
1523 |
opt_attribute_list_timestamp attribute_timestamp {} |
|
1524 |
| attribute_timestamp |
|
1525 |
;
|
|
1526 |
||
1527 |
attribute_timestamp: |
|
2198.6.9
by Brian Aker
Break out index types. |
1528 |
opt_attribute_not_null
|
1529 |
{ } |
|
2198.6.4
by Brian Aker
First pass making sure parser enforces types. |
1530 |
| DEFAULT NOW_SYM optional_braces |
1531 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1532 |
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement; |
2198.6.4
by Brian Aker
First pass making sure parser enforces types. |
1533 |
|
1534 |
statement->default_value= new Item_func_now_local(); |
|
1535 |
statement->alter_info.flags.set(ALTER_COLUMN_DEFAULT); |
|
1536 |
}
|
|
2198.6.10
by Brian Aker
Scope out timestamp to only take certain types of values as default. |
1537 |
| DEFAULT date_literal |
2198.6.4
by Brian Aker
First pass making sure parser enforces types. |
1538 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1539 |
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement; |
2198.6.4
by Brian Aker
First pass making sure parser enforces types. |
1540 |
|
1541 |
statement->default_value=$2; |
|
1542 |
statement->alter_info.flags.set(ALTER_COLUMN_DEFAULT); |
|
1543 |
}
|
|
1544 |
| ON UPDATE_SYM NOW_SYM optional_braces |
|
1545 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1546 |
((statement::AlterTable *)Lex.statement)->on_update_value= new Item_func_now_local(); |
2198.6.4
by Brian Aker
First pass making sure parser enforces types. |
1547 |
}
|
2198.6.9
by Brian Aker
Break out index types. |
1548 |
| opt_attribute_index |
1549 |
{ } |
|
2198.6.5
by Brian Aker
Enforce field attributes via the parser. |
1550 |
;
|
1551 |
||
1552 |
opt_attribute_comment: |
|
1553 |
/* empty */ { } |
|
2198.6.6
by Brian Aker
Merge in comments. |
1554 |
| COMMENT_SYM TEXT_STRING_sys |
2198.6.4
by Brian Aker
First pass making sure parser enforces types. |
1555 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1556 |
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement; |
2198.6.4
by Brian Aker
First pass making sure parser enforces types. |
1557 |
statement->comment= $2; |
1558 |
||
2227.4.10
by Olaf van der Spek
Session::lex() |
1559 |
if (Lex.field()) |
1560 |
Lex.field()->set_comment($2.str); |
|
2198.6.4
by Brian Aker
First pass making sure parser enforces types. |
1561 |
}
|
1562 |
;
|
|
1563 |
||
1
by brian
clean slate |
1564 |
collation_name: |
1565 |
ident_or_text
|
|
1566 |
{
|
|
862
by Brian Aker
Remove charset directory code. |
1567 |
if (!($$=get_charset_by_name($1.str))) |
1
by brian
clean slate |
1568 |
{
|
1569 |
my_error(ER_UNKNOWN_COLLATION, MYF(0), $1.str); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
1570 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
1571 |
}
|
1572 |
}
|
|
1573 |
;
|
|
1574 |
||
1575 |
collation_name_or_default: |
|
1576 |
collation_name { $$=$1; } |
|
1577 |
| DEFAULT { $$=NULL; } |
|
1578 |
;
|
|
1579 |
||
1580 |
opt_default: |
|
1581 |
/* empty */ {} |
|
1582 |
| DEFAULT {} |
|
1583 |
;
|
|
1584 |
||
1585 |
opt_primary: |
|
1586 |
/* empty */ |
|
1587 |
| PRIMARY_SYM |
|
1588 |
;
|
|
1589 |
||
1590 |
references: |
|
2172.3.21
by Brian Aker
Clean up REFERENCE line in parser. |
1591 |
REFERENCES table_ident opt_ref_list opt_match_clause opt_on_update_delete |
1
by brian
clean slate |
1592 |
{
|
1593 |
$$=$2; |
|
1594 |
}
|
|
1595 |
;
|
|
1596 |
||
1597 |
opt_ref_list: |
|
1598 |
/* empty */ |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1599 |
{ Lex.ref_list.clear(); } |
1
by brian
clean slate |
1600 |
| '(' ref_list ')' |
1601 |
;
|
|
1602 |
||
1603 |
ref_list: |
|
1604 |
ref_list ',' ident |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1605 |
{ Lex.ref_list.push_back(new Key_part_spec($3, 0)); } |
1
by brian
clean slate |
1606 |
| ident |
1607 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1608 |
Lex.ref_list.clear(); |
1609 |
Lex.ref_list.push_back(new Key_part_spec($1, 0)); |
|
1
by brian
clean slate |
1610 |
}
|
1611 |
;
|
|
1612 |
||
1613 |
opt_match_clause: |
|
1614 |
/* empty */ |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1615 |
{ ((statement::CreateTable *)Lex.statement)->fk_match_option= drizzled::message::Table::ForeignKeyConstraint::MATCH_UNDEFINED; } |
1
by brian
clean slate |
1616 |
| MATCH FULL |
2227.4.10
by Olaf van der Spek
Session::lex() |
1617 |
{ ((statement::CreateTable *)Lex.statement)->fk_match_option= drizzled::message::Table::ForeignKeyConstraint::MATCH_FULL; } |
1
by brian
clean slate |
1618 |
| MATCH PARTIAL |
2227.4.10
by Olaf van der Spek
Session::lex() |
1619 |
{ ((statement::CreateTable *)Lex.statement)->fk_match_option= drizzled::message::Table::ForeignKeyConstraint::MATCH_PARTIAL; } |
1
by brian
clean slate |
1620 |
| MATCH SIMPLE_SYM |
2227.4.10
by Olaf van der Spek
Session::lex() |
1621 |
{ ((statement::CreateTable *)Lex.statement)->fk_match_option= drizzled::message::Table::ForeignKeyConstraint::MATCH_SIMPLE; } |
1
by brian
clean slate |
1622 |
;
|
1623 |
||
1624 |
opt_on_update_delete: |
|
1625 |
/* empty */ |
|
1626 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1627 |
((statement::CreateTable *)Lex.statement)->fk_update_opt= drizzled::message::Table::ForeignKeyConstraint::OPTION_UNDEF; |
1628 |
((statement::CreateTable *)Lex.statement)->fk_delete_opt= drizzled::message::Table::ForeignKeyConstraint::OPTION_UNDEF; |
|
1
by brian
clean slate |
1629 |
}
|
1630 |
| ON UPDATE_SYM delete_option |
|
1631 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1632 |
((statement::CreateTable *)Lex.statement)->fk_update_opt= $3; |
1633 |
((statement::CreateTable *)Lex.statement)->fk_delete_opt= drizzled::message::Table::ForeignKeyConstraint::OPTION_UNDEF; |
|
1
by brian
clean slate |
1634 |
}
|
1635 |
| ON DELETE_SYM delete_option |
|
1636 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1637 |
((statement::CreateTable *)Lex.statement)->fk_update_opt= drizzled::message::Table::ForeignKeyConstraint::OPTION_UNDEF; |
1638 |
((statement::CreateTable *)Lex.statement)->fk_delete_opt= $3; |
|
1
by brian
clean slate |
1639 |
}
|
1640 |
| ON UPDATE_SYM delete_option |
|
1641 |
ON DELETE_SYM delete_option |
|
1642 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1643 |
((statement::CreateTable *)Lex.statement)->fk_update_opt= $3; |
1644 |
((statement::CreateTable *)Lex.statement)->fk_delete_opt= $6; |
|
1
by brian
clean slate |
1645 |
}
|
1646 |
| ON DELETE_SYM delete_option |
|
1647 |
ON UPDATE_SYM delete_option |
|
1648 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1649 |
((statement::CreateTable *)Lex.statement)->fk_update_opt= $6; |
1650 |
((statement::CreateTable *)Lex.statement)->fk_delete_opt= $3; |
|
1
by brian
clean slate |
1651 |
}
|
1652 |
;
|
|
1653 |
||
1654 |
delete_option: |
|
1638.9.2
by Stewart Smith
use the ENUM in the table proto instead of duplicating it for Foreign key options and match option. A move in the direction of just having foreign keys in the proto |
1655 |
RESTRICT { $$= drizzled::message::Table::ForeignKeyConstraint::OPTION_RESTRICT; } |
1656 |
| CASCADE { $$= drizzled::message::Table::ForeignKeyConstraint::OPTION_CASCADE; } |
|
2030.1.1
by Brian Aker
Small set of symbol updates. |
1657 |
| SET_SYM NULL_SYM { $$= drizzled::message::Table::ForeignKeyConstraint::OPTION_SET_NULL; } |
1638.9.2
by Stewart Smith
use the ENUM in the table proto instead of duplicating it for Foreign key options and match option. A move in the direction of just having foreign keys in the proto |
1658 |
| NO_SYM ACTION { $$= drizzled::message::Table::ForeignKeyConstraint::OPTION_NO_ACTION; } |
2030.1.1
by Brian Aker
Small set of symbol updates. |
1659 |
| SET_SYM DEFAULT { $$= drizzled::message::Table::ForeignKeyConstraint::OPTION_SET_DEFAULT; } |
1
by brian
clean slate |
1660 |
;
|
1661 |
||
1662 |
key_type: |
|
1663 |
key_or_index { $$= Key::MULTIPLE; } |
|
1664 |
;
|
|
1665 |
||
1666 |
constraint_key_type: |
|
1667 |
PRIMARY_SYM KEY_SYM { $$= Key::PRIMARY; } |
|
1668 |
| UNIQUE_SYM opt_key_or_index { $$= Key::UNIQUE; } |
|
1669 |
;
|
|
1670 |
||
1671 |
key_or_index: |
|
1672 |
KEY_SYM {} |
|
1673 |
| INDEX_SYM {} |
|
1674 |
;
|
|
1675 |
||
1676 |
opt_key_or_index: |
|
1677 |
/* empty */ {} |
|
1678 |
| key_or_index |
|
1679 |
;
|
|
1680 |
||
1681 |
keys_or_index: |
|
1682 |
KEYS {} |
|
1683 |
| INDEX_SYM {} |
|
1684 |
| INDEXES {} |
|
1685 |
;
|
|
1686 |
||
1687 |
opt_unique: |
|
1688 |
/* empty */ { $$= Key::MULTIPLE; } |
|
1689 |
| UNIQUE_SYM { $$= Key::UNIQUE; } |
|
1690 |
;
|
|
1691 |
||
1692 |
init_key_options: |
|
1693 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1694 |
((statement::CreateTable *)Lex.statement)->key_create_info= default_key_create_info; |
1
by brian
clean slate |
1695 |
}
|
1696 |
;
|
|
1697 |
||
1698 |
/*
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1699 |
For now, key_alg initializies Lex.key_create_info. |
1
by brian
clean slate |
1700 |
In the future, when all key options are after key definition, |
1701 |
we can remove key_alg and move init_key_options to key_options |
|
1702 |
*/
|
|
1703 |
||
1704 |
key_alg: |
|
1705 |
init_key_options
|
|
1706 |
| init_key_options key_using_alg |
|
1707 |
;
|
|
1708 |
||
1709 |
key_options: |
|
1710 |
/* empty */ {} |
|
1711 |
| key_opts |
|
1712 |
;
|
|
1713 |
||
1714 |
key_opts: |
|
1715 |
key_opt
|
|
1716 |
| key_opts key_opt |
|
1717 |
;
|
|
1718 |
||
1719 |
key_using_alg: |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1720 |
USING btree_or_rtree { ((statement::CreateTable *)Lex.statement)->key_create_info.algorithm= $2; } |
1
by brian
clean slate |
1721 |
;
|
1722 |
||
1723 |
key_opt: |
|
1724 |
key_using_alg
|
|
1725 |
| KEY_BLOCK_SIZE opt_equal ulong_num |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1726 |
{ ((statement::CreateTable *)Lex.statement)->key_create_info.block_size= $3; } |
1
by brian
clean slate |
1727 |
| COMMENT_SYM TEXT_STRING_sys |
2227.4.10
by Olaf van der Spek
Session::lex() |
1728 |
{ ((statement::CreateTable *)Lex.statement)->key_create_info.comment= $2; } |
1
by brian
clean slate |
1729 |
;
|
1730 |
||
1731 |
btree_or_rtree: |
|
1732 |
BTREE_SYM { $$= HA_KEY_ALG_BTREE; } |
|
1733 |
| HASH_SYM { $$= HA_KEY_ALG_HASH; } |
|
1734 |
;
|
|
1735 |
||
1736 |
key_list: |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1737 |
key_list ',' key_part order_dir { Lex.col_list.push_back($3); } |
1738 |
| key_part order_dir { Lex.col_list.push_back($1); } |
|
1
by brian
clean slate |
1739 |
;
|
1740 |
||
1741 |
key_part: |
|
1742 |
ident { $$=new Key_part_spec($1, 0); } |
|
1743 |
| ident '(' NUM ')' |
|
1744 |
{
|
|
1745 |
int key_part_len= atoi($3.str); |
|
1746 |
if (!key_part_len) |
|
1747 |
{
|
|
1748 |
my_error(ER_KEY_PART_0, MYF(0), $1.str); |
|
1749 |
}
|
|
1750 |
$$=new Key_part_spec($1, (uint) key_part_len); |
|
1751 |
}
|
|
1752 |
;
|
|
1753 |
||
1754 |
opt_ident: |
|
1755 |
/* empty */ { $$= null_lex_str; } |
|
1756 |
| field_ident { $$= $1; } |
|
1757 |
;
|
|
1758 |
||
1759 |
opt_component: |
|
1760 |
/* empty */ { $$= null_lex_str; } |
|
1761 |
| '.' ident { $$= $2; } |
|
1762 |
;
|
|
1763 |
||
1764 |
string_list: |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1765 |
text_string { Lex.interval_list.push_back($1); } |
1766 |
| string_list ',' text_string { Lex.interval_list.push_back($3); }; |
|
1
by brian
clean slate |
1767 |
|
1768 |
/*
|
|
1769 |
** Alter table |
|
1770 |
*/
|
|
1771 |
||
1772 |
alter: |
|
2030.1.1
by Brian Aker
Small set of symbol updates. |
1773 |
ALTER_SYM build_method opt_ignore TABLE_SYM table_ident |
1
by brian
clean slate |
1774 |
{
|
2200.2.15
by Stewart Smith
remove enum ha_build_method and instead use the build method in message::AlterTable. |
1775 |
statement::AlterTable *statement= new statement::AlterTable(YYSession, $5); |
2227.4.10
by Olaf van der Spek
Session::lex() |
1776 |
Lex.statement= statement; |
1777 |
Lex.duplicates= DUP_ERROR; |
|
1778 |
if (not Lex.select_lex.add_table_to_list(YYSession, $5, NULL, TL_OPTION_UPDATING)) |
|
2096.1.4
by Brian Aker
Clean up errors and pass information in creation of statement. |
1779 |
{
|
2029.1.15
by Brian Aker
Remove useless copy. |
1780 |
DRIZZLE_YYABORT; |
2096.1.4
by Brian Aker
Clean up errors and pass information in creation of statement. |
1781 |
}
|
2029.1.15
by Brian Aker
Remove useless copy. |
1782 |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1783 |
Lex.col_list.clear(); |
1784 |
Lex.select_lex.init_order(); |
|
1785 |
Lex.select_lex.db= const_cast<char *>(((TableList*) Lex.select_lex.table_list.first)->getSchemaName()); |
|
1
by brian
clean slate |
1786 |
}
|
1787 |
alter_commands
|
|
1788 |
{}
|
|
2060.2.5
by Brian Aker
Adjust name, we aren't really return an ident, it is just a name. |
1789 |
| ALTER_SYM DATABASE schema_name |
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
1790 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1791 |
Lex.statement= new statement::AlterSchema(YYSession); |
1128.2.3
by Brian Aker
Remove create_info from global |
1792 |
}
|
1128.2.7
by Brian Aker
Cleanup previous issues in create sql_yacc |
1793 |
default_collation_schema
|
1128.2.3
by Brian Aker
Remove create_info from global |
1794 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1795 |
Lex.name= $3; |
1796 |
if (Lex.name.str == NULL && Lex.copy_db_to(&Lex.name.str, &Lex.name.length)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
1797 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
1798 |
}
|
1799 |
;
|
|
1800 |
||
1801 |
alter_commands: |
|
1802 |
/* empty */ |
|
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
1803 |
| DISCARD TABLESPACE |
1804 |
{
|
|
2200.2.3
by Stewart Smith
add code to store IMPORT/DISCARD TABLESPACE operation in the AlterTable protobuf message. assert that we get the right thing in alter table code |
1805 |
message::AlterTable::AlterTableOperation *alter_operation; |
2200.2.25
by Stewart Smith
Merge refactoring of default values work |
1806 |
alter_operation= Lex.alter_table()->add_operations(); |
2200.2.3
by Stewart Smith
add code to store IMPORT/DISCARD TABLESPACE operation in the AlterTable protobuf message. assert that we get the right thing in alter table code |
1807 |
alter_operation->set_operation(message::AlterTable::AlterTableOperation::DISCARD_TABLESPACE); |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
1808 |
}
|
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
1809 |
| IMPORT TABLESPACE |
1810 |
{
|
|
2200.2.3
by Stewart Smith
add code to store IMPORT/DISCARD TABLESPACE operation in the AlterTable protobuf message. assert that we get the right thing in alter table code |
1811 |
message::AlterTable::AlterTableOperation *alter_operation; |
2200.2.25
by Stewart Smith
Merge refactoring of default values work |
1812 |
alter_operation= Lex.alter_table()->add_operations(); |
2200.2.3
by Stewart Smith
add code to store IMPORT/DISCARD TABLESPACE operation in the AlterTable protobuf message. assert that we get the right thing in alter table code |
1813 |
alter_operation->set_operation(message::AlterTable::AlterTableOperation::IMPORT_TABLESPACE); |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
1814 |
}
|
1
by brian
clean slate |
1815 |
| alter_list |
1816 |
;
|
|
1817 |
||
1818 |
build_method: |
|
1819 |
/* empty */ |
|
1820 |
{
|
|
2200.2.25
by Stewart Smith
Merge refactoring of default values work |
1821 |
Lex.alter_table()->set_build_method(message::AlterTable::BUILD_DEFAULT); |
1
by brian
clean slate |
1822 |
}
|
1823 |
| ONLINE_SYM |
|
1824 |
{
|
|
2200.2.25
by Stewart Smith
Merge refactoring of default values work |
1825 |
Lex.alter_table()->set_build_method(message::AlterTable::BUILD_ONLINE); |
1
by brian
clean slate |
1826 |
}
|
1827 |
| OFFLINE_SYM |
|
1828 |
{
|
|
2200.2.25
by Stewart Smith
Merge refactoring of default values work |
1829 |
Lex.alter_table()->set_build_method(message::AlterTable::BUILD_OFFLINE); |
1
by brian
clean slate |
1830 |
}
|
1831 |
;
|
|
1832 |
||
1833 |
alter_list: |
|
1834 |
alter_list_item
|
|
1835 |
| alter_list ',' alter_list_item |
|
1836 |
;
|
|
1837 |
||
1838 |
add_column: |
|
2030.1.1
by Brian Aker
Small set of symbol updates. |
1839 |
ADD_SYM opt_column |
1
by brian
clean slate |
1840 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1841 |
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement; |
1128.2.11
by Brian Aker
More rework of Lex for "how tiny can she be..." |
1842 |
|
1843 |
statement->change=0; |
|
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
1844 |
statement->alter_info.flags.set(ALTER_ADD_COLUMN); |
1
by brian
clean slate |
1845 |
}
|
1846 |
;
|
|
1847 |
||
1848 |
alter_list_item: |
|
1849 |
add_column column_def opt_place { } |
|
2030.1.1
by Brian Aker
Small set of symbol updates. |
1850 |
| ADD_SYM key_def |
1
by brian
clean slate |
1851 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1852 |
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement; |
1128.2.11
by Brian Aker
More rework of Lex for "how tiny can she be..." |
1853 |
|
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
1854 |
statement->alter_info.flags.set(ALTER_ADD_INDEX); |
1
by brian
clean slate |
1855 |
}
|
1856 |
| add_column '(' field_list ')' |
|
1857 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1858 |
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement; |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
1859 |
|
1860 |
statement->alter_info.flags.set(ALTER_ADD_COLUMN); |
|
1861 |
statement->alter_info.flags.set(ALTER_ADD_INDEX); |
|
1
by brian
clean slate |
1862 |
}
|
2030.1.1
by Brian Aker
Small set of symbol updates. |
1863 |
| CHANGE_SYM opt_column field_ident |
1
by brian
clean slate |
1864 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1865 |
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement; |
1128.2.11
by Brian Aker
More rework of Lex for "how tiny can she be..." |
1866 |
statement->change= $3.str; |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
1867 |
statement->alter_info.flags.set(ALTER_CHANGE_COLUMN); |
1
by brian
clean slate |
1868 |
}
|
1869 |
field_spec opt_place |
|
1870 |
| MODIFY_SYM opt_column field_ident |
|
1871 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1872 |
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement; |
1873 |
Lex.length= Lex.dec=0; |
|
1874 |
Lex.type= 0; |
|
1128.2.11
by Brian Aker
More rework of Lex for "how tiny can she be..." |
1875 |
statement->default_value= statement->on_update_value= 0; |
1876 |
statement->comment= null_lex_str; |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1877 |
Lex.charset= NULL; |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
1878 |
statement->alter_info.flags.set(ALTER_CHANGE_COLUMN); |
1128.2.11
by Brian Aker
More rework of Lex for "how tiny can she be..." |
1879 |
statement->column_format= COLUMN_FORMAT_TYPE_DEFAULT; |
1215.1.2
by stewart at flamingspork
[patch 02/17] field NULL | NOT NULL in proto in parser. Only for CREATE TABLE. Change default in proto to reflect default in SQL. |
1880 |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1881 |
Lex.setField(NULL); |
1
by brian
clean slate |
1882 |
}
|
2198.6.6
by Brian Aker
Merge in comments. |
1883 |
field_def opt_attribute_comment |
1
by brian
clean slate |
1884 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1885 |
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement; |
1128.2.11
by Brian Aker
More rework of Lex for "how tiny can she be..." |
1886 |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1887 |
if (add_field_to_list(Lex.session,&$3, |
1
by brian
clean slate |
1888 |
(enum enum_field_types) $5, |
2227.4.10
by Olaf van der Spek
Session::lex() |
1889 |
Lex.length, Lex.dec, Lex.type, |
1128.2.11
by Brian Aker
More rework of Lex for "how tiny can she be..." |
1890 |
statement->column_format, |
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
1891 |
statement->default_value, |
1128.2.11
by Brian Aker
More rework of Lex for "how tiny can she be..." |
1892 |
statement->on_update_value, |
1893 |
&statement->comment, |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1894 |
$3.str, &Lex.interval_list, Lex.charset)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
1895 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
1896 |
}
|
1897 |
opt_place
|
|
184
by Brian Aker
Dead debug code removal (and a compatible "never used") bit in the |
1898 |
| DROP opt_column field_ident |
1
by brian
clean slate |
1899 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1900 |
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement; |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
1901 |
|
1902 |
statement->alter_info.flags.set(ALTER_DROP_COLUMN); |
|
2200.2.18
by Stewart Smith
add fields, indexes and foreign keys to drop in ALTER TABLE DROP and DROP INDEX to the AlterTable protobuf message in parser |
1903 |
message::AlterTable::AlterTableOperation *operation; |
2200.2.25
by Stewart Smith
Merge refactoring of default values work |
1904 |
operation= Lex.alter_table()->add_operations(); |
2200.2.18
by Stewart Smith
add fields, indexes and foreign keys to drop in ALTER TABLE DROP and DROP INDEX to the AlterTable protobuf message in parser |
1905 |
operation->set_operation(message::AlterTable::AlterTableOperation::DROP_COLUMN); |
1906 |
operation->set_drop_name($3.str); |
|
1
by brian
clean slate |
1907 |
}
|
1908 |
| DROP FOREIGN KEY_SYM opt_ident |
|
1909 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1910 |
parser::buildAddAlterDropIndex(&Lex, $4.str, true); |
1
by brian
clean slate |
1911 |
}
|
1912 |
| DROP PRIMARY_SYM KEY_SYM |
|
1913 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1914 |
parser::buildAddAlterDropIndex(&Lex, "PRIMARY"); |
1
by brian
clean slate |
1915 |
}
|
1916 |
| DROP key_or_index field_ident |
|
1917 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1918 |
parser::buildAddAlterDropIndex(&Lex, $3.str); |
1
by brian
clean slate |
1919 |
}
|
1920 |
| DISABLE_SYM KEYS |
|
1921 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1922 |
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement; |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
1923 |
|
1924 |
statement->alter_info.flags.set(ALTER_KEYS_ONOFF); |
|
2200.2.12
by Stewart Smith
set RenameTable and AlterKeysOnOff protobuf messages inside the AlterTable protobuf message for ALTER TABLE in parser |
1925 |
|
1926 |
message::AlterTable::AlterKeysOnOff *alter_keys_operation; |
|
2200.2.25
by Stewart Smith
Merge refactoring of default values work |
1927 |
alter_keys_operation= Lex.alter_table()->mutable_alter_keys_onoff(); |
2200.2.12
by Stewart Smith
set RenameTable and AlterKeysOnOff protobuf messages inside the AlterTable protobuf message for ALTER TABLE in parser |
1928 |
alter_keys_operation->set_enable(false); |
1
by brian
clean slate |
1929 |
}
|
1930 |
| ENABLE_SYM KEYS |
|
1931 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1932 |
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement; |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
1933 |
|
1934 |
statement->alter_info.flags.set(ALTER_KEYS_ONOFF); |
|
2200.2.12
by Stewart Smith
set RenameTable and AlterKeysOnOff protobuf messages inside the AlterTable protobuf message for ALTER TABLE in parser |
1935 |
message::AlterTable::AlterKeysOnOff *alter_keys_operation; |
2200.2.25
by Stewart Smith
Merge refactoring of default values work |
1936 |
alter_keys_operation= Lex.alter_table()->mutable_alter_keys_onoff(); |
2200.2.12
by Stewart Smith
set RenameTable and AlterKeysOnOff protobuf messages inside the AlterTable protobuf message for ALTER TABLE in parser |
1937 |
alter_keys_operation->set_enable(true); |
1
by brian
clean slate |
1938 |
}
|
2030.1.1
by Brian Aker
Small set of symbol updates. |
1939 |
| ALTER_SYM opt_column field_ident SET_SYM DEFAULT signed_literal |
1
by brian
clean slate |
1940 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1941 |
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement; |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
1942 |
|
2179.7.2
by Olaf van der Spek
x |
1943 |
statement->alter_info.alter_list.push_back(AlterColumn($3.str,$6)); |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
1944 |
statement->alter_info.flags.set(ALTER_COLUMN_DEFAULT); |
1
by brian
clean slate |
1945 |
}
|
2030.1.1
by Brian Aker
Small set of symbol updates. |
1946 |
| ALTER_SYM opt_column field_ident DROP DEFAULT |
1
by brian
clean slate |
1947 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1948 |
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement; |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
1949 |
|
2179.7.2
by Olaf van der Spek
x |
1950 |
statement->alter_info.alter_list.push_back(AlterColumn($3.str, (Item*) 0)); |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
1951 |
statement->alter_info.flags.set(ALTER_COLUMN_DEFAULT); |
1
by brian
clean slate |
1952 |
}
|
1953 |
| RENAME opt_to table_ident |
|
1954 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1955 |
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement; |
1
by brian
clean slate |
1956 |
size_t dummy; |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
1957 |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1958 |
Lex.select_lex.db=$3->db.str; |
1959 |
if (Lex.select_lex.db == NULL && |
|
1960 |
Lex.copy_db_to(&Lex.select_lex.db, &dummy)) |
|
1
by brian
clean slate |
1961 |
{
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
1962 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
1963 |
}
|
1235.4.9
by Stewart Smith
remove check_db_name() from sql_yacc.yy and replace with NormalisedDatabaseName and friends. This check should really be down a layer... but let's not change everything at once |
1964 |
|
1965 |
if (check_table_name($3->table.str,$3->table.length)) |
|
1
by brian
clean slate |
1966 |
{
|
1967 |
my_error(ER_WRONG_TABLE_NAME, MYF(0), $3->table.str); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
1968 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
1969 |
}
|
1235.4.9
by Stewart Smith
remove check_db_name() from sql_yacc.yy and replace with NormalisedDatabaseName and friends. This check should really be down a layer... but let's not change everything at once |
1970 |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1971 |
Lex.name= $3->table; |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
1972 |
statement->alter_info.flags.set(ALTER_RENAME); |
2200.2.12
by Stewart Smith
set RenameTable and AlterKeysOnOff protobuf messages inside the AlterTable protobuf message for ALTER TABLE in parser |
1973 |
|
1974 |
message::AlterTable::RenameTable *rename_operation; |
|
2200.2.25
by Stewart Smith
Merge refactoring of default values work |
1975 |
rename_operation= Lex.alter_table()->mutable_rename(); |
1976 |
rename_operation->set_to_schema(Lex.select_lex.db); |
|
1977 |
rename_operation->set_to_name(Lex.name.str); |
|
1
by brian
clean slate |
1978 |
}
|
383.1.27
by Brian Aker
Next pass in the unending saga of UTF-8.. now we can set in SQL collation |
1979 |
| CONVERT_SYM TO_SYM collation_name_or_default |
1
by brian
clean slate |
1980 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1981 |
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement; |
1128.2.3
by Brian Aker
Remove create_info from global |
1982 |
|
2029.1.2
by Brian Aker
Merge in refactor of LIKE up to its own calling pointer in the parser. |
1983 |
statement->create_info().table_charset= |
1984 |
statement->create_info().default_table_charset= $3; |
|
1985 |
statement->create_info().used_fields|= (HA_CREATE_USED_CHARSET | |
|
1
by brian
clean slate |
1986 |
HA_CREATE_USED_DEFAULT_CHARSET); |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
1987 |
statement->alter_info.flags.set(ALTER_CONVERT); |
1
by brian
clean slate |
1988 |
}
|
1989 |
| create_table_options_space_separated |
|
1990 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1991 |
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement; |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
1992 |
|
1993 |
statement->alter_info.flags.set(ALTER_OPTIONS); |
|
1
by brian
clean slate |
1994 |
}
|
1995 |
| FORCE_SYM |
|
1996 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
1997 |
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement; |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
1998 |
|
1999 |
statement->alter_info.flags.set(ALTER_FORCE); |
|
1
by brian
clean slate |
2000 |
}
|
2001 |
| alter_order_clause |
|
2002 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2003 |
statement::AlterTable *statement= (statement::AlterTable *)Lex.statement; |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
2004 |
|
2005 |
statement->alter_info.flags.set(ALTER_ORDER); |
|
1
by brian
clean slate |
2006 |
}
|
2007 |
;
|
|
2008 |
||
2009 |
opt_column: |
|
2010 |
/* empty */ {} |
|
2011 |
| COLUMN_SYM {} |
|
2012 |
;
|
|
2013 |
||
2014 |
opt_ignore: |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2015 |
/* empty */ { Lex.ignore= 0;} |
2016 |
| IGNORE_SYM { Lex.ignore= 1;} |
|
1
by brian
clean slate |
2017 |
;
|
2018 |
||
2019 |
opt_place: |
|
2020 |
/* empty */ {} |
|
2021 |
| AFTER_SYM ident |
|
2022 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2023 |
parser::storeAlterColumnPosition(&Lex, $2.str); |
1
by brian
clean slate |
2024 |
}
|
2025 |
| FIRST_SYM |
|
2026 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2027 |
parser::storeAlterColumnPosition(&Lex, first_keyword); |
1
by brian
clean slate |
2028 |
}
|
2029 |
;
|
|
2030 |
||
2031 |
opt_to: |
|
2032 |
/* empty */ {} |
|
2033 |
| TO_SYM {} |
|
2034 |
| AS {} |
|
2035 |
;
|
|
2036 |
||
2037 |
start: |
|
2038 |
START_SYM TRANSACTION_SYM start_transaction_opts |
|
2039 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2040 |
Lex.statement= new statement::StartTransaction(YYSession, (start_transaction_option_t)$3); |
1
by brian
clean slate |
2041 |
}
|
2042 |
;
|
|
2043 |
||
2044 |
start_transaction_opts: |
|
1206.1.3
by Brian Aker
Valgrind fix for startTransaction() |
2045 |
/*empty*/ { $$ = START_TRANS_NO_OPTIONS; } |
1
by brian
clean slate |
2046 |
| WITH CONSISTENT_SYM SNAPSHOT_SYM |
2047 |
{
|
|
1206.1.3
by Brian Aker
Valgrind fix for startTransaction() |
2048 |
$$= START_TRANS_OPT_WITH_CONS_SNAPSHOT; |
1
by brian
clean slate |
2049 |
}
|
2050 |
;
|
|
2051 |
||
2052 |
analyze: |
|
383.1.26
by Brian Aker
Removed option for single command replication and have now left disable of |
2053 |
ANALYZE_SYM table_or_tables |
1
by brian
clean slate |
2054 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2055 |
Lex.statement= new statement::Analyze(YYSession); |
1
by brian
clean slate |
2056 |
}
|
2057 |
table_list
|
|
2058 |
{}
|
|
2059 |
;
|
|
2060 |
||
2061 |
check: |
|
2062 |
CHECK_SYM table_or_tables |
|
2063 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2064 |
Lex.statement= new statement::Check(YYSession); |
1
by brian
clean slate |
2065 |
}
|
1222.1.10
by Brian Aker
Removes options from DDL left in Cursor for admin operations (they were |
2066 |
table_list
|
1
by brian
clean slate |
2067 |
{}
|
2068 |
;
|
|
2069 |
||
2070 |
rename: |
|
2071 |
RENAME table_or_tables |
|
2072 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2073 |
Lex.statement= new statement::RenameTable(YYSession); |
1
by brian
clean slate |
2074 |
}
|
2075 |
table_to_table_list
|
|
2076 |
{}
|
|
2077 |
;
|
|
2078 |
||
2079 |
table_to_table_list: |
|
2080 |
table_to_table
|
|
2081 |
| table_to_table_list ',' table_to_table |
|
2082 |
;
|
|
2083 |
||
2084 |
table_to_table: |
|
2085 |
table_ident TO_SYM table_ident |
|
2086 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2087 |
Select_Lex *sl= Lex.current_select; |
2088 |
if (!sl->add_table_to_list(Lex.session, $1,NULL,TL_OPTION_UPDATING, |
|
1
by brian
clean slate |
2089 |
TL_IGNORE) || |
2227.4.10
by Olaf van der Spek
Session::lex() |
2090 |
!sl->add_table_to_list(Lex.session, $3,NULL,TL_OPTION_UPDATING, |
1
by brian
clean slate |
2091 |
TL_IGNORE)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2092 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2093 |
}
|
2094 |
;
|
|
2095 |
||
2096 |
/*
|
|
2097 |
Select : retrieve data from table |
|
2098 |
*/
|
|
2099 |
||
2100 |
||
2101 |
select: |
|
2102 |
select_init
|
|
2103 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2104 |
Lex.statement= new statement::Select(YYSession); |
1
by brian
clean slate |
2105 |
}
|
2106 |
;
|
|
2107 |
||
2108 |
/* Need select_init2 for subselects. */ |
|
2109 |
select_init: |
|
2110 |
SELECT_SYM select_init2 |
|
2111 |
| '(' select_paren ')' union_opt |
|
2112 |
;
|
|
2113 |
||
2114 |
select_paren: |
|
2115 |
SELECT_SYM select_part2 |
|
2116 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2117 |
if (parser::setup_select_in_parentheses(YYSession, &Lex)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2118 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2119 |
}
|
2120 |
| '(' select_paren ')' |
|
2121 |
;
|
|
2122 |
||
2123 |
/* The equivalent of select_paren for nested queries. */ |
|
2124 |
select_paren_derived: |
|
2125 |
SELECT_SYM select_part2_derived |
|
2126 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2127 |
if (parser::setup_select_in_parentheses(YYSession, &Lex)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2128 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2129 |
}
|
2130 |
| '(' select_paren_derived ')' |
|
2131 |
;
|
|
2132 |
||
2133 |
select_init2: |
|
2134 |
select_part2
|
|
2135 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2136 |
Select_Lex * sel= Lex.current_select; |
2137 |
if (Lex.current_select->set_braces(0)) |
|
1
by brian
clean slate |
2138 |
{
|
2104.3.5
by Brian Aker
Fixed case where parser error message might be null. |
2139 |
parser::my_parse_error(YYSession->m_lip); |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2140 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2141 |
}
|
2142 |
if (sel->linkage == UNION_TYPE && |
|
2143 |
sel->master_unit()->first_select()->braces) |
|
2144 |
{
|
|
2104.3.5
by Brian Aker
Fixed case where parser error message might be null. |
2145 |
parser::my_parse_error(YYSession->m_lip); |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2146 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2147 |
}
|
2148 |
}
|
|
2149 |
union_clause
|
|
2150 |
;
|
|
2151 |
||
2152 |
select_part2: |
|
2153 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2154 |
Select_Lex *sel= Lex.current_select; |
1
by brian
clean slate |
2155 |
if (sel->linkage != UNION_TYPE) |
2227.4.10
by Olaf van der Spek
Session::lex() |
2156 |
init_select(&Lex); |
2157 |
Lex.current_select->parsing_place= SELECT_LIST; |
|
1
by brian
clean slate |
2158 |
}
|
2159 |
select_options select_item_list |
|
2160 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2161 |
Lex.current_select->parsing_place= NO_MATTER; |
1
by brian
clean slate |
2162 |
}
|
2163 |
select_into select_lock_type |
|
2164 |
;
|
|
2165 |
||
2166 |
select_into: |
|
2167 |
opt_order_clause opt_limit_clause {} |
|
2168 |
| into |
|
2169 |
| select_from |
|
2170 |
| into select_from |
|
2171 |
| select_from into |
|
2172 |
;
|
|
2173 |
||
2174 |
select_from: |
|
2175 |
FROM join_table_list where_clause group_clause having_clause |
|
2176 |
opt_order_clause opt_limit_clause |
|
2177 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2178 |
Lex.current_select->context.table_list= |
2179 |
Lex.current_select->context.first_name_resolution_table= |
|
2180 |
reinterpret_cast<TableList *>(Lex.current_select->table_list.first); |
|
1
by brian
clean slate |
2181 |
}
|
2182 |
;
|
|
2183 |
||
2184 |
select_options: |
|
2185 |
/* empty*/ |
|
2186 |
| select_option_list |
|
2068.6.2
by Brian Aker
Cleanup issue of OR in tests. |
2187 |
{ } |
1
by brian
clean slate |
2188 |
;
|
2189 |
||
2190 |
select_option_list: |
|
2191 |
select_option_list select_option |
|
2192 |
| select_option |
|
2193 |
;
|
|
2194 |
||
2068.6.2
by Brian Aker
Cleanup issue of OR in tests. |
2195 |
select_option_distinct_or_all: |
2196 |
DISTINCT
|
|
2197 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2198 |
Lex.current_select->options|= SELECT_DISTINCT; |
2068.6.2
by Brian Aker
Cleanup issue of OR in tests. |
2199 |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2200 |
if (Lex.current_select->options & SELECT_DISTINCT && Lex.current_select->options & SELECT_ALL) |
2068.6.2
by Brian Aker
Cleanup issue of OR in tests. |
2201 |
{
|
2202 |
my_error(ER_WRONG_USAGE, MYF(0), "ALL", "DISTINCT"); |
|
2203 |
DRIZZLE_YYABORT; |
|
2204 |
}
|
|
2205 |
}
|
|
2206 |
| ALL |
|
2207 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2208 |
Lex.current_select->options|= SELECT_ALL; |
2068.6.2
by Brian Aker
Cleanup issue of OR in tests. |
2209 |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2210 |
if (Lex.current_select->options & SELECT_DISTINCT && Lex.current_select->options & SELECT_ALL) |
2068.6.2
by Brian Aker
Cleanup issue of OR in tests. |
2211 |
{
|
2212 |
my_error(ER_WRONG_USAGE, MYF(0), "ALL", "DISTINCT"); |
|
2213 |
DRIZZLE_YYABORT; |
|
2214 |
}
|
|
2215 |
}
|
|
2216 |
;
|
|
2217 |
||
2218 |
select_option_small_or_big: |
|
2219 |
SQL_SMALL_RESULT
|
|
2220 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2221 |
Lex.current_select->options|= SELECT_SMALL_RESULT; |
2068.6.2
by Brian Aker
Cleanup issue of OR in tests. |
2222 |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2223 |
if (Lex.current_select->options & SELECT_SMALL_RESULT && Lex.current_select->options & SELECT_BIG_RESULT) |
2068.6.2
by Brian Aker
Cleanup issue of OR in tests. |
2224 |
{
|
2225 |
my_error(ER_WRONG_USAGE, MYF(0), "SELECT_SMALL_RESULT", "SELECT_SMALL_RESULT"); |
|
2226 |
DRIZZLE_YYABORT; |
|
2227 |
}
|
|
2228 |
}
|
|
2229 |
| SQL_BIG_RESULT |
|
2230 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2231 |
Lex.current_select->options|= SELECT_BIG_RESULT; |
2068.6.2
by Brian Aker
Cleanup issue of OR in tests. |
2232 |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2233 |
if (Lex.current_select->options & SELECT_SMALL_RESULT && Lex.current_select->options & SELECT_BIG_RESULT) |
2068.6.2
by Brian Aker
Cleanup issue of OR in tests. |
2234 |
{
|
2235 |
my_error(ER_WRONG_USAGE, MYF(0), "SELECT_SMALL_RESULT", "SELECT_SMALL_RESULT"); |
|
2236 |
DRIZZLE_YYABORT; |
|
2237 |
}
|
|
2238 |
}
|
|
2239 |
;
|
|
2240 |
||
2241 |
||
1
by brian
clean slate |
2242 |
select_option: |
2227.4.10
by Olaf van der Spek
Session::lex() |
2243 |
STRAIGHT_JOIN { Lex.current_select->options|= SELECT_STRAIGHT_JOIN; } |
1
by brian
clean slate |
2244 |
| SQL_BUFFER_RESULT |
2245 |
{
|
|
2041.3.15
by Brian Aker
Cleanup error usage around identifier usage. |
2246 |
if (check_simple_select(YYSession)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2247 |
DRIZZLE_YYABORT; |
2227.4.10
by Olaf van der Spek
Session::lex() |
2248 |
Lex.current_select->options|= OPTION_BUFFER_RESULT; |
1
by brian
clean slate |
2249 |
}
|
2068.6.2
by Brian Aker
Cleanup issue of OR in tests. |
2250 |
| select_option_small_or_big |
2251 |
{ } |
|
2252 |
| select_option_distinct_or_all |
|
2253 |
{ } |
|
1
by brian
clean slate |
2254 |
| SQL_CALC_FOUND_ROWS |
2255 |
{
|
|
2041.3.15
by Brian Aker
Cleanup error usage around identifier usage. |
2256 |
if (check_simple_select(YYSession)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2257 |
DRIZZLE_YYABORT; |
2227.4.10
by Olaf van der Spek
Session::lex() |
2258 |
Lex.current_select->options|= OPTION_FOUND_ROWS; |
1
by brian
clean slate |
2259 |
}
|
2260 |
;
|
|
2261 |
||
2262 |
select_lock_type: |
|
2263 |
/* empty */ |
|
2264 |
| FOR_SYM UPDATE_SYM |
|
2265 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2266 |
Lex.current_select->set_lock_for_tables(TL_WRITE); |
1
by brian
clean slate |
2267 |
}
|
2268 |
| LOCK_SYM IN_SYM SHARE_SYM MODE_SYM |
|
2269 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2270 |
Lex.current_select-> |
1
by brian
clean slate |
2271 |
set_lock_for_tables(TL_READ_WITH_SHARED_LOCKS); |
2272 |
}
|
|
2273 |
;
|
|
2274 |
||
2275 |
select_item_list: |
|
2276 |
select_item_list ',' select_item |
|
2277 |
| select_item |
|
2278 |
| '*' |
|
2279 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2280 |
if (YYSession->add_item_to_list( new Item_field(&YYSession->lex().current_select->context, NULL, NULL, "*"))) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2281 |
DRIZZLE_YYABORT; |
2187.2.2
by Brian Aker
getLex() usage and fix for table_name creation during admin commands. |
2282 |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2283 |
(YYSession->lex().current_select->with_wild)++; |
1
by brian
clean slate |
2284 |
}
|
2285 |
;
|
|
2286 |
||
2287 |
select_item: |
|
2288 |
remember_name table_wild remember_end |
|
2289 |
{
|
|
2029.1.15
by Brian Aker
Remove useless copy. |
2290 |
if (YYSession->add_item_to_list($2)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2291 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2292 |
}
|
2293 |
| remember_name expr remember_end select_alias |
|
2294 |
{
|
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
2295 |
assert($1 < $3); |
1
by brian
clean slate |
2296 |
|
2029.1.15
by Brian Aker
Remove useless copy. |
2297 |
if (YYSession->add_item_to_list($2)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2298 |
DRIZZLE_YYABORT; |
2029.1.15
by Brian Aker
Remove useless copy. |
2299 |
|
1
by brian
clean slate |
2300 |
if ($4.str) |
2301 |
{
|
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
2302 |
$2->is_autogenerated_name= false; |
1
by brian
clean slate |
2303 |
$2->set_name($4.str, $4.length, system_charset_info); |
2304 |
}
|
|
2305 |
else if (!$2->name) |
|
2306 |
{
|
|
2029.1.15
by Brian Aker
Remove useless copy. |
2307 |
$2->set_name($1, (uint) ($3 - $1), YYSession->charset()); |
1
by brian
clean slate |
2308 |
}
|
2309 |
}
|
|
2310 |
;
|
|
2311 |
||
2312 |
remember_name: |
|
2313 |
{
|
|
2029.1.15
by Brian Aker
Remove useless copy. |
2314 |
Lex_input_stream *lip= YYSession->m_lip; |
1
by brian
clean slate |
2315 |
$$= (char*) lip->get_cpp_tok_start(); |
2316 |
}
|
|
2317 |
;
|
|
2318 |
||
2319 |
remember_end: |
|
2320 |
{
|
|
2029.1.15
by Brian Aker
Remove useless copy. |
2321 |
Lex_input_stream *lip= YYSession->m_lip; |
1
by brian
clean slate |
2322 |
$$= (char*) lip->get_cpp_tok_end(); |
2323 |
}
|
|
2324 |
;
|
|
2325 |
||
2326 |
select_alias: |
|
2327 |
/* empty */ { $$=null_lex_str;} |
|
2328 |
| AS ident { $$=$2; } |
|
2329 |
| AS TEXT_STRING_sys { $$=$2; } |
|
2330 |
| ident { $$=$1; } |
|
2331 |
| TEXT_STRING_sys { $$=$1; } |
|
2332 |
;
|
|
2333 |
||
2334 |
optional_braces: |
|
2335 |
/* empty */ {} |
|
2336 |
| '(' ')' {} |
|
2337 |
;
|
|
2338 |
||
2339 |
/* all possible expressions */ |
|
2340 |
expr: |
|
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2341 |
expr OR_SYM expr %prec OR_SYM |
1
by brian
clean slate |
2342 |
{
|
2343 |
/*
|
|
2344 |
Design notes: |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2345 |
Do not use a manually maintained stack like session->Lex.xxx_list, |
1
by brian
clean slate |
2346 |
but use the internal bison stack ($$, $1 and $3) instead. |
2347 |
Using the bison stack is: |
|
2348 |
- more robust to changes in the grammar, |
|
2349 |
- guaranteed to be in sync with the parser state, |
|
2350 |
- better for performances (no memory allocation). |
|
2351 |
*/
|
|
2352 |
Item_cond_or *item1; |
|
2353 |
Item_cond_or *item3; |
|
2354 |
if (is_cond_or($1)) |
|
2355 |
{
|
|
2356 |
item1= (Item_cond_or*) $1; |
|
2357 |
if (is_cond_or($3)) |
|
2358 |
{
|
|
2359 |
item3= (Item_cond_or*) $3; |
|
2360 |
/*
|
|
2361 |
(X1 OR X2) OR (Y1 OR Y2) ==> OR (X1, X2, Y1, Y2) |
|
2362 |
*/
|
|
2363 |
item3->add_at_head(item1->argument_list()); |
|
2364 |
$$ = $3; |
|
2365 |
}
|
|
2366 |
else
|
|
2367 |
{
|
|
2368 |
/*
|
|
2369 |
(X1 OR X2) OR Y ==> OR (X1, X2, Y) |
|
2370 |
*/
|
|
2371 |
item1->add($3); |
|
2372 |
$$ = $1; |
|
2373 |
}
|
|
2374 |
}
|
|
2375 |
else if (is_cond_or($3)) |
|
2376 |
{
|
|
2377 |
item3= (Item_cond_or*) $3; |
|
2378 |
/*
|
|
2379 |
X OR (Y1 OR Y2) ==> OR (X, Y1, Y2) |
|
2380 |
*/
|
|
2381 |
item3->add_at_head($1); |
|
2382 |
$$ = $3; |
|
2383 |
}
|
|
2384 |
else
|
|
2385 |
{
|
|
2386 |
/* X OR Y */ |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2387 |
$$ = new (YYSession->mem_root) Item_cond_or($1, $3); |
1
by brian
clean slate |
2388 |
}
|
2389 |
}
|
|
2390 |
| expr XOR expr %prec XOR |
|
2391 |
{
|
|
2392 |
/* XOR is a proprietary extension */ |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2393 |
$$ = new (YYSession->mem_root) Item_cond_xor($1, $3); |
1
by brian
clean slate |
2394 |
}
|
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2395 |
| expr AND_SYM expr %prec AND_SYM |
1
by brian
clean slate |
2396 |
{
|
2397 |
/* See comments in rule expr: expr or expr */ |
|
2398 |
Item_cond_and *item1; |
|
2399 |
Item_cond_and *item3; |
|
2400 |
if (is_cond_and($1)) |
|
2401 |
{
|
|
2402 |
item1= (Item_cond_and*) $1; |
|
2403 |
if (is_cond_and($3)) |
|
2404 |
{
|
|
2405 |
item3= (Item_cond_and*) $3; |
|
2406 |
/*
|
|
2407 |
(X1 AND X2) AND (Y1 AND Y2) ==> AND (X1, X2, Y1, Y2) |
|
2408 |
*/
|
|
2409 |
item3->add_at_head(item1->argument_list()); |
|
2410 |
$$ = $3; |
|
2411 |
}
|
|
2412 |
else
|
|
2413 |
{
|
|
2414 |
/*
|
|
2415 |
(X1 AND X2) AND Y ==> AND (X1, X2, Y) |
|
2416 |
*/
|
|
2417 |
item1->add($3); |
|
2418 |
$$ = $1; |
|
2419 |
}
|
|
2420 |
}
|
|
2421 |
else if (is_cond_and($3)) |
|
2422 |
{
|
|
2423 |
item3= (Item_cond_and*) $3; |
|
2424 |
/*
|
|
2425 |
X AND (Y1 AND Y2) ==> AND (X, Y1, Y2) |
|
2426 |
*/
|
|
2427 |
item3->add_at_head($1); |
|
2428 |
$$ = $3; |
|
2429 |
}
|
|
2430 |
else
|
|
2431 |
{
|
|
2432 |
/* X AND Y */ |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2433 |
$$ = new (YYSession->mem_root) Item_cond_and($1, $3); |
1
by brian
clean slate |
2434 |
}
|
2435 |
}
|
|
2436 |
| NOT_SYM expr %prec NOT_SYM |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2437 |
{ $$= negate_expression(YYSession, $2); } |
1
by brian
clean slate |
2438 |
| bool_pri IS TRUE_SYM %prec IS |
2227.4.10
by Olaf van der Spek
Session::lex() |
2439 |
{
|
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2440 |
$$= new (YYSession->mem_root) Item_func_istrue($1); |
2441 |
}
|
|
2442 |
| bool_pri IS NOT_SYM TRUE_SYM %prec IS |
|
2443 |
{
|
|
2444 |
$$= new (YYSession->mem_root) Item_func_isnottrue($1); |
|
2445 |
}
|
|
1
by brian
clean slate |
2446 |
| bool_pri IS FALSE_SYM %prec IS |
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2447 |
{
|
2448 |
$$= new (YYSession->mem_root) Item_func_isfalse($1); |
|
2449 |
}
|
|
2450 |
| bool_pri IS NOT_SYM FALSE_SYM %prec IS |
|
2451 |
{
|
|
2452 |
$$= new (YYSession->mem_root) Item_func_isnotfalse($1); |
|
2453 |
}
|
|
1
by brian
clean slate |
2454 |
| bool_pri IS UNKNOWN_SYM %prec IS |
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2455 |
{
|
2456 |
$$= new Item_func_isnull($1); |
|
2457 |
}
|
|
2458 |
| bool_pri IS NOT_SYM UNKNOWN_SYM %prec IS |
|
2459 |
{
|
|
2460 |
$$= new Item_func_isnotnull($1); |
|
2461 |
}
|
|
1
by brian
clean slate |
2462 |
| bool_pri |
2463 |
;
|
|
2464 |
||
2465 |
bool_pri: |
|
2466 |
bool_pri IS NULL_SYM %prec IS |
|
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2467 |
{
|
2468 |
$$= new Item_func_isnull($1); |
|
2469 |
}
|
|
2470 |
| bool_pri IS NOT_SYM NULL_SYM %prec IS |
|
2471 |
{
|
|
2472 |
$$= new Item_func_isnotnull($1); |
|
2473 |
}
|
|
1
by brian
clean slate |
2474 |
| bool_pri EQUAL_SYM predicate %prec EQUAL_SYM |
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2475 |
{
|
2476 |
$$= new Item_func_equal($1,$3); |
|
2477 |
}
|
|
2172.3.16
by Brian Aker
Remove greedy use = for table alias allowance. |
2478 |
| bool_pri comp_op predicate %prec '=' |
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2479 |
{
|
2480 |
$$= (*$2)(0)->create($1,$3); |
|
2481 |
}
|
|
2172.3.16
by Brian Aker
Remove greedy use = for table alias allowance. |
2482 |
| bool_pri comp_op all_or_any '(' subselect ')' %prec '=' |
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2483 |
{
|
2484 |
$$= all_any_subquery_creator($1, $2, $3, $5); |
|
2485 |
}
|
|
1
by brian
clean slate |
2486 |
| predicate |
2487 |
;
|
|
2488 |
||
2489 |
predicate: |
|
2490 |
bit_expr IN_SYM '(' subselect ')' |
|
2491 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2492 |
$$= new (YYSession->mem_root) Item_in_subselect($1, $4); |
1
by brian
clean slate |
2493 |
}
|
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2494 |
| bit_expr NOT_SYM IN_SYM '(' subselect ')' |
1
by brian
clean slate |
2495 |
{
|
2029.1.15
by Brian Aker
Remove useless copy. |
2496 |
Item *item= new (YYSession->mem_root) Item_in_subselect($1, $5); |
2497 |
$$= negate_expression(YYSession, item); |
|
1
by brian
clean slate |
2498 |
}
|
2499 |
| bit_expr IN_SYM '(' expr ')' |
|
2500 |
{
|
|
2096.1.14
by Brian Aker
Pull in more C code from parser. |
2501 |
$$= parser::handle_sql2003_note184_exception(YYSession, $1, true, $4); |
1
by brian
clean slate |
2502 |
}
|
2503 |
| bit_expr IN_SYM '(' expr ',' expr_list ')' |
|
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
2504 |
{
|
1
by brian
clean slate |
2505 |
$6->push_front($4); |
2506 |
$6->push_front($1); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2507 |
$$= new (YYSession->mem_root) Item_func_in(*$6); |
1
by brian
clean slate |
2508 |
}
|
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2509 |
| bit_expr NOT_SYM IN_SYM '(' expr ')' |
1
by brian
clean slate |
2510 |
{
|
2096.1.14
by Brian Aker
Pull in more C code from parser. |
2511 |
$$= parser::handle_sql2003_note184_exception(YYSession, $1, false, $5); |
1
by brian
clean slate |
2512 |
}
|
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2513 |
| bit_expr NOT_SYM IN_SYM '(' expr ',' expr_list ')' |
1
by brian
clean slate |
2514 |
{
|
2515 |
$7->push_front($5); |
|
2516 |
$7->push_front($1); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2517 |
Item_func_in *item = new (YYSession->mem_root) Item_func_in(*$7); |
1
by brian
clean slate |
2518 |
item->negate(); |
2519 |
$$= item; |
|
2520 |
}
|
|
2521 |
| bit_expr BETWEEN_SYM bit_expr AND_SYM predicate |
|
1976.7.1
by Brian Aker
Added compatible REGEX for Drizzle to MySQL's syntax. |
2522 |
{
|
2523 |
$$= new Item_func_between($1,$3,$5); |
|
2524 |
}
|
|
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2525 |
| bit_expr NOT_SYM BETWEEN_SYM bit_expr AND_SYM predicate |
1
by brian
clean slate |
2526 |
{
|
2527 |
Item_func_between *item= new Item_func_between($1,$4,$6); |
|
2528 |
item->negate(); |
|
2529 |
$$= item; |
|
2530 |
}
|
|
2531 |
| bit_expr LIKE simple_expr opt_escape |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2532 |
{
|
2533 |
$$= new Item_func_like($1,$3,$4,Lex.escape_used); |
|
1976.7.1
by Brian Aker
Added compatible REGEX for Drizzle to MySQL's syntax. |
2534 |
}
|
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2535 |
| bit_expr NOT_SYM LIKE simple_expr opt_escape |
2227.4.10
by Olaf van der Spek
Session::lex() |
2536 |
{
|
2537 |
$$= new Item_func_not(new Item_func_like($1,$4,$5, Lex.escape_used)); |
|
1976.7.1
by Brian Aker
Added compatible REGEX for Drizzle to MySQL's syntax. |
2538 |
}
|
2539 |
| bit_expr REGEXP_SYM bit_expr |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2540 |
{
|
1976.7.1
by Brian Aker
Added compatible REGEX for Drizzle to MySQL's syntax. |
2541 |
List<Item> *args= new (YYSession->mem_root) List<Item>; |
2542 |
args->push_back($1); |
|
2543 |
args->push_back($3); |
|
2096.1.14
by Brian Aker
Pull in more C code from parser. |
2544 |
if (! ($$= parser::reserved_keyword_function(YYSession, "regex", args))) |
1976.7.1
by Brian Aker
Added compatible REGEX for Drizzle to MySQL's syntax. |
2545 |
{
|
2546 |
DRIZZLE_YYABORT; |
|
2547 |
}
|
|
2548 |
}
|
|
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2549 |
| bit_expr NOT_SYM REGEXP_SYM bit_expr |
2227.4.10
by Olaf van der Spek
Session::lex() |
2550 |
{
|
1976.7.1
by Brian Aker
Added compatible REGEX for Drizzle to MySQL's syntax. |
2551 |
List<Item> *args= new (YYSession->mem_root) List<Item>; |
2552 |
args->push_back($1); |
|
2553 |
args->push_back($4); |
|
2554 |
args->push_back(new (YYSession->mem_root) Item_int(1)); |
|
2096.1.14
by Brian Aker
Pull in more C code from parser. |
2555 |
if (! ($$= parser::reserved_keyword_function(YYSession, "regex", args))) |
1976.7.1
by Brian Aker
Added compatible REGEX for Drizzle to MySQL's syntax. |
2556 |
{
|
2557 |
DRIZZLE_YYABORT; |
|
2558 |
}
|
|
2559 |
}
|
|
1
by brian
clean slate |
2560 |
| bit_expr |
2561 |
;
|
|
2562 |
||
2563 |
bit_expr: |
|
2194.4.2
by Brian Aker
Bit functions/fix for << |
2564 |
bit_expr '|' bit_expr %prec '|' |
2565 |
{
|
|
2566 |
$$= new function::bit::Or($1, $3); |
|
2567 |
}
|
|
2568 |
| bit_expr '&' bit_expr %prec '&' |
|
2569 |
{
|
|
2570 |
$$= new function::bit::And($1, $3); |
|
2571 |
}
|
|
2572 |
| bit_expr SHIFT_RIGHT bit_expr %prec SHIFT_RIGHT |
|
2573 |
{
|
|
2574 |
$$= new function::bit::ShiftRight($1, $3); |
|
2575 |
}
|
|
2576 |
| bit_expr SHIFT_LEFT bit_expr %prec SHIFT_LEFT |
|
2577 |
{
|
|
2578 |
$$= new function::bit::ShiftLeft($1, $3); |
|
2579 |
}
|
|
2580 |
| bit_expr '+' bit_expr %prec '+' |
|
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2581 |
{
|
2582 |
$$= new Item_func_plus($1,$3); |
|
2583 |
}
|
|
1
by brian
clean slate |
2584 |
| bit_expr '-' bit_expr %prec '-' |
2227.4.10
by Olaf van der Spek
Session::lex() |
2585 |
{
|
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2586 |
$$= new Item_func_minus($1,$3); |
2587 |
}
|
|
1
by brian
clean slate |
2588 |
| bit_expr '+' INTERVAL_SYM expr interval %prec '+' |
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2589 |
{
|
2590 |
$$= new Item_date_add_interval($1,$4,$5,0); |
|
2591 |
}
|
|
1
by brian
clean slate |
2592 |
| bit_expr '-' INTERVAL_SYM expr interval %prec '-' |
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2593 |
{
|
2594 |
$$= new Item_date_add_interval($1,$4,$5,1); |
|
2595 |
}
|
|
1
by brian
clean slate |
2596 |
| bit_expr '*' bit_expr %prec '*' |
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2597 |
{
|
2598 |
$$= new Item_func_mul($1,$3); |
|
2599 |
}
|
|
1
by brian
clean slate |
2600 |
| bit_expr '/' bit_expr %prec '/' |
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2601 |
{
|
2602 |
$$= new Item_func_div(YYSession,$1,$3); |
|
2603 |
}
|
|
1
by brian
clean slate |
2604 |
| bit_expr '%' bit_expr %prec '%' |
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2605 |
{
|
2606 |
$$= new Item_func_mod($1,$3); |
|
2607 |
}
|
|
1
by brian
clean slate |
2608 |
| bit_expr DIV_SYM bit_expr %prec DIV_SYM |
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2609 |
{
|
2610 |
$$= new Item_func_int_div($1,$3); |
|
2611 |
}
|
|
1
by brian
clean slate |
2612 |
| bit_expr MOD_SYM bit_expr %prec MOD_SYM |
2198.6.3
by Brian Aker
Cleanup idention and remove and/not for straight usage. |
2613 |
{
|
2614 |
$$= new Item_func_mod($1,$3); |
|
2615 |
}
|
|
2194.4.2
by Brian Aker
Bit functions/fix for << |
2616 |
| bit_expr '^' bit_expr |
2617 |
{
|
|
2618 |
$$= new (YYSession->mem_root) function::bit::Xor($1, $3); |
|
2619 |
}
|
|
1
by brian
clean slate |
2620 |
| simple_expr |
2621 |
;
|
|
2622 |
||
2623 |
comp_op: |
|
2172.3.16
by Brian Aker
Remove greedy use = for table alias allowance. |
2624 |
'=' { $$ = &comp_eq_creator; } |
1
by brian
clean slate |
2625 |
| GE { $$ = &comp_ge_creator; } |
2194.4.2
by Brian Aker
Bit functions/fix for << |
2626 |
| GREATER_THAN { $$ = &comp_gt_creator; } |
1
by brian
clean slate |
2627 |
| LE { $$ = &comp_le_creator; } |
2194.4.2
by Brian Aker
Bit functions/fix for << |
2628 |
| LESS_THAN { $$ = &comp_lt_creator; } |
1
by brian
clean slate |
2629 |
| NE { $$ = &comp_ne_creator; } |
2630 |
;
|
|
2631 |
||
2632 |
all_or_any: |
|
2633 |
ALL { $$ = 1; } |
|
2634 |
| ANY_SYM { $$ = 0; } |
|
2635 |
;
|
|
2636 |
||
2637 |
simple_expr: |
|
2638 |
simple_ident
|
|
2639 |
| function_call_keyword |
|
2640 |
| function_call_nonkeyword |
|
2641 |
| function_call_generic |
|
2642 |
| function_call_conflict |
|
2172.3.15
by Brian Aker
Cleanup additional precedence rules. |
2643 |
| simple_expr COLLATE_SYM ident_or_text %prec UMINUS |
1
by brian
clean slate |
2644 |
{
|
2029.1.15
by Brian Aker
Remove useless copy. |
2645 |
Item *i1= new (YYSession->mem_root) Item_string($3.str, |
1
by brian
clean slate |
2646 |
$3.length, |
2029.1.15
by Brian Aker
Remove useless copy. |
2647 |
YYSession->charset()); |
2648 |
$$= new (YYSession->mem_root) Item_func_set_collation($1, i1); |
|
1
by brian
clean slate |
2649 |
}
|
2650 |
| literal |
|
2651 |
| variable |
|
2652 |
| sum_expr |
|
1751.3.1
by Brian Aker
This add a couple of utility table functions to be used with testing. |
2653 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2654 |
Lex.setSumExprUsed(); |
1751.3.1
by Brian Aker
This add a couple of utility table functions to be used with testing. |
2655 |
}
|
2198.6.1
by Brian Aker
Add in an ANSI || operator. |
2656 |
| simple_expr CONCAT simple_expr |
2657 |
{
|
|
2658 |
$$= new (YYSession->mem_root) Item_func_concat(*YYSession, $1, $3); |
|
2659 |
}
|
|
2172.3.15
by Brian Aker
Cleanup additional precedence rules. |
2660 |
| '+' simple_expr %prec UMINUS { $$= $2; } |
2661 |
| '-' simple_expr %prec UMINUS |
|
2194.4.2
by Brian Aker
Bit functions/fix for << |
2662 |
{
|
2663 |
$$= new (YYSession->mem_root) Item_func_neg($2); |
|
2664 |
}
|
|
2665 |
| '~' simple_expr %prec UMINUS |
|
2666 |
{
|
|
2667 |
$$= new (YYSession->mem_root) function::bit::Neg($2); |
|
2668 |
}
|
|
1
by brian
clean slate |
2669 |
| '(' subselect ')' |
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
2670 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2671 |
$$= new (YYSession->mem_root) Item_singlerow_subselect($2); |
1
by brian
clean slate |
2672 |
}
|
2673 |
| '(' expr ')' { $$= $2; } |
|
2674 |
| '(' expr ',' expr_list ')' |
|
2675 |
{
|
|
2676 |
$4->push_front($2); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2677 |
$$= new (YYSession->mem_root) Item_row(*$4); |
1
by brian
clean slate |
2678 |
}
|
2679 |
| ROW_SYM '(' expr ',' expr_list ')' |
|
2680 |
{
|
|
2681 |
$5->push_front($3); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2682 |
$$= new (YYSession->mem_root) Item_row(*$5); |
1
by brian
clean slate |
2683 |
}
|
2684 |
| EXISTS '(' subselect ')' |
|
2685 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2686 |
$$= new (YYSession->mem_root) Item_exists_subselect($3); |
1
by brian
clean slate |
2687 |
}
|
2688 |
| '{' ident expr '}' { $$= $3; } |
|
2172.3.15
by Brian Aker
Cleanup additional precedence rules. |
2689 |
| BINARY simple_expr %prec UMINUS |
1
by brian
clean slate |
2690 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2691 |
$$= create_func_cast(YYSession, $2, ITEM_CAST_CHAR, NULL, NULL, |
1
by brian
clean slate |
2692 |
&my_charset_bin); |
2693 |
}
|
|
2694 |
| CAST_SYM '(' expr AS cast_type ')' |
|
2695 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2696 |
$$= create_func_cast(YYSession, $3, $5, Lex.length, Lex.dec, |
2697 |
Lex.charset); |
|
1
by brian
clean slate |
2698 |
if (!$$) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2699 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2700 |
}
|
2701 |
| CASE_SYM opt_expr when_list opt_else END |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2702 |
{ $$= new (YYSession->mem_root) Item_func_case(* $3, $2, $4 ); } |
1
by brian
clean slate |
2703 |
| CONVERT_SYM '(' expr ',' cast_type ')' |
2704 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2705 |
$$= create_func_cast(YYSession, $3, $5, Lex.length, Lex.dec, |
2706 |
Lex.charset); |
|
1
by brian
clean slate |
2707 |
if (!$$) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
2708 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
2709 |
}
|
2710 |
| DEFAULT '(' simple_ident ')' |
|
2711 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2712 |
$$= new (YYSession->mem_root) Item_default_value(Lex.current_context(), |
1
by brian
clean slate |
2713 |
$3); |
2714 |
}
|
|
2114.4.8
by Brian Aker
Merge in additional parser encapsulation. |
2715 |
| VALUES '(' simple_ident ')' |
1
by brian
clean slate |
2716 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2717 |
$$= new (YYSession->mem_root) Item_insert_value(Lex.current_context(), |
1
by brian
clean slate |
2718 |
$3); |
2719 |
}
|
|
2720 |
| INTERVAL_SYM expr interval '+' expr %prec INTERVAL_SYM |
|
2721 |
/* we cannot put interval before - */ |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2722 |
{ $$= new (YYSession->mem_root) Item_date_add_interval($5,$2,$3,0); } |
1
by brian
clean slate |
2723 |
;
|
2724 |
||
2725 |
/*
|
|
2726 |
Function call syntax using official SQL 2003 keywords. |
|
2727 |
Because the function name is an official token, |
|
2728 |
a dedicated grammar rule is needed in the parser. |
|
2729 |
There is no potential for conflicts |
|
2730 |
*/
|
|
2731 |
function_call_keyword: |
|
2732 |
CHAR_SYM '(' expr_list ')' |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2733 |
{ $$= new (YYSession->mem_root) Item_func_char(*$3); } |
1
by brian
clean slate |
2734 |
| CURRENT_USER optional_braces |
2735 |
{
|
|
2172.3.5
by Brian Aker
Cleanup a few locations where we should have just been using constant |
2736 |
if (! ($$= parser::reserved_keyword_function(YYSession, "user", NULL))) |
1351.2.1
by Stewart Smith
move USER() function into a plugin (loaded by default). Also, remove the special case (and completely untested) CURRENT_USER() function and just have it also point to USER(). If somebody wants CURRENT_USER() style behaviour they can add it back in with a test. |
2737 |
{
|
2738 |
DRIZZLE_YYABORT; |
|
2739 |
}
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2740 |
Lex.setCacheable(false); |
1
by brian
clean slate |
2741 |
}
|
2742 |
| DATE_SYM '(' expr ')' |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2743 |
{ $$= new (YYSession->mem_root) Item_date_typecast($3); } |
1
by brian
clean slate |
2744 |
| DAY_SYM '(' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2745 |
{ $$= new (YYSession->mem_root) Item_func_dayofmonth($3); } |
1
by brian
clean slate |
2746 |
| HOUR_SYM '(' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2747 |
{ $$= new (YYSession->mem_root) Item_func_hour($3); } |
1
by brian
clean slate |
2748 |
| INSERT '(' expr ',' expr ',' expr ',' expr ')' |
1633.4.5
by Brian Aker
More current_session. |
2749 |
{ $$= new (YYSession->mem_root) Item_func_insert(*YYSession, $3, $5, $7, $9); } |
1
by brian
clean slate |
2750 |
| INTERVAL_SYM '(' expr ',' expr ')' %prec INTERVAL_SYM |
2751 |
{
|
|
2029.1.15
by Brian Aker
Remove useless copy. |
2752 |
List<Item> *list= new (YYSession->mem_root) List<Item>; |
1
by brian
clean slate |
2753 |
list->push_front($5); |
2754 |
list->push_front($3); |
|
2029.1.15
by Brian Aker
Remove useless copy. |
2755 |
Item_row *item= new (YYSession->mem_root) Item_row(*list); |
2756 |
$$= new (YYSession->mem_root) Item_func_interval(item); |
|
1
by brian
clean slate |
2757 |
}
|
2758 |
| INTERVAL_SYM '(' expr ',' expr ',' expr_list ')' %prec INTERVAL_SYM |
|
2759 |
{
|
|
2760 |
$7->push_front($5); |
|
2761 |
$7->push_front($3); |
|
2029.1.15
by Brian Aker
Remove useless copy. |
2762 |
Item_row *item= new (YYSession->mem_root) Item_row(*$7); |
2763 |
$$= new (YYSession->mem_root) Item_func_interval(item); |
|
1
by brian
clean slate |
2764 |
}
|
2765 |
| LEFT '(' expr ',' expr ')' |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2766 |
{ $$= new (YYSession->mem_root) Item_func_left($3,$5); } |
1
by brian
clean slate |
2767 |
| MINUTE_SYM '(' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2768 |
{ $$= new (YYSession->mem_root) Item_func_minute($3); } |
1
by brian
clean slate |
2769 |
| MONTH_SYM '(' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2770 |
{ $$= new (YYSession->mem_root) Item_func_month($3); } |
1
by brian
clean slate |
2771 |
| RIGHT '(' expr ',' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2772 |
{ $$= new (YYSession->mem_root) Item_func_right($3,$5); } |
1
by brian
clean slate |
2773 |
| SECOND_SYM '(' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2774 |
{ $$= new (YYSession->mem_root) Item_func_second($3); } |
1008.3.17
by Stewart Smith
Start work to construct table proto in parser: |
2775 |
| TIMESTAMP_SYM '(' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2776 |
{ $$= new (YYSession->mem_root) Item_datetime_typecast($3); } |
1
by brian
clean slate |
2777 |
| TRIM '(' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2778 |
{ $$= new (YYSession->mem_root) Item_func_trim($3); } |
1
by brian
clean slate |
2779 |
| TRIM '(' LEADING expr FROM expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2780 |
{ $$= new (YYSession->mem_root) Item_func_ltrim($6,$4); } |
1
by brian
clean slate |
2781 |
| TRIM '(' TRAILING expr FROM expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2782 |
{ $$= new (YYSession->mem_root) Item_func_rtrim($6,$4); } |
1
by brian
clean slate |
2783 |
| TRIM '(' BOTH expr FROM expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2784 |
{ $$= new (YYSession->mem_root) Item_func_trim($6,$4); } |
1
by brian
clean slate |
2785 |
| TRIM '(' LEADING FROM expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2786 |
{ $$= new (YYSession->mem_root) Item_func_ltrim($5); } |
1
by brian
clean slate |
2787 |
| TRIM '(' TRAILING FROM expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2788 |
{ $$= new (YYSession->mem_root) Item_func_rtrim($5); } |
1
by brian
clean slate |
2789 |
| TRIM '(' BOTH FROM expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2790 |
{ $$= new (YYSession->mem_root) Item_func_trim($5); } |
1
by brian
clean slate |
2791 |
| TRIM '(' expr FROM expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2792 |
{ $$= new (YYSession->mem_root) Item_func_trim($5,$3); } |
1
by brian
clean slate |
2793 |
| USER '(' ')' |
2794 |
{
|
|
2096.1.14
by Brian Aker
Pull in more C code from parser. |
2795 |
if (! ($$= parser::reserved_keyword_function(YYSession, "user", NULL))) |
1351.2.1
by Stewart Smith
move USER() function into a plugin (loaded by default). Also, remove the special case (and completely untested) CURRENT_USER() function and just have it also point to USER(). If somebody wants CURRENT_USER() style behaviour they can add it back in with a test. |
2796 |
{
|
2797 |
DRIZZLE_YYABORT; |
|
2798 |
}
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2799 |
Lex.setCacheable(false); |
1
by brian
clean slate |
2800 |
}
|
2801 |
| YEAR_SYM '(' expr ')' |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2802 |
{ $$= new (YYSession->mem_root) Item_func_year($3); } |
1
by brian
clean slate |
2803 |
;
|
2804 |
||
2805 |
/*
|
|
2806 |
Function calls using non reserved keywords, with special syntaxic forms. |
|
2807 |
Dedicated grammar rules are needed because of the syntax, |
|
2808 |
but also have the potential to cause incompatibilities with other |
|
2809 |
parts of the language. |
|
2810 |
MAINTAINER: |
|
2811 |
The only reasons a function should be added here are: |
|
2812 |
- for compatibility reasons with another SQL syntax (CURDATE), |
|
2813 |
Any other 'Syntaxic sugar' enhancements should be *STRONGLY* |
|
2814 |
discouraged. |
|
2815 |
*/
|
|
2816 |
function_call_nonkeyword: |
|
2817 |
ADDDATE_SYM '(' expr ',' expr ')' |
|
2818 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2819 |
$$= new (YYSession->mem_root) Item_date_add_interval($3, $5, |
1
by brian
clean slate |
2820 |
INTERVAL_DAY, 0); |
2821 |
}
|
|
2822 |
| ADDDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')' |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2823 |
{ $$= new (YYSession->mem_root) Item_date_add_interval($3, $6, $7, 0); } |
1
by brian
clean slate |
2824 |
| CURDATE optional_braces |
2825 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2826 |
$$= new (YYSession->mem_root) Item_func_curdate_local(); |
2227.4.10
by Olaf van der Spek
Session::lex() |
2827 |
Lex.setCacheable(false); |
1
by brian
clean slate |
2828 |
}
|
2829 |
| DATE_ADD_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')' %prec INTERVAL_SYM |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2830 |
{ $$= new (YYSession->mem_root) Item_date_add_interval($3,$6,$7,0); } |
1
by brian
clean slate |
2831 |
| DATE_SUB_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')' %prec INTERVAL_SYM |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2832 |
{ $$= new (YYSession->mem_root) Item_date_add_interval($3,$6,$7,1); } |
1
by brian
clean slate |
2833 |
| EXTRACT_SYM '(' interval FROM expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2834 |
{ $$=new (YYSession->mem_root) Item_extract( $3, $5); } |
1
by brian
clean slate |
2835 |
| NOW_SYM optional_braces |
2836 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2837 |
$$= new (YYSession->mem_root) Item_func_now_local(); |
2227.4.10
by Olaf van der Spek
Session::lex() |
2838 |
Lex.setCacheable(false); |
1
by brian
clean slate |
2839 |
}
|
2840 |
| NOW_SYM '(' expr ')' |
|
2841 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2842 |
$$= new (YYSession->mem_root) Item_func_now_local($3); |
2227.4.10
by Olaf van der Spek
Session::lex() |
2843 |
Lex.setCacheable(false); |
1
by brian
clean slate |
2844 |
}
|
2845 |
| POSITION_SYM '(' bit_expr IN_SYM expr ')' |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2846 |
{ $$ = new (YYSession->mem_root) Item_func_locate($5,$3); } |
1
by brian
clean slate |
2847 |
| SUBDATE_SYM '(' expr ',' expr ')' |
2848 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2849 |
$$= new (YYSession->mem_root) Item_date_add_interval($3, $5, |
1
by brian
clean slate |
2850 |
INTERVAL_DAY, 1); |
2851 |
}
|
|
2852 |
| SUBDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')' |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2853 |
{ $$= new (YYSession->mem_root) Item_date_add_interval($3, $6, $7, 1); } |
1
by brian
clean slate |
2854 |
| SUBSTRING '(' expr ',' expr ',' expr ')' |
1300.4.4
by Stewart Smith
move SUBSTR, SUBSTRING and SUBSTR_INDEX to plugins. add parser hooks for substr being a plugin now. |
2855 |
{
|
2856 |
List<Item> *args= new (YYSession->mem_root) List<Item>; |
|
2857 |
args->push_back($3); |
|
2858 |
args->push_back($5); |
|
2859 |
args->push_back($7); |
|
2172.3.5
by Brian Aker
Cleanup a few locations where we should have just been using constant |
2860 |
if (! ($$= parser::reserved_keyword_function(YYSession, "substr", args))) |
1300.4.4
by Stewart Smith
move SUBSTR, SUBSTRING and SUBSTR_INDEX to plugins. add parser hooks for substr being a plugin now. |
2861 |
{
|
2862 |
DRIZZLE_YYABORT; |
|
2863 |
}
|
|
2864 |
}
|
|
1
by brian
clean slate |
2865 |
| SUBSTRING '(' expr ',' expr ')' |
1300.4.4
by Stewart Smith
move SUBSTR, SUBSTRING and SUBSTR_INDEX to plugins. add parser hooks for substr being a plugin now. |
2866 |
{
|
2867 |
List<Item> *args= new (YYSession->mem_root) List<Item>; |
|
2868 |
args->push_back($3); |
|
2869 |
args->push_back($5); |
|
2172.3.5
by Brian Aker
Cleanup a few locations where we should have just been using constant |
2870 |
if (! ($$= parser::reserved_keyword_function(YYSession, "substr", args))) |
1300.4.4
by Stewart Smith
move SUBSTR, SUBSTRING and SUBSTR_INDEX to plugins. add parser hooks for substr being a plugin now. |
2871 |
{
|
2872 |
DRIZZLE_YYABORT; |
|
2873 |
}
|
|
2874 |
}
|
|
1
by brian
clean slate |
2875 |
| SUBSTRING '(' expr FROM expr FOR_SYM expr ')' |
1300.4.4
by Stewart Smith
move SUBSTR, SUBSTRING and SUBSTR_INDEX to plugins. add parser hooks for substr being a plugin now. |
2876 |
{
|
2877 |
List<Item> *args= new (YYSession->mem_root) List<Item>; |
|
2878 |
args->push_back($3); |
|
2879 |
args->push_back($5); |
|
2880 |
args->push_back($7); |
|
2172.3.5
by Brian Aker
Cleanup a few locations where we should have just been using constant |
2881 |
if (! ($$= parser::reserved_keyword_function(YYSession, "substr", args))) |
1300.4.4
by Stewart Smith
move SUBSTR, SUBSTRING and SUBSTR_INDEX to plugins. add parser hooks for substr being a plugin now. |
2882 |
{
|
2883 |
DRIZZLE_YYABORT; |
|
2884 |
}
|
|
2885 |
}
|
|
1
by brian
clean slate |
2886 |
| SUBSTRING '(' expr FROM expr ')' |
1300.4.4
by Stewart Smith
move SUBSTR, SUBSTRING and SUBSTR_INDEX to plugins. add parser hooks for substr being a plugin now. |
2887 |
{
|
2888 |
List<Item> *args= new (YYSession->mem_root) List<Item>; |
|
2889 |
args->push_back($3); |
|
2890 |
args->push_back($5); |
|
2172.3.5
by Brian Aker
Cleanup a few locations where we should have just been using constant |
2891 |
if (! ($$= parser::reserved_keyword_function(YYSession, "substr", args))) |
1300.4.4
by Stewart Smith
move SUBSTR, SUBSTRING and SUBSTR_INDEX to plugins. add parser hooks for substr being a plugin now. |
2892 |
{
|
2893 |
DRIZZLE_YYABORT; |
|
2894 |
}
|
|
2895 |
}
|
|
1
by brian
clean slate |
2896 |
| SYSDATE optional_braces |
2227.4.10
by Olaf van der Spek
Session::lex() |
2897 |
{
|
2898 |
$$= new (YYSession->mem_root) Item_func_sysdate_local(); |
|
2899 |
Lex.setCacheable(false); |
|
1643.6.13
by Djellel E. Difallah
adding tests |
2900 |
}
|
1
by brian
clean slate |
2901 |
| SYSDATE '(' expr ')' |
2227.4.10
by Olaf van der Spek
Session::lex() |
2902 |
{
|
2903 |
$$= new (YYSession->mem_root) Item_func_sysdate_local($3); |
|
2904 |
Lex.setCacheable(false); |
|
1643.6.13
by Djellel E. Difallah
adding tests |
2905 |
}
|
1
by brian
clean slate |
2906 |
| TIMESTAMP_ADD '(' interval_time_stamp ',' expr ',' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2907 |
{ $$= new (YYSession->mem_root) Item_date_add_interval($7,$5,$3,0); } |
1
by brian
clean slate |
2908 |
| TIMESTAMP_DIFF '(' interval_time_stamp ',' expr ',' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2909 |
{ $$= new (YYSession->mem_root) Item_func_timestamp_diff($5,$7,$3); } |
1
by brian
clean slate |
2910 |
| UTC_DATE_SYM optional_braces |
2911 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2912 |
$$= new (YYSession->mem_root) Item_func_curdate_utc(); |
2227.4.10
by Olaf van der Spek
Session::lex() |
2913 |
Lex.setCacheable(false); |
1
by brian
clean slate |
2914 |
}
|
2915 |
| UTC_TIMESTAMP_SYM optional_braces |
|
2916 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2917 |
$$= new (YYSession->mem_root) Item_func_now_utc(); |
2227.4.10
by Olaf van der Spek
Session::lex() |
2918 |
Lex.setCacheable(false); |
1
by brian
clean slate |
2919 |
}
|
2920 |
;
|
|
2921 |
||
2922 |
/*
|
|
2923 |
Functions calls using a non reserved keyword, and using a regular syntax. |
|
2924 |
Because the non reserved keyword is used in another part of the grammar, |
|
2925 |
a dedicated rule is needed here. |
|
2926 |
*/
|
|
2927 |
function_call_conflict: |
|
1030.2.5
by devananda
refactored functin/ascii into plugin/ascii |
2928 |
COALESCE '(' expr_list ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2929 |
{ $$= new (YYSession->mem_root) Item_func_coalesce(* $3); } |
1
by brian
clean slate |
2930 |
| COLLATION_SYM '(' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2931 |
{ $$= new (YYSession->mem_root) Item_func_collation($3); } |
1
by brian
clean slate |
2932 |
| DATABASE '(' ')' |
2933 |
{
|
|
2096.1.14
by Brian Aker
Pull in more C code from parser. |
2934 |
if (! ($$= parser::reserved_keyword_function(YYSession, "database", NULL))) |
2073.1.3
by Brian Aker
Fix for test on drop (error message change). |
2935 |
{
|
2936 |
DRIZZLE_YYABORT; |
|
2937 |
}
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2938 |
Lex.setCacheable(false); |
2073.1.3
by Brian Aker
Fix for test on drop (error message change). |
2939 |
}
|
2940 |
| CATALOG_SYM '(' ')' |
|
2941 |
{
|
|
2096.1.14
by Brian Aker
Pull in more C code from parser. |
2942 |
if (! ($$= parser::reserved_keyword_function(YYSession, "catalog", NULL))) |
1300.4.1
by Stewart Smith
move DATABASE() to function plugin. modify parser so that it looks for a function named 'database' when DATABASE() is called. Special case still needed in parser due to hilarity of not-really-reserved words. |
2943 |
{
|
2944 |
DRIZZLE_YYABORT; |
|
2945 |
}
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
2946 |
Lex.setCacheable(false); |
1300.4.2
by Stewart Smith
make REVERSE() a plugin instead of built in function. Generalise the code for such keyword functions otu into reserved_keyword_function() in sql_yacc. |
2947 |
}
|
1976.7.4
by Brian Aker
Added WAIT to the execute() function. |
2948 |
| EXECUTE_SYM '(' expr ')' opt_wait |
1976.7.2
by Brian Aker
Adding execute command to go along with main command. |
2949 |
{
|
2950 |
List<Item> *args= new (YYSession->mem_root) List<Item>; |
|
2951 |
args->push_back($3); |
|
2952 |
||
1976.7.4
by Brian Aker
Added WAIT to the execute() function. |
2953 |
if ($5) |
2954 |
{
|
|
2955 |
args->push_back(new (YYSession->mem_root) Item_int(1)); |
|
2956 |
}
|
|
2957 |
||
2096.1.14
by Brian Aker
Pull in more C code from parser. |
2958 |
if (! ($$= parser::reserved_keyword_function(YYSession, "execute", args))) |
1976.7.2
by Brian Aker
Adding execute command to go along with main command. |
2959 |
{
|
2960 |
DRIZZLE_YYABORT; |
|
2961 |
}
|
|
2962 |
}
|
|
1
by brian
clean slate |
2963 |
| IF '(' expr ',' expr ',' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2964 |
{ $$= new (YYSession->mem_root) Item_func_if($3,$5,$7); } |
1963.2.1
by Brian Aker
Fixing up the kill function. |
2965 |
| KILL_SYM kill_option '(' expr ')' |
2966 |
{
|
|
2967 |
List<Item> *args= new (YYSession->mem_root) List<Item>; |
|
2968 |
args->push_back($4); |
|
2969 |
||
2970 |
if ($2) |
|
2971 |
{
|
|
2972 |
args->push_back(new (YYSession->mem_root) Item_uint(1)); |
|
2973 |
}
|
|
2974 |
||
2172.3.5
by Brian Aker
Cleanup a few locations where we should have just been using constant |
2975 |
if (! ($$= parser::reserved_keyword_function(YYSession, "kill", args))) |
1963.2.1
by Brian Aker
Fixing up the kill function. |
2976 |
{
|
2977 |
DRIZZLE_YYABORT; |
|
2978 |
}
|
|
2979 |
}
|
|
1
by brian
clean slate |
2980 |
| MICROSECOND_SYM '(' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2981 |
{ $$= new (YYSession->mem_root) Item_func_microsecond($3); } |
1
by brian
clean slate |
2982 |
| MOD_SYM '(' expr ',' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2983 |
{ $$ = new (YYSession->mem_root) Item_func_mod( $3, $5); } |
1
by brian
clean slate |
2984 |
| QUARTER_SYM '(' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2985 |
{ $$ = new (YYSession->mem_root) Item_func_quarter($3); } |
1
by brian
clean slate |
2986 |
| REPEAT_SYM '(' expr ',' expr ')' |
1633.4.5
by Brian Aker
More current_session. |
2987 |
{ $$= new (YYSession->mem_root) Item_func_repeat(*YYSession, $3, $5); } |
1
by brian
clean slate |
2988 |
| REPLACE '(' expr ',' expr ',' expr ')' |
1633.4.4
by Brian Aker
Remove more of current_session |
2989 |
{ $$= new (YYSession->mem_root) Item_func_replace(*YYSession, $3, $5, $7); } |
1
by brian
clean slate |
2990 |
| TRUNCATE_SYM '(' expr ',' expr ')' |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2991 |
{ $$= new (YYSession->mem_root) Item_func_round($3,$5,1); } |
1958.1.1
by Brian Aker
Fix clash in parser with wait(). |
2992 |
| WAIT_SYM '(' expr ')' |
2993 |
{
|
|
2994 |
List<Item> *args= new (YYSession->mem_root) List<Item>; |
|
2995 |
args->push_back($3); |
|
2172.3.5
by Brian Aker
Cleanup a few locations where we should have just been using constant |
2996 |
if (! ($$= parser::reserved_keyword_function(YYSession, "wait", args))) |
1958.1.1
by Brian Aker
Fix clash in parser with wait(). |
2997 |
{
|
2998 |
DRIZZLE_YYABORT; |
|
2999 |
}
|
|
3000 |
}
|
|
1996.2.1
by Brian Aker
uuid type code. |
3001 |
| UUID_SYM '(' ')' |
3002 |
{
|
|
2096.1.14
by Brian Aker
Pull in more C code from parser. |
3003 |
if (! ($$= parser::reserved_keyword_function(YYSession, "uuid", NULL))) |
1996.2.1
by Brian Aker
uuid type code. |
3004 |
{
|
3005 |
DRIZZLE_YYABORT; |
|
3006 |
}
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3007 |
Lex.setCacheable(false); |
1996.2.1
by Brian Aker
uuid type code. |
3008 |
}
|
1958.1.1
by Brian Aker
Fix clash in parser with wait(). |
3009 |
| WAIT_SYM '(' expr ',' expr ')' |
3010 |
{
|
|
3011 |
List<Item> *args= new (YYSession->mem_root) List<Item>; |
|
3012 |
args->push_back($3); |
|
3013 |
args->push_back($5); |
|
2172.3.5
by Brian Aker
Cleanup a few locations where we should have just been using constant |
3014 |
if (! ($$= parser::reserved_keyword_function(YYSession, "wait", args))) |
1958.1.1
by Brian Aker
Fix clash in parser with wait(). |
3015 |
{
|
3016 |
DRIZZLE_YYABORT; |
|
3017 |
}
|
|
3018 |
}
|
|
1
by brian
clean slate |
3019 |
;
|
3020 |
||
3021 |
/*
|
|
3022 |
Regular function calls. |
|
3023 |
The function name is *not* a token, and therefore is guaranteed to not |
|
3024 |
introduce side effects to the language in general. |
|
3025 |
MAINTAINER: |
|
3026 |
All the new functions implemented for new features should fit into |
|
1014.4.7
by Jay Pipes
More documentation of LEX member variables and removal of slave_session_opt unused member variable. |
3027 |
this category. |
1
by brian
clean slate |
3028 |
*/
|
3029 |
function_call_generic: |
|
3030 |
IDENT_sys '(' |
|
3031 |
{
|
|
2198.6.15
by Brian Aker
Remove caller convert to std::string (ie we were going back and forth in |
3032 |
const plugin::Function *udf= plugin::Function::get(std::string($1.str, $1.length)); |
139.1.8
by Stewart Smith
UDFs are now normal Item_func objects. Simplifies handling them a lot. |
3033 |
|
1093.1.62
by Monty Taylor
Moved UDFs to slot organization. |
3034 |
/* Temporary placing the result of getFunction in $3 */ |
1
by brian
clean slate |
3035 |
$<udf>$= udf; |
3036 |
}
|
|
3037 |
opt_udf_expr_list ')' |
|
3038 |
{
|
|
3039 |
Create_func *builder; |
|
3040 |
Item *item= NULL; |
|
3041 |
||
3042 |
/*
|
|
3043 |
Implementation note: |
|
3044 |
names are resolved with the following order: |
|
3045 |
- MySQL native functions, |
|
3046 |
- User Defined Functions, |
|
3047 |
- Stored Functions (assuming the current <use> database) |
|
3048 |
||
3049 |
This will be revised with WL#2128 (SQL PATH) |
|
3050 |
*/
|
|
873.2.19
by Monty Taylor
Removed another HASH and another set of useless utf8 hashing. |
3051 |
builder= find_native_function_builder($1); |
1
by brian
clean slate |
3052 |
if (builder) |
3053 |
{
|
|
2029.1.15
by Brian Aker
Remove useless copy. |
3054 |
item= builder->create(YYSession, $1, $4); |
1
by brian
clean slate |
3055 |
}
|
3056 |
else
|
|
3057 |
{
|
|
1130.1.10
by Monty Taylor
Renamed namespace slot to namespace service. |
3058 |
/* Retrieving the result of service::Function::get */ |
1093.1.62
by Monty Taylor
Moved UDFs to slot organization. |
3059 |
const plugin::Function *udf= $<udf>3; |
134.1.1
by Mark Atwood
more hackery to get plugin UDFs working |
3060 |
if (udf) |
1
by brian
clean slate |
3061 |
{
|
2029.1.15
by Brian Aker
Remove useless copy. |
3062 |
item= Create_udf_func::s_singleton.create(YYSession, udf, $4); |
1014.4.7
by Jay Pipes
More documentation of LEX member variables and removal of slave_session_opt unused member variable. |
3063 |
} else { |
258.1.1
by Mark Atwood
fix for bug 250065 from Andrew Garner <muzazzi@gmail.com> |
3064 |
/* fix for bug 250065, from Andrew Garner <muzazzi@gmail.com> */ |
3065 |
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", $1.str); |
|
1
by brian
clean slate |
3066 |
}
|
3067 |
}
|
|
3068 |
||
3069 |
if (! ($$= item)) |
|
3070 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3071 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3072 |
}
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3073 |
Lex.setCacheable(false); |
1
by brian
clean slate |
3074 |
}
|
3075 |
;
|
|
3076 |
||
3077 |
opt_udf_expr_list: |
|
3078 |
/* empty */ { $$= NULL; } |
|
3079 |
| udf_expr_list { $$= $1; } |
|
3080 |
;
|
|
3081 |
||
3082 |
udf_expr_list: |
|
3083 |
udf_expr
|
|
3084 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3085 |
$$= new (YYSession->mem_root) List<Item>; |
1
by brian
clean slate |
3086 |
$$->push_back($1); |
3087 |
}
|
|
3088 |
| udf_expr_list ',' udf_expr |
|
3089 |
{
|
|
3090 |
$1->push_back($3); |
|
3091 |
$$= $1; |
|
3092 |
}
|
|
3093 |
;
|
|
3094 |
||
3095 |
udf_expr: |
|
3096 |
remember_name expr remember_end select_alias |
|
3097 |
{
|
|
3098 |
/*
|
|
3099 |
Use Item::name as a storage for the attribute value of user |
|
3100 |
defined function argument. It is safe to use Item::name |
|
3101 |
because the syntax will not allow having an explicit name here. |
|
3102 |
See WL#1017 re. udf attributes. |
|
3103 |
*/
|
|
3104 |
if ($4.str) |
|
3105 |
{
|
|
51.1.74
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
3106 |
$2->is_autogenerated_name= false; |
1
by brian
clean slate |
3107 |
$2->set_name($4.str, $4.length, system_charset_info); |
3108 |
}
|
|
3109 |
else
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3110 |
$2->set_name($1, (uint) ($3 - $1), YYSession->charset()); |
1
by brian
clean slate |
3111 |
$$= $2; |
3112 |
}
|
|
3113 |
;
|
|
3114 |
||
3115 |
sum_expr: |
|
3116 |
AVG_SYM '(' in_sum_expr ')' |
|
3117 |
{ $$=new Item_sum_avg($3); } |
|
3118 |
| AVG_SYM '(' DISTINCT in_sum_expr ')' |
|
3119 |
{ $$=new Item_sum_avg_distinct($4); } |
|
3120 |
| COUNT_SYM '(' opt_all '*' ')' |
|
205
by Brian Aker
uint32 -> uin32_t |
3121 |
{ $$=new Item_sum_count(new Item_int((int32_t) 0L,1)); } |
1
by brian
clean slate |
3122 |
| COUNT_SYM '(' in_sum_expr ')' |
3123 |
{ $$=new Item_sum_count($3); } |
|
3124 |
| COUNT_SYM '(' DISTINCT |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3125 |
{ Lex.current_select->in_sum_expr++; } |
1
by brian
clean slate |
3126 |
expr_list
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3127 |
{ Lex.current_select->in_sum_expr--; } |
1
by brian
clean slate |
3128 |
')'
|
3129 |
{ $$=new Item_sum_count_distinct(* $5); } |
|
3130 |
| MIN_SYM '(' in_sum_expr ')' |
|
3131 |
{ $$=new Item_sum_min($3); } |
|
3132 |
/*
|
|
3133 |
According to ANSI SQL, DISTINCT is allowed and has |
|
3134 |
no sense inside MIN and MAX grouping functions; so MIN|MAX(DISTINCT ...) |
|
3135 |
is processed like an ordinary MIN | MAX() |
|
3136 |
*/
|
|
3137 |
| MIN_SYM '(' DISTINCT in_sum_expr ')' |
|
3138 |
{ $$=new Item_sum_min($4); } |
|
3139 |
| MAX_SYM '(' in_sum_expr ')' |
|
3140 |
{ $$=new Item_sum_max($3); } |
|
3141 |
| MAX_SYM '(' DISTINCT in_sum_expr ')' |
|
3142 |
{ $$=new Item_sum_max($4); } |
|
3143 |
| STD_SYM '(' in_sum_expr ')' |
|
3144 |
{ $$=new Item_sum_std($3, 0); } |
|
3145 |
| VARIANCE_SYM '(' in_sum_expr ')' |
|
3146 |
{ $$=new Item_sum_variance($3, 0); } |
|
3147 |
| STDDEV_SAMP_SYM '(' in_sum_expr ')' |
|
3148 |
{ $$=new Item_sum_std($3, 1); } |
|
3149 |
| VAR_SAMP_SYM '(' in_sum_expr ')' |
|
3150 |
{ $$=new Item_sum_variance($3, 1); } |
|
3151 |
| SUM_SYM '(' in_sum_expr ')' |
|
3152 |
{ $$=new Item_sum_sum($3); } |
|
3153 |
| SUM_SYM '(' DISTINCT in_sum_expr ')' |
|
3154 |
{ $$=new Item_sum_sum_distinct($4); } |
|
3155 |
| GROUP_CONCAT_SYM '(' opt_distinct |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3156 |
{ Lex.current_select->in_sum_expr++; } |
1
by brian
clean slate |
3157 |
expr_list opt_gorder_clause |
3158 |
opt_gconcat_separator
|
|
3159 |
')'
|
|
3160 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3161 |
Select_Lex *sel= Lex.current_select; |
1
by brian
clean slate |
3162 |
sel->in_sum_expr--; |
2227.4.10
by Olaf van der Spek
Session::lex() |
3163 |
$$=new Item_func_group_concat(Lex.current_context(), $3, $5, |
1
by brian
clean slate |
3164 |
sel->gorder_list, $7); |
2179.2.1
by Olaf van der Spek
Rename List::empty to clear (std::list uses clear) |
3165 |
$5->clear(); |
1
by brian
clean slate |
3166 |
}
|
3167 |
;
|
|
3168 |
||
3169 |
variable: |
|
3170 |
'@'
|
|
736
by Brian Aker
Remove dead variables. |
3171 |
{ } |
1
by brian
clean slate |
3172 |
variable_aux
|
3173 |
{
|
|
3174 |
$$= $3; |
|
3175 |
}
|
|
3176 |
;
|
|
3177 |
||
3178 |
variable_aux: |
|
2029.1.26
by Brian Aker
Merge in work for reserved words in SQL standard. |
3179 |
user_variable_ident SET_VAR expr |
1
by brian
clean slate |
3180 |
{
|
3181 |
$$= new Item_func_set_user_var($1, $3); |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3182 |
Lex.setCacheable(false); |
1
by brian
clean slate |
3183 |
}
|
2029.1.26
by Brian Aker
Merge in work for reserved words in SQL standard. |
3184 |
| user_variable_ident |
1
by brian
clean slate |
3185 |
{
|
1633.4.3
by Brian Aker
Remove session usage. |
3186 |
$$= new Item_func_get_user_var(*YYSession, $1); |
2227.4.10
by Olaf van der Spek
Session::lex() |
3187 |
Lex.setCacheable(false); |
1
by brian
clean slate |
3188 |
}
|
2029.1.26
by Brian Aker
Merge in work for reserved words in SQL standard. |
3189 |
| '@' opt_var_ident_type user_variable_ident opt_component |
1
by brian
clean slate |
3190 |
{
|
3191 |
/* disallow "SELECT @@global.global.variable" */ |
|
2096.1.15
by Brian Aker
Additional parser cleanup. |
3192 |
if ($3.str && $4.str && parser::check_reserved_words(&$3)) |
1
by brian
clean slate |
3193 |
{
|
2104.3.5
by Brian Aker
Fixed case where parser error message might be null. |
3194 |
parser::my_parse_error(YYSession->m_lip); |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3195 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3196 |
}
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3197 |
if (!($$= get_system_var(YYSession, $2, $3, $4))) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3198 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3199 |
}
|
3200 |
;
|
|
3201 |
||
3202 |
opt_distinct: |
|
2029.1.14
by Brian Aker
Additional boolean |
3203 |
/* empty */ { $$ = false; } |
3204 |
| DISTINCT { $$ = true; } |
|
1
by brian
clean slate |
3205 |
;
|
3206 |
||
3207 |
opt_gconcat_separator: |
|
3208 |
/* empty */ |
|
3209 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3210 |
$$= new (YYSession->mem_root) String(",", 1, &my_charset_utf8_general_ci); |
1
by brian
clean slate |
3211 |
}
|
3212 |
| SEPARATOR_SYM text_string { $$ = $2; } |
|
3213 |
;
|
|
3214 |
||
3215 |
opt_gorder_clause: |
|
3216 |
/* empty */ |
|
3217 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3218 |
Lex.current_select->gorder_list = NULL; |
1
by brian
clean slate |
3219 |
}
|
3220 |
| order_clause |
|
3221 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3222 |
Select_Lex *select= Lex.current_select; |
1
by brian
clean slate |
3223 |
select->gorder_list= |
1253.1.6
by Monty Taylor
Moved mem_root functions into drizzled::memory:: namespace. |
3224 |
(SQL_LIST*) memory::sql_memdup((char*) &select->order_list, |
1
by brian
clean slate |
3225 |
sizeof(st_sql_list)); |
2179.2.1
by Olaf van der Spek
Rename List::empty to clear (std::list uses clear) |
3226 |
select->order_list.clear(); |
1
by brian
clean slate |
3227 |
}
|
3228 |
;
|
|
3229 |
||
3230 |
in_sum_expr: |
|
3231 |
opt_all
|
|
3232 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3233 |
if (Lex.current_select->inc_in_sum_expr()) |
1
by brian
clean slate |
3234 |
{
|
2104.3.5
by Brian Aker
Fixed case where parser error message might be null. |
3235 |
parser::my_parse_error(YYSession->m_lip); |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3236 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3237 |
}
|
3238 |
}
|
|
3239 |
expr
|
|
3240 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3241 |
Lex.current_select->in_sum_expr--; |
1
by brian
clean slate |
3242 |
$$= $3; |
3243 |
}
|
|
3244 |
;
|
|
3245 |
||
3246 |
cast_type: |
|
3247 |
BINARY opt_len |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3248 |
{ $$=ITEM_CAST_CHAR; Lex.charset= &my_charset_bin; Lex.dec= 0; } |
2023.2.4
by Brian Aker
Merge in cast() for BOOLEAN. |
3249 |
| BOOLEAN_SYM |
2227.4.10
by Olaf van der Spek
Session::lex() |
3250 |
{ $$=ITEM_CAST_BOOLEAN; Lex.charset= &my_charset_bin; Lex.dec= 0; } |
2015.1.3
by Brian Aker
Merge in CAST operators for SIGNED/UNSIGNED |
3251 |
| SIGNED_SYM |
2227.4.10
by Olaf van der Spek
Session::lex() |
3252 |
{ $$=ITEM_CAST_SIGNED; Lex.charset= NULL; Lex.dec=Lex.length= (char*)0; } |
2015.1.3
by Brian Aker
Merge in CAST operators for SIGNED/UNSIGNED |
3253 |
| SIGNED_SYM INT_SYM |
2227.4.10
by Olaf van der Spek
Session::lex() |
3254 |
{ $$=ITEM_CAST_SIGNED; Lex.charset= NULL; Lex.dec=Lex.length= (char*)0; } |
2039.3.4
by Brian Aker
Adding typeof() method to determine drizzle type returns |
3255 |
| INT_SYM |
2227.4.10
by Olaf van der Spek
Session::lex() |
3256 |
{ $$=ITEM_CAST_SIGNED; Lex.charset= NULL; Lex.dec=Lex.length= (char*)0; } |
2015.1.3
by Brian Aker
Merge in CAST operators for SIGNED/UNSIGNED |
3257 |
| UNSIGNED_SYM |
2227.4.10
by Olaf van der Spek
Session::lex() |
3258 |
{ $$=ITEM_CAST_UNSIGNED; Lex.charset= NULL; Lex.dec=Lex.length= (char*)0; } |
2015.1.3
by Brian Aker
Merge in CAST operators for SIGNED/UNSIGNED |
3259 |
| UNSIGNED_SYM INT_SYM |
2227.4.10
by Olaf van der Spek
Session::lex() |
3260 |
{ $$=ITEM_CAST_UNSIGNED; Lex.charset= NULL; Lex.dec=Lex.length= (char*)0; } |
1217
by Brian Aker
Removed bits of charset support from the parser. |
3261 |
| CHAR_SYM opt_len |
2227.4.10
by Olaf van der Spek
Session::lex() |
3262 |
{ $$=ITEM_CAST_CHAR; Lex.dec= 0; } |
1
by brian
clean slate |
3263 |
| DATE_SYM |
2227.4.10
by Olaf van der Spek
Session::lex() |
3264 |
{ $$=ITEM_CAST_DATE; Lex.charset= NULL; Lex.dec=Lex.length= (char*)0; } |
1999.4.8
by Brian Aker
Adding in time type. |
3265 |
| TIME_SYM |
2227.4.10
by Olaf van der Spek
Session::lex() |
3266 |
{ $$=ITEM_CAST_TIME; Lex.charset= NULL; Lex.dec=Lex.length= (char*)0; } |
1008.3.17
by Stewart Smith
Start work to construct table proto in parser: |
3267 |
| DATETIME_SYM |
2227.4.10
by Olaf van der Spek
Session::lex() |
3268 |
{ $$=ITEM_CAST_DATETIME; Lex.charset= NULL; Lex.dec=Lex.length= (char*)0; } |
1
by brian
clean slate |
3269 |
| DECIMAL_SYM float_options |
2227.4.10
by Olaf van der Spek
Session::lex() |
3270 |
{ $$=ITEM_CAST_DECIMAL; Lex.charset= NULL; } |
1
by brian
clean slate |
3271 |
;
|
3272 |
||
3273 |
expr_list: |
|
3274 |
expr
|
|
3275 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3276 |
$$= new (YYSession->mem_root) List<Item>; |
1
by brian
clean slate |
3277 |
$$->push_back($1); |
3278 |
}
|
|
3279 |
| expr_list ',' expr |
|
3280 |
{
|
|
3281 |
$1->push_back($3); |
|
3282 |
$$= $1; |
|
3283 |
}
|
|
3284 |
;
|
|
3285 |
||
3286 |
opt_expr: |
|
3287 |
/* empty */ { $$= NULL; } |
|
3288 |
| expr { $$= $1; } |
|
3289 |
;
|
|
3290 |
||
3291 |
opt_else: |
|
3292 |
/* empty */ { $$= NULL; } |
|
3293 |
| ELSE expr { $$= $2; } |
|
3294 |
;
|
|
3295 |
||
3296 |
when_list: |
|
3297 |
WHEN_SYM expr THEN_SYM expr |
|
3298 |
{
|
|
3299 |
$$= new List<Item>; |
|
3300 |
$$->push_back($2); |
|
3301 |
$$->push_back($4); |
|
3302 |
}
|
|
3303 |
| when_list WHEN_SYM expr THEN_SYM expr |
|
3304 |
{
|
|
3305 |
$1->push_back($3); |
|
3306 |
$1->push_back($5); |
|
3307 |
$$= $1; |
|
3308 |
}
|
|
3309 |
;
|
|
3310 |
||
3311 |
/* Equivalent to <table reference> in the SQL:2003 standard. */ |
|
3312 |
/* Warning - may return NULL in case of incomplete SELECT */ |
|
3313 |
table_ref: |
|
3314 |
table_factor { $$=$1; } |
|
3315 |
| join_table |
|
3316 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3317 |
if (!($$= Lex.current_select->nest_last_join(Lex.session))) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3318 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3319 |
}
|
3320 |
;
|
|
3321 |
||
3322 |
join_table_list: |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3323 |
derived_table_list { DRIZZLE_YYABORT_UNLESS($$=$1); } |
1
by brian
clean slate |
3324 |
;
|
3325 |
||
3326 |
/*
|
|
3327 |
The ODBC escape syntax for Outer Join is: '{' OJ join_table '}' |
|
3328 |
The parser does not define OJ as a token, any ident is accepted |
|
3329 |
instead in $2 (ident). Also, all productions from table_ref can |
|
3330 |
be escaped, not only join_table. Both syntax extensions are safe |
|
3331 |
and are ignored. |
|
3332 |
*/
|
|
3333 |
esc_table_ref: |
|
3334 |
table_ref { $$=$1; } |
|
3335 |
| '{' ident table_ref '}' { $$=$3; } |
|
3336 |
;
|
|
3337 |
||
3338 |
/* Equivalent to <table reference list> in the SQL:2003 standard. */ |
|
3339 |
/* Warning - may return NULL in case of incomplete SELECT */ |
|
3340 |
derived_table_list: |
|
3341 |
esc_table_ref { $$=$1; } |
|
3342 |
| derived_table_list ',' esc_table_ref |
|
3343 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3344 |
DRIZZLE_YYABORT_UNLESS($1 && ($$=$3)); |
1
by brian
clean slate |
3345 |
}
|
3346 |
;
|
|
3347 |
||
3348 |
/*
|
|
3349 |
Notice that JOIN is a left-associative operation, and it must be parsed |
|
3350 |
as such, that is, the parser must process first the left join operand |
|
3351 |
then the right one. Such order of processing ensures that the parser |
|
3352 |
produces correct join trees which is essential for semantic analysis |
|
3353 |
and subsequent optimization phases. |
|
3354 |
*/
|
|
3355 |
join_table: |
|
3356 |
/* INNER JOIN variants */ |
|
3357 |
/*
|
|
3358 |
Use %prec to evaluate production 'table_ref' before 'normal_join' |
|
3359 |
so that [INNER | CROSS] JOIN is properly nested as other |
|
3360 |
left-associative joins. |
|
3361 |
*/
|
|
3362 |
table_ref normal_join table_ref %prec TABLE_REF_PRIORITY |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3363 |
{
|
1637.1.3
by Brian Aker
This fixes the parser to no longer do the bad syntax around the cross join |
3364 |
DRIZZLE_YYABORT_UNLESS($1 && ($$=$3)); |
2227.4.10
by Olaf van der Spek
Session::lex() |
3365 |
Lex.is_cross= false; |
1637.1.3
by Brian Aker
This fixes the parser to no longer do the bad syntax around the cross join |
3366 |
}
|
1
by brian
clean slate |
3367 |
| table_ref STRAIGHT_JOIN table_factor |
2227.4.10
by Olaf van der Spek
Session::lex() |
3368 |
{
|
3369 |
DRIZZLE_YYABORT_UNLESS($1 && ($$=$3)); $3->straight=1; |
|
1637.1.3
by Brian Aker
This fixes the parser to no longer do the bad syntax around the cross join |
3370 |
}
|
1
by brian
clean slate |
3371 |
| table_ref normal_join table_ref |
3372 |
ON
|
|
3373 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3374 |
DRIZZLE_YYABORT_UNLESS($1 && $3); |
2227.4.10
by Olaf van der Spek
Session::lex() |
3375 |
DRIZZLE_YYABORT_UNLESS( not Lex.is_cross ); |
1
by brian
clean slate |
3376 |
/* Change the current name resolution context to a local context. */ |
2241.2.13
by Olaf van der Spek
Refactor |
3377 |
push_new_name_resolution_context(*YYSession, *$1, *$3); |
2227.4.10
by Olaf van der Spek
Session::lex() |
3378 |
Lex.current_select->parsing_place= IN_ON; |
1
by brian
clean slate |
3379 |
}
|
3380 |
expr
|
|
3381 |
{
|
|
3382 |
add_join_on($3,$6); |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3383 |
Lex.pop_context(); |
3384 |
Lex.current_select->parsing_place= NO_MATTER; |
|
1
by brian
clean slate |
3385 |
}
|
3386 |
| table_ref STRAIGHT_JOIN table_factor |
|
3387 |
ON
|
|
3388 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3389 |
DRIZZLE_YYABORT_UNLESS($1 && $3); |
1
by brian
clean slate |
3390 |
/* Change the current name resolution context to a local context. */ |
2241.2.13
by Olaf van der Spek
Refactor |
3391 |
push_new_name_resolution_context(*YYSession, *$1, *$3); |
2227.4.10
by Olaf van der Spek
Session::lex() |
3392 |
Lex.current_select->parsing_place= IN_ON; |
1
by brian
clean slate |
3393 |
}
|
3394 |
expr
|
|
3395 |
{
|
|
3396 |
$3->straight=1; |
|
3397 |
add_join_on($3,$6); |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3398 |
Lex.pop_context(); |
3399 |
Lex.current_select->parsing_place= NO_MATTER; |
|
1
by brian
clean slate |
3400 |
}
|
3401 |
| table_ref normal_join table_ref |
|
3402 |
USING
|
|
3403 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3404 |
DRIZZLE_YYABORT_UNLESS($1 && $3); |
1
by brian
clean slate |
3405 |
}
|
3406 |
'(' using_list ')' |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3407 |
{ add_join_natural($1,$3,$7,Lex.current_select); $$=$3; } |
1
by brian
clean slate |
3408 |
| table_ref NATURAL JOIN_SYM table_factor |
3409 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3410 |
DRIZZLE_YYABORT_UNLESS($1 && ($$=$4)); |
2227.4.10
by Olaf van der Spek
Session::lex() |
3411 |
add_join_natural($1,$4,NULL,Lex.current_select); |
1
by brian
clean slate |
3412 |
}
|
3413 |
||
3414 |
/* LEFT JOIN variants */ |
|
3415 |
| table_ref LEFT opt_outer JOIN_SYM table_ref |
|
3416 |
ON
|
|
3417 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3418 |
DRIZZLE_YYABORT_UNLESS($1 && $5); |
1
by brian
clean slate |
3419 |
/* Change the current name resolution context to a local context. */ |
2241.2.13
by Olaf van der Spek
Refactor |
3420 |
push_new_name_resolution_context(*YYSession, *$1, *$5); |
2227.4.10
by Olaf van der Spek
Session::lex() |
3421 |
Lex.current_select->parsing_place= IN_ON; |
1
by brian
clean slate |
3422 |
}
|
3423 |
expr
|
|
3424 |
{
|
|
3425 |
add_join_on($5,$8); |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3426 |
Lex.pop_context(); |
1
by brian
clean slate |
3427 |
$5->outer_join|=JOIN_TYPE_LEFT; |
3428 |
$$=$5; |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3429 |
Lex.current_select->parsing_place= NO_MATTER; |
1
by brian
clean slate |
3430 |
}
|
3431 |
| table_ref LEFT opt_outer JOIN_SYM table_factor |
|
3432 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3433 |
DRIZZLE_YYABORT_UNLESS($1 && $5); |
1
by brian
clean slate |
3434 |
}
|
3435 |
USING '(' using_list ')' |
|
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
3436 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3437 |
add_join_natural($1,$5,$9,Lex.current_select); |
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
3438 |
$5->outer_join|=JOIN_TYPE_LEFT; |
3439 |
$$=$5; |
|
1
by brian
clean slate |
3440 |
}
|
3441 |
| table_ref NATURAL LEFT opt_outer JOIN_SYM table_factor |
|
3442 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3443 |
DRIZZLE_YYABORT_UNLESS($1 && $6); |
2227.4.10
by Olaf van der Spek
Session::lex() |
3444 |
add_join_natural($1,$6,NULL,Lex.current_select); |
1
by brian
clean slate |
3445 |
$6->outer_join|=JOIN_TYPE_LEFT; |
3446 |
$$=$6; |
|
3447 |
}
|
|
3448 |
||
3449 |
/* RIGHT JOIN variants */ |
|
3450 |
| table_ref RIGHT opt_outer JOIN_SYM table_ref |
|
3451 |
ON
|
|
3452 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3453 |
DRIZZLE_YYABORT_UNLESS($1 && $5); |
1
by brian
clean slate |
3454 |
/* Change the current name resolution context to a local context. */ |
2241.2.13
by Olaf van der Spek
Refactor |
3455 |
push_new_name_resolution_context(*YYSession, *$1, *$5); |
2227.4.10
by Olaf van der Spek
Session::lex() |
3456 |
Lex.current_select->parsing_place= IN_ON; |
1
by brian
clean slate |
3457 |
}
|
3458 |
expr
|
|
3459 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3460 |
if (!($$= Lex.current_select->convert_right_join())) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3461 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3462 |
add_join_on($$, $8); |
2227.4.10
by Olaf van der Spek
Session::lex() |
3463 |
Lex.pop_context(); |
3464 |
Lex.current_select->parsing_place= NO_MATTER; |
|
1
by brian
clean slate |
3465 |
}
|
3466 |
| table_ref RIGHT opt_outer JOIN_SYM table_factor |
|
3467 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3468 |
DRIZZLE_YYABORT_UNLESS($1 && $5); |
1
by brian
clean slate |
3469 |
}
|
3470 |
USING '(' using_list ')' |
|
3471 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3472 |
if (!($$= Lex.current_select->convert_right_join())) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3473 |
DRIZZLE_YYABORT; |
2227.4.10
by Olaf van der Spek
Session::lex() |
3474 |
add_join_natural($$,$5,$9,Lex.current_select); |
1
by brian
clean slate |
3475 |
}
|
3476 |
| table_ref NATURAL RIGHT opt_outer JOIN_SYM table_factor |
|
3477 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3478 |
DRIZZLE_YYABORT_UNLESS($1 && $6); |
2227.4.10
by Olaf van der Spek
Session::lex() |
3479 |
add_join_natural($6,$1,NULL,Lex.current_select); |
3480 |
if (!($$= Lex.current_select->convert_right_join())) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3481 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3482 |
}
|
3483 |
;
|
|
3484 |
||
3485 |
normal_join: |
|
3486 |
JOIN_SYM {} |
|
3487 |
| INNER_SYM JOIN_SYM {} |
|
2141.4.2
by Andrew Hutchings
Implicit joins of the form "SELECT * FROM t1, t2" without WHERE or ON now error. |
3488 |
| CROSS JOIN_SYM |
3489 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3490 |
Lex.is_cross= true; |
3491 |
Lex.current_select->is_cross= true; |
|
2141.4.2
by Andrew Hutchings
Implicit joins of the form "SELECT * FROM t1, t2" without WHERE or ON now error. |
3492 |
}
|
1
by brian
clean slate |
3493 |
;
|
3494 |
||
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
3495 |
/*
|
1
by brian
clean slate |
3496 |
This is a flattening of the rules <table factor> and <table primary> |
3497 |
in the SQL:2003 standard, since we don't have <sample clause> |
|
3498 |
||
3499 |
I.e.
|
|
3500 |
<table factor> ::= <table primary> [ <sample clause> ]
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3501 |
*/
|
1
by brian
clean slate |
3502 |
/* Warning - may return NULL in case of incomplete SELECT */
|
3503 |
table_factor:
|
|
3504 |
{
|
|
3505 |
}
|
|
3506 |
table_ident opt_table_alias opt_key_definition
|
|
3507 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3508 |
if (!($$= Lex.current_select->add_table_to_list(YYSession, $2, $3,
|
1858.1.2
by Padraig O'Sullivan
Converted another uint8_t type to be a bitset. |
3509 |
0,
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3510 |
Lex.lock_option,
|
3511 |
Lex.current_select->pop_index_hints())))
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3512 |
DRIZZLE_YYABORT;
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3513 |
Lex.current_select->add_joined_table($$);
|
1
by brian
clean slate |
3514 |
}
|
3515 |
| select_derived_init get_select_lex select_derived2
|
|
3516 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3517 |
Select_Lex *sel= Lex.current_select;
|
1
by brian
clean slate |
3518 |
if ($1)
|
3519 |
{
|
|
3520 |
if (sel->set_braces(1))
|
|
3521 |
{
|
|
2104.3.5
by Brian Aker
Fixed case where parser error message might be null. |
3522 |
parser::my_parse_error(YYSession->m_lip);
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3523 |
DRIZZLE_YYABORT;
|
1
by brian
clean slate |
3524 |
}
|
3525 |
/* select in braces, can't contain global parameters */ |
|
3526 |
if (sel->master_unit()->fake_select_lex) |
|
3527 |
sel->master_unit()->global_parameters= |
|
3528 |
sel->master_unit()->fake_select_lex; |
|
3529 |
}
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3530 |
if ($2->init_nested_join(Lex.session)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3531 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3532 |
$$= 0; |
3533 |
/* incomplete derived tables return NULL, we must be |
|
3534 |
nested in select_derived rule to be here. */ |
|
3535 |
}
|
|
3536 |
/*
|
|
3537 |
Represents a flattening of the following rules from the SQL:2003 |
|
3538 |
standard. This sub-rule corresponds to the sub-rule |
|
3539 |
<table primary> ::= ... | <derived table> [ AS ] <correlation name> |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3540 |
|
1
by brian
clean slate |
3541 |
The following rules have been flattened into query_expression_body |
3542 |
(since we have no <with clause>). |
|
3543 |
||
3544 |
<derived table> ::= <table subquery> |
|
3545 |
<table subquery> ::= <subquery> |
|
3546 |
<subquery> ::= <left paren> <query expression> <right paren> |
|
3547 |
<query expression> ::= [ <with clause> ] <query expression body> |
|
3548 |
||
3549 |
For the time being we use the non-standard rule |
|
3550 |
select_derived_union which is a compromise between the standard |
|
3551 |
and our parser. Possibly this rule could be replaced by our |
|
3552 |
query_expression_body. |
|
3553 |
*/
|
|
3554 |
| '(' get_select_lex select_derived_union ')' opt_table_alias |
|
3555 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3556 |
/* Use $2 instead of Lex.current_select as derived table will |
3557 |
alter value of Lex.current_select. */ |
|
1
by brian
clean slate |
3558 |
if (!($3 || $5) && $2->embedding && |
2183.2.20
by Olaf van der Spek
Use List::size() |
3559 |
!$2->embedding->getNestedJoin()->join_list.size()) |
1
by brian
clean slate |
3560 |
{
|
3561 |
/* we have a derived table ($3 == NULL) but no alias, |
|
3562 |
Since we are nested in further parentheses so we |
|
3563 |
can pass NULL to the outer level parentheses |
|
3564 |
Permits parsing of "((((select ...))) as xyz)" */ |
|
3565 |
$$= 0; |
|
3566 |
}
|
|
3567 |
else if (!$3) |
|
3568 |
{
|
|
3569 |
/* Handle case of derived table, alias may be NULL if there |
|
3570 |
are no outer parentheses, add_table_to_list() will throw |
|
3571 |
error in this case */ |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3572 |
Select_Lex *sel= Lex.current_select; |
849
by Brian Aker
Remove dead keywords. |
3573 |
Select_Lex_Unit *unit= sel->master_unit(); |
2227.4.10
by Olaf van der Spek
Session::lex() |
3574 |
Lex.current_select= sel= unit->outer_select(); |
3575 |
if (!($$= sel->add_table_to_list(Lex.session, |
|
1
by brian
clean slate |
3576 |
new Table_ident(unit), $5, 0, |
3577 |
TL_READ))) |
|
3578 |
||
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3579 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3580 |
sel->add_joined_table($$); |
2227.4.10
by Olaf van der Spek
Session::lex() |
3581 |
Lex.pop_context(); |
1
by brian
clean slate |
3582 |
}
|
3583 |
else if (($3->select_lex && $3->select_lex->master_unit()->is_union()) || $5) |
|
3584 |
{
|
|
3585 |
/* simple nested joins cannot have aliases or unions */ |
|
2104.3.5
by Brian Aker
Fixed case where parser error message might be null. |
3586 |
parser::my_parse_error(YYSession->m_lip); |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3587 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3588 |
}
|
3589 |
else
|
|
3590 |
$$= $3; |
|
3591 |
}
|
|
3592 |
;
|
|
3593 |
||
3594 |
select_derived_union: |
|
3595 |
select_derived opt_order_clause opt_limit_clause |
|
3596 |
| select_derived_union |
|
3597 |
UNION_SYM
|
|
3598 |
union_option
|
|
3599 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3600 |
if (parser::add_select_to_union_list(YYSession, &Lex, (bool)$3)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3601 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3602 |
}
|
3603 |
query_specification
|
|
3604 |
{
|
|
3605 |
/*
|
|
3606 |
Remove from the name resolution context stack the context of the |
|
3607 |
last select in the union. |
|
3608 |
*/
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3609 |
Lex.pop_context(); |
1
by brian
clean slate |
3610 |
}
|
3611 |
opt_order_clause opt_limit_clause |
|
3612 |
;
|
|
3613 |
||
3614 |
/* The equivalent of select_init2 for nested queries. */ |
|
3615 |
select_init2_derived: |
|
3616 |
select_part2_derived
|
|
3617 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3618 |
Select_Lex * sel= Lex.current_select; |
3619 |
if (Lex.current_select->set_braces(0)) |
|
1
by brian
clean slate |
3620 |
{
|
2104.3.5
by Brian Aker
Fixed case where parser error message might be null. |
3621 |
parser::my_parse_error(YYSession->m_lip); |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3622 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3623 |
}
|
3624 |
if (sel->linkage == UNION_TYPE && |
|
3625 |
sel->master_unit()->first_select()->braces) |
|
3626 |
{
|
|
2104.3.5
by Brian Aker
Fixed case where parser error message might be null. |
3627 |
parser::my_parse_error(YYSession->m_lip); |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3628 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3629 |
}
|
3630 |
}
|
|
3631 |
;
|
|
3632 |
||
3633 |
/* The equivalent of select_part2 for nested queries. */ |
|
3634 |
select_part2_derived: |
|
3635 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3636 |
Select_Lex *sel= Lex.current_select; |
1
by brian
clean slate |
3637 |
if (sel->linkage != UNION_TYPE) |
2227.4.10
by Olaf van der Spek
Session::lex() |
3638 |
init_select(&Lex); |
3639 |
Lex.current_select->parsing_place= SELECT_LIST; |
|
1
by brian
clean slate |
3640 |
}
|
3641 |
select_options select_item_list |
|
3642 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3643 |
Lex.current_select->parsing_place= NO_MATTER; |
1
by brian
clean slate |
3644 |
}
|
3645 |
opt_select_from select_lock_type |
|
3646 |
;
|
|
3647 |
||
3648 |
/* handle contents of parentheses in join expression */ |
|
3649 |
select_derived: |
|
3650 |
get_select_lex
|
|
3651 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3652 |
if ($1->init_nested_join(Lex.session)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3653 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3654 |
}
|
3655 |
derived_table_list
|
|
3656 |
{
|
|
3657 |
/* for normal joins, $3 != NULL and end_nested_join() != NULL, |
|
3658 |
for derived tables, both must equal NULL */ |
|
3659 |
||
2227.4.10
by Olaf van der Spek
Session::lex() |
3660 |
if (!($$= $1->end_nested_join(Lex.session)) && $3) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3661 |
DRIZZLE_YYABORT; |
2114.4.1
by Brian Aker
Convert just a single SE engine option to be a bit more concise in parser. |
3662 |
|
1
by brian
clean slate |
3663 |
if (!$3 && $$) |
3664 |
{
|
|
2104.3.5
by Brian Aker
Fixed case where parser error message might be null. |
3665 |
parser::my_parse_error(YYSession->m_lip); |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3666 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3667 |
}
|
3668 |
}
|
|
3669 |
;
|
|
3670 |
||
3671 |
select_derived2: |
|
3672 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3673 |
Lex.derived_tables|= DERIVED_SUBQUERY; |
3674 |
if (not Lex.expr_allows_subselect) |
|
1
by brian
clean slate |
3675 |
{
|
2104.3.5
by Brian Aker
Fixed case where parser error message might be null. |
3676 |
parser::my_parse_error(YYSession->m_lip); |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3677 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3678 |
}
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3679 |
if (Lex.current_select->linkage == GLOBAL_OPTIONS_TYPE || new_select(&Lex, 1)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3680 |
DRIZZLE_YYABORT; |
2227.4.10
by Olaf van der Spek
Session::lex() |
3681 |
init_select(&Lex); |
3682 |
Lex.current_select->linkage= DERIVED_TABLE_TYPE; |
|
3683 |
Lex.current_select->parsing_place= SELECT_LIST; |
|
1
by brian
clean slate |
3684 |
}
|
3685 |
select_options select_item_list |
|
3686 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3687 |
Lex.current_select->parsing_place= NO_MATTER; |
1
by brian
clean slate |
3688 |
}
|
3689 |
opt_select_from
|
|
3690 |
;
|
|
3691 |
||
3692 |
get_select_lex: |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3693 |
/* Empty */ { $$= Lex.current_select; } |
1
by brian
clean slate |
3694 |
;
|
3695 |
||
3696 |
select_derived_init: |
|
3697 |
SELECT_SYM
|
|
3698 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3699 |
Select_Lex *sel= Lex.current_select; |
327.2.5
by Brian Aker
Refactoring show command |
3700 |
TableList *embedding; |
2227.4.10
by Olaf van der Spek
Session::lex() |
3701 |
if (!sel->embedding || sel->end_nested_join(Lex.session)) |
1
by brian
clean slate |
3702 |
{
|
3703 |
/* we are not in parentheses */ |
|
2104.3.5
by Brian Aker
Fixed case where parser error message might be null. |
3704 |
parser::my_parse_error(YYSession->m_lip); |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3705 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3706 |
}
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3707 |
embedding= Lex.current_select->embedding; |
1
by brian
clean slate |
3708 |
$$= embedding && |
2183.2.20
by Olaf van der Spek
Use List::size() |
3709 |
!embedding->getNestedJoin()->join_list.size(); |
1
by brian
clean slate |
3710 |
/* return true if we are deeply nested */ |
3711 |
}
|
|
3712 |
;
|
|
3713 |
||
3714 |
opt_outer: |
|
3715 |
/* empty */ {} |
|
3716 |
| OUTER {} |
|
3717 |
;
|
|
3718 |
||
3719 |
index_hint_clause: |
|
3720 |
/* empty */ |
|
3721 |
{
|
|
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
3722 |
$$= INDEX_HINT_MASK_ALL; |
1
by brian
clean slate |
3723 |
}
|
3724 |
| FOR_SYM JOIN_SYM { $$= INDEX_HINT_MASK_JOIN; } |
|
3725 |
| FOR_SYM ORDER_SYM BY { $$= INDEX_HINT_MASK_ORDER; } |
|
3726 |
| FOR_SYM GROUP_SYM BY { $$= INDEX_HINT_MASK_GROUP; } |
|
3727 |
;
|
|
3728 |
||
3729 |
index_hint_type: |
|
3730 |
FORCE_SYM { $$= INDEX_HINT_FORCE; } |
|
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
3731 |
| IGNORE_SYM { $$= INDEX_HINT_IGNORE; } |
1
by brian
clean slate |
3732 |
;
|
3733 |
||
3734 |
index_hint_definition: |
|
3735 |
index_hint_type key_or_index index_hint_clause |
|
3736 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3737 |
Lex.current_select->set_index_hint_type($1, $3); |
1
by brian
clean slate |
3738 |
}
|
3739 |
'(' key_usage_list ')' |
|
3740 |
| USE_SYM key_or_index index_hint_clause |
|
3741 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3742 |
Lex.current_select->set_index_hint_type(INDEX_HINT_USE, $3); |
1
by brian
clean slate |
3743 |
}
|
3744 |
'(' opt_key_usage_list ')' |
|
3745 |
;
|
|
3746 |
||
3747 |
index_hints_list: |
|
3748 |
index_hint_definition
|
|
3749 |
| index_hints_list index_hint_definition |
|
3750 |
;
|
|
3751 |
||
3752 |
opt_index_hints_list: |
|
3753 |
/* empty */ |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3754 |
| { Lex.current_select->alloc_index_hints(YYSession); } index_hints_list |
1
by brian
clean slate |
3755 |
;
|
3756 |
||
3757 |
opt_key_definition: |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3758 |
{ Lex.current_select->clear_index_hints(); } |
1
by brian
clean slate |
3759 |
opt_index_hints_list
|
3760 |
;
|
|
3761 |
||
3762 |
opt_key_usage_list: |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3763 |
/* empty */ { Lex.current_select->add_index_hint(YYSession, NULL, 0); } |
1
by brian
clean slate |
3764 |
| key_usage_list {} |
3765 |
;
|
|
3766 |
||
3767 |
key_usage_element: |
|
3768 |
ident
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3769 |
{ Lex.current_select->add_index_hint(YYSession, $1.str, $1.length); } |
1
by brian
clean slate |
3770 |
| PRIMARY_SYM |
2227.4.10
by Olaf van der Spek
Session::lex() |
3771 |
{ Lex.current_select->add_index_hint(YYSession, (char *)"PRIMARY", 7); } |
1
by brian
clean slate |
3772 |
;
|
3773 |
||
3774 |
key_usage_list: |
|
3775 |
key_usage_element
|
|
3776 |
| key_usage_list ',' key_usage_element |
|
3777 |
;
|
|
3778 |
||
3779 |
using_list: |
|
3780 |
ident
|
|
3781 |
{
|
|
3782 |
if (!($$= new List<String>)) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3783 |
DRIZZLE_YYABORT; |
520.1.22
by Brian Aker
Second pass of thd cleanup |
3784 |
$$->push_back(new (YYSession->mem_root) |
1
by brian
clean slate |
3785 |
String((const char *) $1.str, $1.length, |
3786 |
system_charset_info)); |
|
3787 |
}
|
|
3788 |
| using_list ',' ident |
|
3789 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
3790 |
$1->push_back(new (YYSession->mem_root) |
1
by brian
clean slate |
3791 |
String((const char *) $3.str, $3.length, |
3792 |
system_charset_info)); |
|
3793 |
$$= $1; |
|
3794 |
}
|
|
3795 |
;
|
|
3796 |
||
3797 |
interval: |
|
3798 |
interval_time_st {} |
|
3799 |
| DAY_HOUR_SYM { $$=INTERVAL_DAY_HOUR; } |
|
3800 |
| DAY_MICROSECOND_SYM { $$=INTERVAL_DAY_MICROSECOND; } |
|
3801 |
| DAY_MINUTE_SYM { $$=INTERVAL_DAY_MINUTE; } |
|
3802 |
| DAY_SECOND_SYM { $$=INTERVAL_DAY_SECOND; } |
|
3803 |
| HOUR_MICROSECOND_SYM { $$=INTERVAL_HOUR_MICROSECOND; } |
|
3804 |
| HOUR_MINUTE_SYM { $$=INTERVAL_HOUR_MINUTE; } |
|
3805 |
| HOUR_SECOND_SYM { $$=INTERVAL_HOUR_SECOND; } |
|
3806 |
| MINUTE_MICROSECOND_SYM { $$=INTERVAL_MINUTE_MICROSECOND; } |
|
3807 |
| MINUTE_SECOND_SYM { $$=INTERVAL_MINUTE_SECOND; } |
|
3808 |
| SECOND_MICROSECOND_SYM { $$=INTERVAL_SECOND_MICROSECOND; } |
|
3809 |
| YEAR_MONTH_SYM { $$=INTERVAL_YEAR_MONTH; } |
|
3810 |
;
|
|
3811 |
||
3812 |
interval_time_stamp: |
|
3813 |
interval_time_st {} |
|
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
3814 |
| FRAC_SECOND_SYM { |
3815 |
$$=INTERVAL_MICROSECOND; |
|
1
by brian
clean slate |
3816 |
/*
|
3817 |
FRAC_SECOND was mistakenly implemented with |
|
3818 |
a wrong resolution. According to the ODBC |
|
3819 |
standard it should be nanoseconds, not |
|
3820 |
microseconds. Changing it to nanoseconds |
|
3821 |
in MySQL would mean making TIMESTAMPDIFF |
|
3822 |
and TIMESTAMPADD to return DECIMAL, since |
|
3823 |
the return value would be too big for BIGINT |
|
3824 |
Hence we just deprecate the incorrect |
|
3825 |
implementation without changing its |
|
3826 |
resolution. |
|
3827 |
*/
|
|
3828 |
}
|
|
3829 |
;
|
|
3830 |
||
3831 |
interval_time_st: |
|
3832 |
DAY_SYM { $$=INTERVAL_DAY; } |
|
3833 |
| WEEK_SYM { $$=INTERVAL_WEEK; } |
|
3834 |
| HOUR_SYM { $$=INTERVAL_HOUR; } |
|
3835 |
| MINUTE_SYM { $$=INTERVAL_MINUTE; } |
|
3836 |
| MONTH_SYM { $$=INTERVAL_MONTH; } |
|
3837 |
| QUARTER_SYM { $$=INTERVAL_QUARTER; } |
|
3838 |
| SECOND_SYM { $$=INTERVAL_SECOND; } |
|
3839 |
| MICROSECOND_SYM { $$=INTERVAL_MICROSECOND; } |
|
3840 |
| YEAR_SYM { $$=INTERVAL_YEAR; } |
|
3841 |
;
|
|
3842 |
||
3843 |
table_alias: |
|
3844 |
/* empty */ |
|
3845 |
| AS |
|
3846 |
;
|
|
3847 |
||
3848 |
opt_table_alias: |
|
3849 |
/* empty */ { $$=0; } |
|
3850 |
| table_alias ident |
|
2114.4.2
by Brian Aker
Adding build engine options bit. |
3851 |
{
|
3852 |
$$= (drizzled::LEX_STRING*) memory::sql_memdup(&$2,sizeof(drizzled::LEX_STRING)); |
|
3853 |
}
|
|
1
by brian
clean slate |
3854 |
;
|
3855 |
||
3856 |
opt_all: |
|
3857 |
/* empty */ |
|
3858 |
| ALL |
|
3859 |
;
|
|
3860 |
||
3861 |
where_clause: |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3862 |
/* empty */ { Lex.current_select->where= 0; } |
1
by brian
clean slate |
3863 |
| WHERE |
3864 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3865 |
Lex.current_select->parsing_place= IN_WHERE; |
1
by brian
clean slate |
3866 |
}
|
3867 |
expr
|
|
3868 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3869 |
Select_Lex *select= Lex.current_select; |
1
by brian
clean slate |
3870 |
select->where= $3; |
3871 |
select->parsing_place= NO_MATTER; |
|
3872 |
if ($3) |
|
3873 |
$3->top_level_item(); |
|
3874 |
}
|
|
3875 |
;
|
|
3876 |
||
3877 |
having_clause: |
|
3878 |
/* empty */ |
|
3879 |
| HAVING |
|
3880 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3881 |
Lex.current_select->parsing_place= IN_HAVING; |
1
by brian
clean slate |
3882 |
}
|
3883 |
expr
|
|
3884 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3885 |
Select_Lex *sel= Lex.current_select; |
1
by brian
clean slate |
3886 |
sel->having= $3; |
3887 |
sel->parsing_place= NO_MATTER; |
|
3888 |
if ($3) |
|
3889 |
$3->top_level_item(); |
|
3890 |
}
|
|
3891 |
;
|
|
3892 |
||
3893 |
opt_escape: |
|
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
3894 |
ESCAPE_SYM simple_expr |
1
by brian
clean slate |
3895 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3896 |
Lex.escape_used= true; |
1
by brian
clean slate |
3897 |
$$= $2; |
3898 |
}
|
|
3899 |
| /* empty */ |
|
3900 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3901 |
Lex.escape_used= false; |
383.1.12
by Brian Aker
Much closer toward UTF8 being around all the time... |
3902 |
$$= new Item_string("\\", 1, &my_charset_utf8_general_ci); |
1
by brian
clean slate |
3903 |
}
|
3904 |
;
|
|
3905 |
||
3906 |
/*
|
|
3907 |
group by statement in select |
|
3908 |
*/
|
|
3909 |
||
3910 |
group_clause: |
|
3911 |
/* empty */ |
|
3912 |
| GROUP_SYM BY group_list olap_opt |
|
3913 |
;
|
|
3914 |
||
3915 |
group_list: |
|
3916 |
group_list ',' order_ident order_dir |
|
838
by Brian Aker
More class adoption/method |
3917 |
{ if (YYSession->add_group_to_list($3,(bool) $4)) DRIZZLE_YYABORT; } |
1
by brian
clean slate |
3918 |
| order_ident order_dir |
838
by Brian Aker
More class adoption/method |
3919 |
{ if (YYSession->add_group_to_list($1,(bool) $2)) DRIZZLE_YYABORT; } |
1
by brian
clean slate |
3920 |
;
|
3921 |
||
3922 |
olap_opt: |
|
3923 |
/* empty */ {} |
|
3924 |
| WITH_ROLLUP_SYM |
|
3925 |
{
|
|
3926 |
/*
|
|
3927 |
'WITH ROLLUP' is needed for backward compatibility, |
|
3928 |
and cause LALR(2) conflicts. |
|
3929 |
This syntax is not standard. |
|
3930 |
MySQL syntax: GROUP BY col1, col2, col3 WITH ROLLUP |
|
3931 |
SQL-2003: GROUP BY ... ROLLUP(col1, col2, col3) |
|
3932 |
*/
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3933 |
if (Lex.current_select->linkage == GLOBAL_OPTIONS_TYPE) |
1
by brian
clean slate |
3934 |
{
|
3935 |
my_error(ER_WRONG_USAGE, MYF(0), "WITH ROLLUP", |
|
3936 |
"global union parameters"); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3937 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3938 |
}
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3939 |
Lex.current_select->olap= ROLLUP_TYPE; |
1
by brian
clean slate |
3940 |
}
|
3941 |
;
|
|
3942 |
||
3943 |
/*
|
|
3944 |
Order by statement in ALTER TABLE |
|
3945 |
*/
|
|
3946 |
||
3947 |
alter_order_clause: |
|
3948 |
ORDER_SYM BY alter_order_list |
|
3949 |
;
|
|
3950 |
||
3951 |
alter_order_list: |
|
3952 |
alter_order_list ',' alter_order_item |
|
3953 |
| alter_order_item |
|
3954 |
;
|
|
3955 |
||
3956 |
alter_order_item: |
|
2114.4.8
by Brian Aker
Merge in additional parser encapsulation. |
3957 |
simple_ident order_dir |
1
by brian
clean slate |
3958 |
{
|
3959 |
bool ascending= ($2 == 1) ? true : false; |
|
2029.1.15
by Brian Aker
Remove useless copy. |
3960 |
if (YYSession->add_order_to_list($1, ascending)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3961 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3962 |
}
|
3963 |
;
|
|
3964 |
||
3965 |
/*
|
|
3966 |
Order by statement in select |
|
3967 |
*/
|
|
3968 |
||
3969 |
opt_order_clause: |
|
3970 |
/* empty */ |
|
3971 |
| order_clause |
|
3972 |
;
|
|
3973 |
||
3974 |
order_clause: |
|
3975 |
ORDER_SYM BY |
|
3976 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
3977 |
if (not parser::buildOrderBy(&Lex)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
3978 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
3979 |
}
|
3980 |
order_list
|
|
3981 |
;
|
|
3982 |
||
3983 |
order_list: |
|
3984 |
order_list ',' order_ident order_dir |
|
2104.3.4
by Brian Aker
Encapsulate from parser buildOrderBy() |
3985 |
{
|
3986 |
if (YYSession->add_order_to_list($3,(bool) $4)) |
|
3987 |
DRIZZLE_YYABORT; |
|
3988 |
}
|
|
1
by brian
clean slate |
3989 |
| order_ident order_dir |
2104.3.4
by Brian Aker
Encapsulate from parser buildOrderBy() |
3990 |
{
|
3991 |
if (YYSession->add_order_to_list($1,(bool) $2)) |
|
3992 |
DRIZZLE_YYABORT; |
|
3993 |
}
|
|
1
by brian
clean slate |
3994 |
;
|
3995 |
||
3996 |
order_dir: |
|
3997 |
/* empty */ { $$ = 1; } |
|
3998 |
| ASC { $$ =1; } |
|
3999 |
| DESC { $$ =0; } |
|
4000 |
;
|
|
4001 |
||
4002 |
opt_limit_clause_init: |
|
4003 |
/* empty */ |
|
4004 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4005 |
Select_Lex *sel= Lex.current_select; |
1
by brian
clean slate |
4006 |
sel->offset_limit= 0; |
4007 |
sel->select_limit= 0; |
|
4008 |
}
|
|
4009 |
| limit_clause {} |
|
4010 |
;
|
|
4011 |
||
4012 |
opt_limit_clause: |
|
4013 |
/* empty */ {} |
|
4014 |
| limit_clause {} |
|
4015 |
;
|
|
4016 |
||
4017 |
limit_clause: |
|
4018 |
LIMIT limit_options {} |
|
4019 |
;
|
|
4020 |
||
4021 |
limit_options: |
|
4022 |
limit_option
|
|
4023 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4024 |
Select_Lex *sel= Lex.current_select; |
1
by brian
clean slate |
4025 |
sel->select_limit= $1; |
4026 |
sel->offset_limit= 0; |
|
4027 |
sel->explicit_limit= 1; |
|
4028 |
}
|
|
4029 |
| limit_option ',' limit_option |
|
4030 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4031 |
Select_Lex *sel= Lex.current_select; |
1
by brian
clean slate |
4032 |
sel->select_limit= $3; |
4033 |
sel->offset_limit= $1; |
|
4034 |
sel->explicit_limit= 1; |
|
4035 |
}
|
|
4036 |
| limit_option OFFSET_SYM limit_option |
|
4037 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4038 |
Select_Lex *sel= Lex.current_select; |
1
by brian
clean slate |
4039 |
sel->select_limit= $1; |
4040 |
sel->offset_limit= $3; |
|
4041 |
sel->explicit_limit= 1; |
|
4042 |
}
|
|
4043 |
;
|
|
4044 |
||
4045 |
limit_option: |
|
177.1.5
by brian
Removed dead ? operator. |
4046 |
ULONGLONG_NUM { $$= new Item_uint($1.str, $1.length); } |
1
by brian
clean slate |
4047 |
| LONG_NUM { $$= new Item_uint($1.str, $1.length); } |
4048 |
| NUM { $$= new Item_uint($1.str, $1.length); } |
|
4049 |
;
|
|
4050 |
||
4051 |
delete_limit_clause: |
|
4052 |
/* empty */ |
|
4053 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4054 |
Lex.current_select->select_limit= 0; |
1
by brian
clean slate |
4055 |
}
|
4056 |
| LIMIT limit_option |
|
4057 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4058 |
Select_Lex *sel= Lex.current_select; |
1
by brian
clean slate |
4059 |
sel->select_limit= $2; |
4060 |
sel->explicit_limit= 1; |
|
4061 |
}
|
|
4062 |
;
|
|
4063 |
||
4064 |
ulong_num: |
|
2104.3.1
by Brian Aker
Merge in ulong typedef used. |
4065 |
NUM { int error; $$= (unsigned long) internal::my_strtoll10($1.str, (char**) 0, &error); } |
4066 |
| HEX_NUM { $$= (unsigned long) strtol($1.str, (char**) 0, 16); } |
|
4067 |
| LONG_NUM { int error; $$= (unsigned long) internal::my_strtoll10($1.str, (char**) 0, &error); } |
|
4068 |
| ULONGLONG_NUM { int error; $$= (unsigned long) internal::my_strtoll10($1.str, (char**) 0, &error); } |
|
4069 |
| DECIMAL_NUM { int error; $$= (unsigned long) internal::my_strtoll10($1.str, (char**) 0, &error); } |
|
4070 |
| FLOAT_NUM { int error; $$= (unsigned long) internal::my_strtoll10($1.str, (char**) 0, &error); } |
|
1
by brian
clean slate |
4071 |
;
|
4072 |
||
4073 |
ulonglong_num: |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
4074 |
NUM { int error; $$= (uint64_t) internal::my_strtoll10($1.str, (char**) 0, &error); } |
4075 |
| ULONGLONG_NUM { int error; $$= (uint64_t) internal::my_strtoll10($1.str, (char**) 0, &error); } |
|
4076 |
| LONG_NUM { int error; $$= (uint64_t) internal::my_strtoll10($1.str, (char**) 0, &error); } |
|
4077 |
| DECIMAL_NUM { int error; $$= (uint64_t) internal::my_strtoll10($1.str, (char**) 0, &error); } |
|
4078 |
| FLOAT_NUM { int error; $$= (uint64_t) internal::my_strtoll10($1.str, (char**) 0, &error); } |
|
1
by brian
clean slate |
4079 |
;
|
4080 |
||
4081 |
select_var_list_init: |
|
4082 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4083 |
if (not Lex.describe && (not (Lex.result= new select_dumpvar()))) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4084 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4085 |
}
|
4086 |
select_var_list
|
|
4087 |
{}
|
|
4088 |
;
|
|
4089 |
||
4090 |
select_var_list: |
|
4091 |
select_var_list ',' select_var_ident |
|
4092 |
| select_var_ident {} |
|
4093 |
;
|
|
4094 |
||
2227.4.10
by Olaf van der Spek
Session::lex() |
4095 |
select_var_ident: |
2029.1.26
by Brian Aker
Merge in work for reserved words in SQL standard. |
4096 |
'@' user_variable_ident |
1
by brian
clean slate |
4097 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4098 |
if (Lex.result) |
2029.1.26
by Brian Aker
Merge in work for reserved words in SQL standard. |
4099 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4100 |
((select_dumpvar *)Lex.result)->var_list.push_back( new var($2,0,0,(enum_field_types)0)); |
2029.1.26
by Brian Aker
Merge in work for reserved words in SQL standard. |
4101 |
}
|
1
by brian
clean slate |
4102 |
else
|
2029.1.26
by Brian Aker
Merge in work for reserved words in SQL standard. |
4103 |
{
|
1
by brian
clean slate |
4104 |
/*
|
4105 |
The parser won't create select_result instance only |
|
4106 |
if it's an EXPLAIN. |
|
4107 |
*/
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4108 |
assert(Lex.describe); |
2029.1.26
by Brian Aker
Merge in work for reserved words in SQL standard. |
4109 |
}
|
1
by brian
clean slate |
4110 |
}
|
4111 |
;
|
|
4112 |
||
4113 |
into: |
|
4114 |
INTO
|
|
736
by Brian Aker
Remove dead variables. |
4115 |
{ } |
1
by brian
clean slate |
4116 |
into_destination
|
4117 |
;
|
|
4118 |
||
4119 |
into_destination: |
|
4120 |
OUTFILE TEXT_STRING_filesystem |
|
4121 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4122 |
Lex.setCacheable(false); |
4123 |
if (!(Lex.exchange= new file_exchange($2.str, 0)) || |
|
4124 |
!(Lex.result= new select_export(Lex.exchange))) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4125 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4126 |
}
|
4127 |
opt_field_term opt_line_term |
|
4128 |
| DUMPFILE TEXT_STRING_filesystem |
|
4129 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4130 |
if (not Lex.describe) |
1
by brian
clean slate |
4131 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4132 |
Lex.setCacheable(false); |
4133 |
if (not (Lex.exchange= new file_exchange($2.str,1))) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4134 |
DRIZZLE_YYABORT; |
2227.4.10
by Olaf van der Spek
Session::lex() |
4135 |
if (not (Lex.result= new select_dump(Lex.exchange))) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4136 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4137 |
}
|
4138 |
}
|
|
4139 |
| select_var_list_init |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4140 |
{Lex.setCacheable(false);} |
1
by brian
clean slate |
4141 |
;
|
4142 |
||
4143 |
/*
|
|
4144 |
Drop : delete tables or index or user |
|
4145 |
*/
|
|
4146 |
||
4147 |
drop: |
|
2073.1.2
by Brian Aker
Basic DDL for catalog. |
4148 |
DROP CATALOG_SYM catalog_name |
4149 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4150 |
Lex.statement= new statement::catalog::Drop(YYSession, $3); |
2073.1.2
by Brian Aker
Basic DDL for catalog. |
4151 |
}
|
4152 |
| DROP opt_temporary table_or_tables if_exists table_list |
|
1
by brian
clean slate |
4153 |
{
|
2029.1.18
by Brian Aker
Rely on the try/catch above the parser to handle the unlikely case of a |
4154 |
statement::DropTable *statement= new statement::DropTable(YYSession); |
2227.4.10
by Olaf van der Spek
Session::lex() |
4155 |
Lex.statement= statement; |
1128.2.10
by Brian Aker
A number of changes for LEx -> CreateTable |
4156 |
statement->drop_temporary= $2; |
4157 |
statement->drop_if_exists= $4; |
|
1
by brian
clean slate |
4158 |
}
|
4159 |
| DROP build_method INDEX_SYM ident ON table_ident {} |
|
4160 |
{
|
|
2029.1.18
by Brian Aker
Rely on the try/catch above the parser to handle the unlikely case of a |
4161 |
statement::DropIndex *statement= new statement::DropIndex(YYSession); |
2227.4.10
by Olaf van der Spek
Session::lex() |
4162 |
Lex.statement= statement; |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
4163 |
statement->alter_info.flags.set(ALTER_DROP_INDEX); |
2200.2.20
by Stewart Smith
remove drop_list from AlterInfo - is now only in the message::AlterTable protobuf message |
4164 |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4165 |
if (not Lex.current_select->add_table_to_list(Lex.session, $6, NULL, |
2029.1.17
by Brian Aker
Last of Lex remove. |
4166 |
TL_OPTION_UPDATING)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4167 |
DRIZZLE_YYABORT; |
2200.2.18
by Stewart Smith
add fields, indexes and foreign keys to drop in ALTER TABLE DROP and DROP INDEX to the AlterTable protobuf message in parser |
4168 |
|
4169 |
message::AlterTable::AlterTableOperation *operation; |
|
2200.2.25
by Stewart Smith
Merge refactoring of default values work |
4170 |
operation= Lex.alter_table()->add_operations(); |
2200.2.18
by Stewart Smith
add fields, indexes and foreign keys to drop in ALTER TABLE DROP and DROP INDEX to the AlterTable protobuf message in parser |
4171 |
operation->set_operation(message::AlterTable::AlterTableOperation::DROP_KEY); |
4172 |
operation->set_drop_name($4.str); |
|
4173 |
||
1
by brian
clean slate |
4174 |
}
|
2060.2.5
by Brian Aker
Adjust name, we aren't really return an ident, it is just a name. |
4175 |
| DROP DATABASE if_exists schema_name |
1
by brian
clean slate |
4176 |
{
|
2029.1.18
by Brian Aker
Rely on the try/catch above the parser to handle the unlikely case of a |
4177 |
statement::DropSchema *statement= new statement::DropSchema(YYSession); |
2227.4.10
by Olaf van der Spek
Session::lex() |
4178 |
Lex.statement= statement; |
1128.2.10
by Brian Aker
A number of changes for LEx -> CreateTable |
4179 |
statement->drop_if_exists=$3; |
2227.4.10
by Olaf van der Spek
Session::lex() |
4180 |
Lex.name= $4; |
1
by brian
clean slate |
4181 |
}
|
2060.2.3
by Brian Aker
Clarify schema_ident definition. |
4182 |
;
|
4183 |
||
1
by brian
clean slate |
4184 |
table_list: |
4185 |
table_name
|
|
4186 |
| table_list ',' table_name |
|
4187 |
;
|
|
4188 |
||
4189 |
table_name: |
|
4190 |
table_ident
|
|
4191 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4192 |
if (!Lex.current_select->add_table_to_list(YYSession, $1, NULL, TL_OPTION_UPDATING)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4193 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4194 |
}
|
4195 |
;
|
|
4196 |
||
4197 |
if_exists: |
|
2029.1.12
by Brian Aker
Merge in boolean type that has been added to the parser. |
4198 |
/* empty */ { $$= false; } |
4199 |
| IF EXISTS { $$= true; } |
|
1
by brian
clean slate |
4200 |
;
|
4201 |
||
4202 |
opt_temporary: |
|
2029.1.12
by Brian Aker
Merge in boolean type that has been added to the parser. |
4203 |
/* empty */ { $$= false; } |
4204 |
| TEMPORARY_SYM { $$= true; } |
|
1
by brian
clean slate |
4205 |
;
|
1835.1.6
by Brian Aker
This patch returns dynamic SQL into the core (through SQL-Server syntax). |
4206 |
|
4207 |
/*
|
|
4208 |
Execute a string as dynamic SQL. |
|
2029.1.12
by Brian Aker
Merge in boolean type that has been added to the parser. |
4209 |
*/
|
1835.1.6
by Brian Aker
This patch returns dynamic SQL into the core (through SQL-Server syntax). |
4210 |
|
4211 |
execute: |
|
1958.1.1
by Brian Aker
Fix clash in parser with wait(). |
4212 |
EXECUTE_SYM execute_var_or_string opt_status opt_concurrent opt_wait |
2029.1.18
by Brian Aker
Rely on the try/catch above the parser to handle the unlikely case of a |
4213 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4214 |
Lex.statement= new statement::Execute(YYSession, $2, $3, $4, $5); |
2029.1.18
by Brian Aker
Rely on the try/catch above the parser to handle the unlikely case of a |
4215 |
}
|
1835.1.6
by Brian Aker
This patch returns dynamic SQL into the core (through SQL-Server syntax). |
4216 |
|
4217 |
||
4218 |
execute_var_or_string: |
|
2029.1.26
by Brian Aker
Merge in work for reserved words in SQL standard. |
4219 |
user_variable_ident
|
1835.1.6
by Brian Aker
This patch returns dynamic SQL into the core (through SQL-Server syntax). |
4220 |
{
|
1921.4.4
by Brian Aker
Fix for Solaris. |
4221 |
$$.set($1); |
1835.1.6
by Brian Aker
This patch returns dynamic SQL into the core (through SQL-Server syntax). |
4222 |
}
|
2029.1.26
by Brian Aker
Merge in work for reserved words in SQL standard. |
4223 |
| '@' user_variable_ident |
1835.1.6
by Brian Aker
This patch returns dynamic SQL into the core (through SQL-Server syntax). |
4224 |
{
|
1921.4.4
by Brian Aker
Fix for Solaris. |
4225 |
$$.set($2, true); |
1835.1.6
by Brian Aker
This patch returns dynamic SQL into the core (through SQL-Server syntax). |
4226 |
}
|
4227 |
||
1921.4.1
by Brian Aker
Adding in support for EXECUTE to have WITH NO RETURN. |
4228 |
opt_status: |
2029.1.12
by Brian Aker
Merge in boolean type that has been added to the parser. |
4229 |
/* empty */ { $$= false; } |
4230 |
| WITH NO_SYM RETURN_SYM { $$= true; } |
|
1921.4.1
by Brian Aker
Adding in support for EXECUTE to have WITH NO RETURN. |
4231 |
;
|
4232 |
||
1921.4.2
by Brian Aker
Adding in concurrent execute support. |
4233 |
opt_concurrent: |
2029.1.12
by Brian Aker
Merge in boolean type that has been added to the parser. |
4234 |
/* empty */ { $$= false; } |
4235 |
| CONCURRENT { $$= true; } |
|
1921.4.2
by Brian Aker
Adding in concurrent execute support. |
4236 |
;
|
4237 |
||
1958.1.1
by Brian Aker
Fix clash in parser with wait(). |
4238 |
opt_wait: |
2029.1.12
by Brian Aker
Merge in boolean type that has been added to the parser. |
4239 |
/* empty */ { $$= false; } |
4240 |
| WAIT_SYM { $$= true; } |
|
1958.1.1
by Brian Aker
Fix clash in parser with wait(). |
4241 |
;
|
4242 |
||
1
by brian
clean slate |
4243 |
/*
|
4244 |
** Insert : add new data to table |
|
4245 |
*/
|
|
4246 |
||
4247 |
insert: |
|
4248 |
INSERT
|
|
4249 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4250 |
Lex.statement= new statement::Insert(YYSession); |
4251 |
Lex.duplicates= DUP_ERROR; |
|
4252 |
init_select(&Lex); |
|
1
by brian
clean slate |
4253 |
/* for subselects */ |
2227.4.10
by Olaf van der Spek
Session::lex() |
4254 |
Lex.lock_option= TL_READ; |
1
by brian
clean slate |
4255 |
}
|
4256 |
opt_ignore insert2 |
|
4257 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4258 |
Lex.current_select->set_lock_for_tables(TL_WRITE_CONCURRENT_INSERT); |
4259 |
Lex.current_select= &Lex.select_lex; |
|
1
by brian
clean slate |
4260 |
}
|
4261 |
insert_field_spec opt_insert_update |
|
4262 |
{}
|
|
4263 |
;
|
|
4264 |
||
4265 |
replace: |
|
4266 |
REPLACE
|
|
4267 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4268 |
Lex.statement= new statement::Replace(YYSession); |
4269 |
Lex.duplicates= DUP_REPLACE; |
|
4270 |
init_select(&Lex); |
|
1
by brian
clean slate |
4271 |
}
|
1008.1.2
by Brian Aker
Removed old DELAYED keyword from parser (plus cleaned up tests). Also |
4272 |
insert2
|
1
by brian
clean slate |
4273 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4274 |
Lex.current_select->set_lock_for_tables(TL_WRITE_DEFAULT); |
4275 |
Lex.current_select= &Lex.select_lex; |
|
1
by brian
clean slate |
4276 |
}
|
4277 |
insert_field_spec
|
|
4278 |
{}
|
|
4279 |
;
|
|
4280 |
||
4281 |
insert2: |
|
4282 |
INTO insert_table {} |
|
4283 |
| insert_table {} |
|
4284 |
;
|
|
4285 |
||
4286 |
insert_table: |
|
4287 |
table_name
|
|
4288 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4289 |
Lex.field_list.clear(); |
4290 |
Lex.many_values.clear(); |
|
4291 |
Lex.insert_list=0; |
|
1
by brian
clean slate |
4292 |
};
|
4293 |
||
4294 |
insert_field_spec: |
|
4295 |
insert_values {} |
|
4296 |
| '(' ')' insert_values {} |
|
4297 |
| '(' fields ')' insert_values {} |
|
2030.1.1
by Brian Aker
Small set of symbol updates. |
4298 |
| SET_SYM |
1
by brian
clean slate |
4299 |
{
|
2241.2.11
by Olaf van der Spek
Refactor |
4300 |
Lex.insert_list = new List_item; |
4301 |
Lex.many_values.push_back(Lex.insert_list); |
|
1
by brian
clean slate |
4302 |
}
|
4303 |
ident_eq_list
|
|
4304 |
;
|
|
4305 |
||
4306 |
fields: |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4307 |
fields ',' insert_ident { Lex.field_list.push_back($3); } |
4308 |
| insert_ident { Lex.field_list.push_back($1); } |
|
1
by brian
clean slate |
4309 |
;
|
4310 |
||
4311 |
insert_values: |
|
4312 |
VALUES values_list {} |
|
4313 |
| VALUE_SYM values_list {} |
|
2029.1.8
by Brian Aker
Cleanup naming. |
4314 |
| stored_select |
4315 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4316 |
Lex.current_select->set_braces(0); |
2029.1.8
by Brian Aker
Cleanup naming. |
4317 |
}
|
1
by brian
clean slate |
4318 |
union_clause {} |
2029.1.8
by Brian Aker
Cleanup naming. |
4319 |
| '(' stored_select ')' |
4320 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4321 |
Lex.current_select->set_braces(1); |
2029.1.8
by Brian Aker
Cleanup naming. |
4322 |
}
|
1
by brian
clean slate |
4323 |
union_opt {} |
4324 |
;
|
|
4325 |
||
4326 |
values_list: |
|
4327 |
values_list ',' no_braces |
|
4328 |
| no_braces |
|
4329 |
;
|
|
4330 |
||
4331 |
ident_eq_list: |
|
4332 |
ident_eq_list ',' ident_eq_value |
|
4333 |
| ident_eq_value |
|
4334 |
;
|
|
4335 |
||
4336 |
ident_eq_value: |
|
2114.4.8
by Brian Aker
Merge in additional parser encapsulation. |
4337 |
simple_ident equal expr_or_default |
1
by brian
clean slate |
4338 |
{
|
2241.2.11
by Olaf van der Spek
Refactor |
4339 |
Lex.field_list.push_back($1); |
4340 |
Lex.insert_list->push_back($3); |
|
1
by brian
clean slate |
4341 |
}
|
4342 |
;
|
|
4343 |
||
4344 |
equal: |
|
2172.3.16
by Brian Aker
Remove greedy use = for table alias allowance. |
4345 |
'=' {} |
1
by brian
clean slate |
4346 |
| SET_VAR {} |
4347 |
;
|
|
4348 |
||
4349 |
opt_equal: |
|
4350 |
/* empty */ {} |
|
2239.4.2
by Brian Aker
Fix issue where the wrong sort of "=" could be used in some cases. |
4351 |
| '=' {} |
1
by brian
clean slate |
4352 |
;
|
4353 |
||
4354 |
no_braces: |
|
4355 |
'('
|
|
4356 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4357 |
if (!(Lex.insert_list = new List_item)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4358 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4359 |
}
|
4360 |
opt_values ')' |
|
4361 |
{
|
|
2241.2.11
by Olaf van der Spek
Refactor |
4362 |
Lex.many_values.push_back(Lex.insert_list); |
1
by brian
clean slate |
4363 |
}
|
4364 |
;
|
|
4365 |
||
4366 |
opt_values: |
|
4367 |
/* empty */ {} |
|
4368 |
| values |
|
4369 |
;
|
|
4370 |
||
4371 |
values: |
|
4372 |
values ',' expr_or_default |
|
4373 |
{
|
|
2241.2.11
by Olaf van der Spek
Refactor |
4374 |
Lex.insert_list->push_back($3); |
1
by brian
clean slate |
4375 |
}
|
4376 |
| expr_or_default |
|
4377 |
{
|
|
2241.2.11
by Olaf van der Spek
Refactor |
4378 |
Lex.insert_list->push_back($1); |
1
by brian
clean slate |
4379 |
}
|
4380 |
;
|
|
4381 |
||
4382 |
expr_or_default: |
|
4383 |
expr { $$= $1;} |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4384 |
| DEFAULT {$$= new Item_default_value(Lex.current_context()); } |
1
by brian
clean slate |
4385 |
;
|
4386 |
||
4387 |
opt_insert_update: |
|
4388 |
/* empty */ |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4389 |
| ON DUPLICATE_SYM { Lex.duplicates= DUP_UPDATE; } |
1
by brian
clean slate |
4390 |
KEY_SYM UPDATE_SYM insert_update_list |
4391 |
;
|
|
4392 |
||
4393 |
/* Update rows in a table */ |
|
4394 |
||
4395 |
update: |
|
2172.3.20
by Brian Aker
Merge in UPDATE |
4396 |
UPDATE_SYM opt_ignore table_ident SET_SYM update_list |
1
by brian
clean slate |
4397 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4398 |
init_select(&Lex); |
4399 |
Lex.statement= new statement::Update(YYSession); |
|
4400 |
Lex.lock_option= TL_UNLOCK; /* Will be set later */ |
|
4401 |
Lex.duplicates= DUP_ERROR; |
|
4402 |
if (not Lex.select_lex.add_table_to_list(YYSession, $3, NULL,0)) |
|
1108.1.2
by Brian Aker
Removal multi-update/delete |
4403 |
DRIZZLE_YYABORT; |
2172.3.20
by Brian Aker
Merge in UPDATE |
4404 |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4405 |
if (Lex.select_lex.get_table_list()->derived) |
1
by brian
clean slate |
4406 |
{
|
4407 |
/* it is single table update and it is update of derived table */ |
|
4408 |
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4409 |
Lex.select_lex.get_table_list()->alias, "UPDATE"); |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4410 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4411 |
}
|
4412 |
/*
|
|
4413 |
In case of multi-update setting write lock for all tables may |
|
4414 |
be too pessimistic. We will decrease lock level if possible in |
|
2026.2.1
by Monty Taylor
Renamed things prefixed mysql_ or mysqld_ |
4415 |
multi_update(). |
1
by brian
clean slate |
4416 |
*/
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4417 |
Lex.current_select->set_lock_for_tables(TL_WRITE_DEFAULT); |
1
by brian
clean slate |
4418 |
}
|
4419 |
where_clause opt_order_clause delete_limit_clause {} |
|
4420 |
;
|
|
4421 |
||
4422 |
update_list: |
|
4423 |
update_list ',' update_elem |
|
4424 |
| update_elem |
|
4425 |
;
|
|
4426 |
||
4427 |
update_elem: |
|
2114.4.8
by Brian Aker
Merge in additional parser encapsulation. |
4428 |
simple_ident equal expr_or_default |
1
by brian
clean slate |
4429 |
{
|
838
by Brian Aker
More class adoption/method |
4430 |
if (YYSession->add_item_to_list($1) || YYSession->add_value_to_list($3)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4431 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4432 |
}
|
4433 |
;
|
|
4434 |
||
4435 |
insert_update_list: |
|
4436 |
insert_update_list ',' insert_update_elem |
|
4437 |
| insert_update_elem |
|
4438 |
;
|
|
4439 |
||
4440 |
insert_update_elem: |
|
2114.4.8
by Brian Aker
Merge in additional parser encapsulation. |
4441 |
simple_ident equal expr_or_default |
1
by brian
clean slate |
4442 |
{
|
2241.2.11
by Olaf van der Spek
Refactor |
4443 |
Lex.update_list.push_back($1); |
4444 |
Lex.value_list.push_back($3); |
|
1
by brian
clean slate |
4445 |
}
|
4446 |
;
|
|
4447 |
||
4448 |
/* Delete rows from a table */ |
|
4449 |
||
4450 |
delete: |
|
2172.3.19
by Brian Aker
Refactor DELETE so that it is a simple statement. |
4451 |
DELETE_SYM opt_delete_option FROM table_ident |
1
by brian
clean slate |
4452 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4453 |
Lex.statement= new statement::Delete(YYSession); |
4454 |
init_select(&Lex); |
|
4455 |
Lex.lock_option= TL_WRITE_DEFAULT; |
|
4456 |
Lex.select_lex.init_order(); |
|
2241.2.11
by Olaf van der Spek
Refactor |
4457 |
Lex.current_select->add_table_to_list(YYSession, $4, NULL, TL_OPTION_UPDATING, Lex.lock_option); |
1
by brian
clean slate |
4458 |
}
|
4459 |
where_clause opt_order_clause |
|
4460 |
delete_limit_clause {} |
|
4461 |
;
|
|
4462 |
||
4463 |
opt_delete_option: |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4464 |
/* empty */ { Lex.ignore= 0; } |
4465 |
| IGNORE_SYM { Lex.ignore= 1; } |
|
1
by brian
clean slate |
4466 |
;
|
4467 |
||
4468 |
truncate: |
|
4469 |
TRUNCATE_SYM opt_table_sym table_name |
|
4470 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4471 |
Lex.statement= new statement::Truncate(YYSession); |
4472 |
Lex.select_lex.options= 0; |
|
4473 |
Lex.select_lex.init_order(); |
|
1
by brian
clean slate |
4474 |
}
|
4475 |
;
|
|
4476 |
||
4477 |
opt_table_sym: |
|
4478 |
/* empty */ |
|
4479 |
| TABLE_SYM |
|
4480 |
;
|
|
4481 |
||
4482 |
/* Show things */ |
|
4483 |
||
4484 |
show: |
|
4485 |
SHOW
|
|
4486 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4487 |
Lex.lock_option= TL_READ; |
4488 |
init_select(&Lex); |
|
4489 |
Lex.current_select->parsing_place= SELECT_LIST; |
|
1
by brian
clean slate |
4490 |
}
|
4491 |
show_param
|
|
4492 |
{}
|
|
4493 |
;
|
|
4494 |
||
1878.5.4
by Brian Aker
Update documentation. |
4495 |
/* SHOW SCHEMAS */ |
1
by brian
clean slate |
4496 |
show_param: |
327.2.5
by Brian Aker
Refactoring show command |
4497 |
DATABASES show_wild |
1
by brian
clean slate |
4498 |
{
|
2096.1.9
by Brian Aker
Merge in additional show. |
4499 |
if (not show::buildScemas(YYSession)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4500 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4501 |
}
|
1878.5.4
by Brian Aker
Update documentation. |
4502 |
/* SHOW TABLES */ |
1273.13.37
by Brian Aker
Remove "full" syntax. |
4503 |
| TABLES opt_db show_wild |
1
by brian
clean slate |
4504 |
{
|
2096.1.10
by Brian Aker
More shuffle of show into functions. |
4505 |
if (not show::buildTables(YYSession, $2)) |
4506 |
DRIZZLE_YYABORT; |
|
1
by brian
clean slate |
4507 |
}
|
1878.5.4
by Brian Aker
Update documentation. |
4508 |
/* SHOW TEMPORARY TABLES */ |
1429.1.2
by Brian Aker
Update for show temporary tables; |
4509 |
| TEMPORARY_SYM TABLES show_wild |
4510 |
{
|
|
2096.1.10
by Brian Aker
More shuffle of show into functions. |
4511 |
if (not show::buildTemporaryTables(YYSession)) |
4512 |
DRIZZLE_YYABORT; |
|
1429.1.2
by Brian Aker
Update for show temporary tables; |
4513 |
}
|
1878.5.4
by Brian Aker
Update documentation. |
4514 |
/* SHOW TABLE STATUS */ |
327.2.5
by Brian Aker
Refactoring show command |
4515 |
| TABLE_SYM STATUS_SYM opt_db show_wild |
1
by brian
clean slate |
4516 |
{
|
2096.1.10
by Brian Aker
More shuffle of show into functions. |
4517 |
if (not show::buildTableStatus(YYSession, $3)) |
4518 |
DRIZZLE_YYABORT; |
|
1
by brian
clean slate |
4519 |
}
|
1878.5.4
by Brian Aker
Update documentation. |
4520 |
/* SHOW COLUMNS FROM table_name */ |
1273.13.37
by Brian Aker
Remove "full" syntax. |
4521 |
| COLUMNS from_or_in table_ident opt_db show_wild |
2096.1.12
by Brian Aker
Additional show to functions. |
4522 |
{
|
4523 |
if (not show::buildColumns(YYSession, $4, $3)) |
|
4524 |
DRIZZLE_YYABORT; |
|
4525 |
}
|
|
1878.5.4
by Brian Aker
Update documentation. |
4526 |
/* SHOW INDEXES from table */ |
1
by brian
clean slate |
4527 |
| keys_or_index from_or_in table_ident opt_db where_clause |
2096.1.12
by Brian Aker
Additional show to functions. |
4528 |
{
|
4529 |
if (not show::buildIndex(YYSession, $4, $3)) |
|
4530 |
DRIZZLE_YYABORT; |
|
4531 |
}
|
|
1
by brian
clean slate |
4532 |
| COUNT_SYM '(' '*' ')' WARNINGS |
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
4533 |
{
|
2137.1.12
by Brian Aker
Remove current_session in building the error count. |
4534 |
show::buildSelectWarning(YYSession); |
1100.3.3
by Padraig O'Sullivan
Forgot one of the SHOW commands that I should have included in the last |
4535 |
}
|
1
by brian
clean slate |
4536 |
| COUNT_SYM '(' '*' ')' ERRORS |
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
4537 |
{
|
2137.1.12
by Brian Aker
Remove current_session in building the error count. |
4538 |
show::buildSelectError(YYSession); |
1100.3.3
by Padraig O'Sullivan
Forgot one of the SHOW commands that I should have included in the last |
4539 |
}
|
1
by brian
clean slate |
4540 |
| WARNINGS opt_limit_clause_init |
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
4541 |
{
|
2137.1.12
by Brian Aker
Remove current_session in building the error count. |
4542 |
show::buildWarnings(YYSession); |
1100.3.10
by Padraig O'Sullivan
Extracted the SHOW WARNINGS command from the huge switch statement into its |
4543 |
}
|
1
by brian
clean slate |
4544 |
| ERRORS opt_limit_clause_init |
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
4545 |
{
|
2137.1.12
by Brian Aker
Remove current_session in building the error count. |
4546 |
show::buildErrors(YYSession); |
1100.3.11
by Padraig O'Sullivan
Extracted the SHOW ERRORS command into its own class and removed the |
4547 |
}
|
327.2.5
by Brian Aker
Refactoring show command |
4548 |
| opt_var_type STATUS_SYM show_wild |
2096.1.12
by Brian Aker
Additional show to functions. |
4549 |
{
|
4550 |
if (not show::buildStatus(YYSession, $1)) |
|
4551 |
DRIZZLE_YYABORT; |
|
4552 |
}
|
|
2131.3.1
by Andrew Hutchings
Add error telling the user to use data_dictionary for SHOW engine_name STATUS |
4553 |
| engine_option_value STATUS_SYM |
4554 |
{
|
|
4555 |
if (not show::buildEngineStatus(YYSession, $1)) |
|
4556 |
DRIZZLE_YYABORT; |
|
4557 |
}
|
|
1812.5.1
by Brian Aker
This removes the caller for show create table to be a derived table. |
4558 |
| CREATE TABLE_SYM table_ident |
2096.1.12
by Brian Aker
Additional show to functions. |
4559 |
{
|
4560 |
if (not show::buildCreateTable(YYSession, $3)) |
|
4561 |
DRIZZLE_YYABORT; |
|
4562 |
}
|
|
1279
by Brian Aker
Remove show engine status, and show open tables (which no longer applies in |
4563 |
| PROCESSLIST_SYM |
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
4564 |
{
|
2096.1.12
by Brian Aker
Additional show to functions. |
4565 |
if (not show::buildProcesslist(YYSession)) |
4566 |
DRIZZLE_YYABORT; |
|
1100.3.16
by Padraig O'Sullivan
Extracted the show processlist command into a class with its own |
4567 |
}
|
327.2.5
by Brian Aker
Refactoring show command |
4568 |
| opt_var_type VARIABLES show_wild |
2096.1.11
by Brian Aker
Additional show to function. |
4569 |
{
|
4570 |
if (not show::buildVariables(YYSession, $1)) |
|
4571 |
DRIZZLE_YYABORT; |
|
4572 |
}
|
|
1
by brian
clean slate |
4573 |
| CREATE DATABASE opt_if_not_exists ident |
2096.1.8
by Brian Aker
Move show create schema into function. |
4574 |
{
|
4575 |
if (not show::buildCreateSchema(YYSession, $4)) |
|
4576 |
DRIZZLE_YYABORT; |
|
4577 |
}
|
|
1
by brian
clean slate |
4578 |
|
4579 |
opt_db: |
|
4580 |
/* empty */ { $$= 0; } |
|
4581 |
| from_or_in ident { $$= $2.str; } |
|
4582 |
;
|
|
4583 |
||
4584 |
from_or_in: |
|
4585 |
FROM
|
|
4586 |
| IN_SYM |
|
4587 |
;
|
|
4588 |
||
327.2.5
by Brian Aker
Refactoring show command |
4589 |
show_wild: |
1
by brian
clean slate |
4590 |
/* empty */ |
4591 |
| LIKE TEXT_STRING_sys |
|
4592 |
{
|
|
2246.3.3
by Olaf van der Spek
new() doesn't return NULL |
4593 |
Lex.wild= new (YYSession->mem_root) String($2.str, $2.length, system_charset_info); |
1055.1.1
by Padraig O'Sullivan
Modified the show_wild rule to also support WHERE clauses. |
4594 |
}
|
4595 |
| WHERE expr |
|
4596 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4597 |
Lex.current_select->where= $2; |
1055.1.1
by Padraig O'Sullivan
Modified the show_wild rule to also support WHERE clauses. |
4598 |
if ($2) |
4599 |
$2->top_level_item(); |
|
1
by brian
clean slate |
4600 |
}
|
4601 |
;
|
|
4602 |
||
4603 |
/* A Oracle compatible synonym for show */ |
|
4604 |
describe: |
|
4605 |
describe_command table_ident |
|
4606 |
{
|
|
2096.1.7
by Brian Aker
Shrink parser code, push C out to function call. |
4607 |
if (not show::buildDescribe(YYSession, $2)) |
4608 |
{
|
|
4609 |
DRIZZLE_YYABORT; |
|
4610 |
}
|
|
1
by brian
clean slate |
4611 |
}
|
4612 |
opt_describe_column {} |
|
4613 |
| describe_command opt_extended_describe |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4614 |
{ Lex.describe|= DESCRIBE_NORMAL; } |
1
by brian
clean slate |
4615 |
select
|
4616 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4617 |
Lex.select_lex.options|= SELECT_DESCRIBE; |
1
by brian
clean slate |
4618 |
}
|
4619 |
;
|
|
4620 |
||
4621 |
describe_command: |
|
4622 |
DESC
|
|
4623 |
| DESCRIBE |
|
4624 |
;
|
|
4625 |
||
4626 |
opt_extended_describe: |
|
4627 |
/* empty */ {} |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4628 |
| EXTENDED_SYM { Lex.describe|= DESCRIBE_EXTENDED; } |
1
by brian
clean slate |
4629 |
;
|
4630 |
||
4631 |
opt_describe_column: |
|
4632 |
/* empty */ {} |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4633 |
| text_string { Lex.wild= $1; } |
1
by brian
clean slate |
4634 |
| ident |
4635 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4636 |
Lex.wild= new (YYSession->mem_root) String((const char*) $1.str, |
1
by brian
clean slate |
4637 |
$1.length, |
4638 |
system_charset_info); |
|
4639 |
}
|
|
4640 |
;
|
|
4641 |
||
4642 |
||
4643 |
/* flush things */ |
|
4644 |
||
4645 |
flush: |
|
383.1.26
by Brian Aker
Removed option for single command replication and have now left disable of |
4646 |
FLUSH_SYM
|
1
by brian
clean slate |
4647 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4648 |
Lex.statement= new statement::Flush(YYSession); |
1
by brian
clean slate |
4649 |
}
|
4650 |
flush_options
|
|
4651 |
{}
|
|
4652 |
;
|
|
4653 |
||
4654 |
flush_options: |
|
4655 |
flush_options ',' flush_option |
|
4656 |
| flush_option |
|
4657 |
;
|
|
4658 |
||
4659 |
flush_option: |
|
4660 |
table_or_tables
|
|
1315.2.17
by Stewart Smith
move FLUSH statement to use boolean values in statement::Flush instead of overloading Lex->type with REFRESH_STATUS and others. |
4661 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4662 |
statement::Flush *statement= (statement::Flush*)Lex.statement; |
1315.2.17
by Stewart Smith
move FLUSH statement to use boolean values in statement::Flush instead of overloading Lex->type with REFRESH_STATUS and others. |
4663 |
statement->setFlushTables(true); |
4664 |
}
|
|
1
by brian
clean slate |
4665 |
opt_table_list {} |
4666 |
| TABLES WITH READ_SYM LOCK_SYM |
|
1315.2.17
by Stewart Smith
move FLUSH statement to use boolean values in statement::Flush instead of overloading Lex->type with REFRESH_STATUS and others. |
4667 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4668 |
statement::Flush *statement= (statement::Flush*)Lex.statement; |
1315.2.17
by Stewart Smith
move FLUSH statement to use boolean values in statement::Flush instead of overloading Lex->type with REFRESH_STATUS and others. |
4669 |
statement->setFlushTablesWithReadLock(true); |
4670 |
}
|
|
1
by brian
clean slate |
4671 |
| LOGS_SYM |
1315.2.17
by Stewart Smith
move FLUSH statement to use boolean values in statement::Flush instead of overloading Lex->type with REFRESH_STATUS and others. |
4672 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4673 |
statement::Flush *statement= (statement::Flush*)Lex.statement; |
1315.2.17
by Stewart Smith
move FLUSH statement to use boolean values in statement::Flush instead of overloading Lex->type with REFRESH_STATUS and others. |
4674 |
statement->setFlushLog(true); |
4675 |
}
|
|
1
by brian
clean slate |
4676 |
| STATUS_SYM |
1315.2.17
by Stewart Smith
move FLUSH statement to use boolean values in statement::Flush instead of overloading Lex->type with REFRESH_STATUS and others. |
4677 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4678 |
statement::Flush *statement= (statement::Flush*)Lex.statement; |
1315.2.17
by Stewart Smith
move FLUSH statement to use boolean values in statement::Flush instead of overloading Lex->type with REFRESH_STATUS and others. |
4679 |
statement->setFlushStatus(true); |
4680 |
}
|
|
1900.3.1
by Andrew Hutchings
Add FLUSH GLOBAL STATUS; command |
4681 |
| GLOBAL_SYM STATUS_SYM |
4682 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4683 |
statement::Flush *statement= (statement::Flush*)Lex.statement; |
1900.3.1
by Andrew Hutchings
Add FLUSH GLOBAL STATUS; command |
4684 |
statement->setFlushGlobalStatus(true); |
4685 |
}
|
|
1
by brian
clean slate |
4686 |
;
|
4687 |
||
4688 |
opt_table_list: |
|
4689 |
/* empty */ {} |
|
4690 |
| table_list {} |
|
4691 |
;
|
|
4692 |
||
4693 |
/* kill threads */ |
|
4694 |
||
4695 |
kill: |
|
4696 |
KILL_SYM kill_option expr |
|
4697 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4698 |
Lex.statement= new statement::Kill(YYSession, $3, $2); |
1
by brian
clean slate |
4699 |
}
|
4700 |
;
|
|
4701 |
||
4702 |
kill_option: |
|
2029.1.14
by Brian Aker
Additional boolean |
4703 |
/* empty */ { $$= false; } |
4704 |
| CONNECTION_SYM { $$= false; } |
|
4705 |
| QUERY_SYM { $$= true; } |
|
1
by brian
clean slate |
4706 |
;
|
4707 |
||
4708 |
/* change database */ |
|
4709 |
||
4710 |
use: |
|
2060.2.5
by Brian Aker
Adjust name, we aren't really return an ident, it is just a name. |
4711 |
USE_SYM schema_name |
1
by brian
clean slate |
4712 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4713 |
Lex.statement= new statement::ChangeSchema(YYSession); |
4714 |
Lex.select_lex.db= $2.str; |
|
1
by brian
clean slate |
4715 |
}
|
4716 |
;
|
|
4717 |
||
4718 |
/* import, export of files */ |
|
4719 |
||
4720 |
load: |
|
266.1.23
by Monty Taylor
Removed load xml infile. Hope nobody liked it. Now the only thing we need xml.c |
4721 |
LOAD data_file |
1
by brian
clean slate |
4722 |
{
|
2029.1.18
by Brian Aker
Rely on the try/catch above the parser to handle the unlikely case of a |
4723 |
statement::Load *statement= new statement::Load(YYSession); |
2227.4.10
by Olaf van der Spek
Session::lex() |
4724 |
Lex.statement= statement; |
1128.2.11
by Brian Aker
More rework of Lex for "how tiny can she be..." |
4725 |
|
2029.1.15
by Brian Aker
Remove useless copy. |
4726 |
Lex_input_stream *lip= YYSession->m_lip; |
1128.2.11
by Brian Aker
More rework of Lex for "how tiny can she be..." |
4727 |
statement->fname_start= lip->get_ptr(); |
1
by brian
clean slate |
4728 |
}
|
919.1.1
by Brian Aker
Remove LOAD DATA "LOCAL" INFILE |
4729 |
load_data_lock INFILE TEXT_STRING_filesystem |
1
by brian
clean slate |
4730 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4731 |
Lex.lock_option= $4; |
4732 |
Lex.duplicates= DUP_ERROR; |
|
4733 |
Lex.ignore= 0; |
|
4734 |
if (not (Lex.exchange= new file_exchange($6.str, 0, $2))) |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4735 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
4736 |
}
|
4737 |
opt_duplicate INTO |
|
4738 |
{
|
|
2029.1.15
by Brian Aker
Remove useless copy. |
4739 |
Lex_input_stream *lip= YYSession->m_lip; |
2227.4.10
by Olaf van der Spek
Session::lex() |
4740 |
((statement::Load *)Lex.statement)->fname_end= lip->get_ptr(); |
1
by brian
clean slate |
4741 |
}
|
4742 |
TABLE_SYM table_ident |
|
4743 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4744 |
if (!Lex.current_select->add_table_to_list(YYSession, |
1101.2.2
by Monty Taylor
Removed the Select define in sql_yacc.yy. Bad general global define. |
4745 |
$12, NULL, TL_OPTION_UPDATING, |
2227.4.10
by Olaf van der Spek
Session::lex() |
4746 |
Lex.lock_option)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
4747 |
DRIZZLE_YYABORT; |
2227.4.10
by Olaf van der Spek
Session::lex() |
4748 |
Lex.field_list.clear(); |
4749 |
Lex.update_list.clear(); |
|
4750 |
Lex.value_list.clear(); |
|
1
by brian
clean slate |
4751 |
}
|
4752 |
opt_field_term opt_line_term opt_ignore_lines opt_field_or_var_spec |
|
4753 |
opt_load_data_set_spec
|
|
4754 |
{}
|
|
4755 |
;
|
|
4756 |
||
266.1.23
by Monty Taylor
Removed load xml infile. Hope nobody liked it. Now the only thing we need xml.c |
4757 |
data_file: |
4758 |
DATA_SYM { $$= FILETYPE_CSV; }; |
|
1
by brian
clean slate |
4759 |
|
4760 |
load_data_lock: |
|
4761 |
/* empty */ { $$= TL_WRITE_DEFAULT; } |
|
4762 |
| CONCURRENT |
|
4763 |
{
|
|
4764 |
$$= TL_WRITE_CONCURRENT_INSERT; |
|
4765 |
}
|
|
4766 |
;
|
|
4767 |
||
4768 |
opt_duplicate: |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4769 |
/* empty */ { Lex.duplicates=DUP_ERROR; } |
4770 |
| REPLACE { Lex.duplicates=DUP_REPLACE; } |
|
4771 |
| IGNORE_SYM { Lex.ignore= 1; } |
|
1
by brian
clean slate |
4772 |
;
|
4773 |
||
2029.1.6
by Brian Aker
Refactor create table into sections. |
4774 |
opt_duplicate_as: |
2227.4.10
by Olaf van der Spek
Session::lex() |
4775 |
/* empty */ { Lex.duplicates=DUP_ERROR; } |
4776 |
| AS { Lex.duplicates=DUP_ERROR; } |
|
4777 |
| REPLACE { Lex.duplicates=DUP_REPLACE; } |
|
4778 |
| IGNORE_SYM { Lex.ignore= true; } |
|
4779 |
| REPLACE AS { Lex.duplicates=DUP_REPLACE; } |
|
4780 |
| IGNORE_SYM AS { Lex.ignore= true; } |
|
2029.1.6
by Brian Aker
Refactor create table into sections. |
4781 |
;
|
4782 |
||
1
by brian
clean slate |
4783 |
opt_field_term: |
4784 |
/* empty */ |
|
4785 |
| COLUMNS field_term_list |
|
4786 |
;
|
|
4787 |
||
4788 |
field_term_list: |
|
4789 |
field_term_list field_term |
|
4790 |
| field_term |
|
4791 |
;
|
|
4792 |
||
4793 |
field_term: |
|
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
4794 |
TERMINATED BY text_string |
1
by brian
clean slate |
4795 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4796 |
assert(Lex.exchange != 0); |
4797 |
Lex.exchange->field_term= $3; |
|
1
by brian
clean slate |
4798 |
}
|
4799 |
| OPTIONALLY ENCLOSED BY text_string |
|
4800 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4801 |
assert(Lex.exchange != 0); |
4802 |
Lex.exchange->enclosed= $4; |
|
4803 |
Lex.exchange->opt_enclosed= 1; |
|
1
by brian
clean slate |
4804 |
}
|
4805 |
| ENCLOSED BY text_string |
|
4806 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4807 |
assert(Lex.exchange != 0); |
4808 |
Lex.exchange->enclosed= $3; |
|
1
by brian
clean slate |
4809 |
}
|
4810 |
| ESCAPED BY text_string |
|
4811 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4812 |
assert(Lex.exchange != 0); |
4813 |
Lex.exchange->escaped= $3; |
|
1
by brian
clean slate |
4814 |
}
|
4815 |
;
|
|
4816 |
||
4817 |
opt_line_term: |
|
4818 |
/* empty */ |
|
4819 |
| LINES line_term_list |
|
4820 |
;
|
|
4821 |
||
4822 |
line_term_list: |
|
4823 |
line_term_list line_term |
|
4824 |
| line_term |
|
4825 |
;
|
|
4826 |
||
4827 |
line_term: |
|
4828 |
TERMINATED BY text_string |
|
4829 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4830 |
assert(Lex.exchange != 0); |
4831 |
Lex.exchange->line_term= $3; |
|
1
by brian
clean slate |
4832 |
}
|
4833 |
| STARTING BY text_string |
|
4834 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4835 |
assert(Lex.exchange != 0); |
4836 |
Lex.exchange->line_start= $3; |
|
1
by brian
clean slate |
4837 |
}
|
4838 |
;
|
|
4839 |
||
4840 |
opt_ignore_lines: |
|
4841 |
/* empty */ |
|
4842 |
| IGNORE_SYM NUM lines_or_rows |
|
4843 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4844 |
assert(Lex.exchange != 0); |
4845 |
Lex.exchange->skip_lines= atol($2.str); |
|
1
by brian
clean slate |
4846 |
}
|
4847 |
;
|
|
4848 |
||
4849 |
lines_or_rows: |
|
4850 |
LINES { } |
|
4851 |
| ROWS_SYM { } |
|
4852 |
;
|
|
4853 |
||
4854 |
opt_field_or_var_spec: |
|
4855 |
/* empty */ {} |
|
4856 |
| '(' fields_or_vars ')' {} |
|
4857 |
| '(' ')' {} |
|
4858 |
;
|
|
4859 |
||
4860 |
fields_or_vars: |
|
4861 |
fields_or_vars ',' field_or_var |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
4862 |
{ Lex.field_list.push_back($3); } |
1
by brian
clean slate |
4863 |
| field_or_var |
2227.4.10
by Olaf van der Spek
Session::lex() |
4864 |
{ Lex.field_list.push_back($1); } |
1
by brian
clean slate |
4865 |
;
|
4866 |
||
4867 |
field_or_var: |
|
2114.4.8
by Brian Aker
Merge in additional parser encapsulation. |
4868 |
simple_ident {$$= $1;} |
2029.1.26
by Brian Aker
Merge in work for reserved words in SQL standard. |
4869 |
| '@' user_variable_ident |
1
by brian
clean slate |
4870 |
{ $$= new Item_user_var_as_out_param($2); } |
4871 |
;
|
|
4872 |
||
4873 |
opt_load_data_set_spec: |
|
4874 |
/* empty */ {} |
|
2030.1.1
by Brian Aker
Small set of symbol updates. |
4875 |
| SET_SYM insert_update_list {} |
1
by brian
clean slate |
4876 |
;
|
4877 |
||
4878 |
/* Common definitions */ |
|
4879 |
||
4880 |
text_literal: |
|
1022.1.3
by Brian Aker
Force UTF8 (remove the bits for looking for ascii). |
4881 |
TEXT_STRING_literal
|
4882 |
{
|
|
2029.1.15
by Brian Aker
Remove useless copy. |
4883 |
$$ = new Item_string($1.str, $1.length, YYSession->variables.getCollation()); |
1022.1.3
by Brian Aker
Force UTF8 (remove the bits for looking for ascii). |
4884 |
}
|
1
by brian
clean slate |
4885 |
| text_literal TEXT_STRING_literal |
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
4886 |
{
|
4887 |
((Item_string*) $1)->append($2.str, $2.length); |
|
1
by brian
clean slate |
4888 |
}
|
4889 |
;
|
|
4890 |
||
4891 |
text_string: |
|
4892 |
TEXT_STRING_literal
|
|
4893 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
4894 |
$$= new (YYSession->mem_root) String($1.str, |
1
by brian
clean slate |
4895 |
$1.length, |
748
by Brian Aker
Removal of client side collation. |
4896 |
YYSession->variables.getCollation()); |
1
by brian
clean slate |
4897 |
}
|
4898 |
| HEX_NUM |
|
4899 |
{
|
|
4900 |
Item *tmp= new Item_hex_string($1.str, $1.length); |
|
4901 |
/*
|
|
4902 |
it is OK only emulate fix_fields, because we need only |
|
4903 |
value of constant |
|
4904 |
*/
|
|
4905 |
$$= tmp ? |
|
4906 |
tmp->quick_fix_field(), tmp->val_str((String*) 0) : |
|
4907 |
(String*) 0; |
|
4908 |
}
|
|
4909 |
| BIN_NUM |
|
4910 |
{
|
|
4911 |
Item *tmp= new Item_bin_string($1.str, $1.length); |
|
4912 |
/*
|
|
4913 |
it is OK only emulate fix_fields, because we need only |
|
4914 |
value of constant |
|
4915 |
*/
|
|
4916 |
$$= tmp ? tmp->quick_fix_field(), tmp->val_str((String*) 0) : |
|
4917 |
(String*) 0; |
|
4918 |
}
|
|
4919 |
;
|
|
4920 |
||
4921 |
signed_literal: |
|
4922 |
literal { $$ = $1; } |
|
4923 |
| '+' NUM_literal { $$ = $2; } |
|
4924 |
| '-' NUM_literal |
|
4925 |
{
|
|
4926 |
$2->max_length++; |
|
4927 |
$$= $2->neg(); |
|
4928 |
}
|
|
4929 |
;
|
|
4930 |
||
4931 |
literal: |
|
4932 |
text_literal { $$ = $1; } |
|
4933 |
| NUM_literal { $$ = $1; } |
|
4934 |
| NULL_SYM |
|
4935 |
{
|
|
4936 |
$$ = new Item_null(); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
4937 |
YYSession->m_lip->next_state=MY_LEX_OPERATOR_OR_IDENT; |
1
by brian
clean slate |
4938 |
}
|
2035.1.2
by Brian Aker
Make the item call a bit friendlier. |
4939 |
| FALSE_SYM { $$= new drizzled::item::False(); } |
4940 |
| TRUE_SYM { $$= new drizzled::item::True(); } |
|
1
by brian
clean slate |
4941 |
| HEX_NUM { $$ = new Item_hex_string($1.str, $1.length);} |
4942 |
| BIN_NUM { $$= new Item_bin_string($1.str, $1.length); } |
|
4943 |
| DATE_SYM text_literal { $$ = $2; } |
|
1008.3.17
by Stewart Smith
Start work to construct table proto in parser: |
4944 |
| TIMESTAMP_SYM text_literal { $$ = $2; } |
1
by brian
clean slate |
4945 |
;
|
4946 |
||
2198.6.13
by Brian Aker
Merge fix such that default is better defined on numbers. |
4947 |
integer_literal: |
4948 |
text_literal { $$ = $1; } |
|
4949 |
| HEX_NUM { $$ = new Item_hex_string($1.str, $1.length);} |
|
4950 |
| BIN_NUM { $$= new Item_bin_string($1.str, $1.length); } |
|
4951 |
| NUM_literal { $$ = $1; } |
|
4952 |
| NULL_SYM |
|
4953 |
{
|
|
4954 |
$$ = new Item_null(); |
|
4955 |
YYSession->m_lip->next_state=MY_LEX_OPERATOR_OR_IDENT; |
|
4956 |
}
|
|
4957 |
| '+' NUM_literal { $$ = $2; } |
|
4958 |
| '-' NUM_literal |
|
4959 |
{
|
|
4960 |
$2->max_length++; |
|
4961 |
$$= $2->neg(); |
|
4962 |
}
|
|
4963 |
;
|
|
4964 |
||
2198.6.11
by Brian Aker
Have the parser enforce propper default values for boolean. |
4965 |
boolean_literal: |
4966 |
NULL_SYM
|
|
4967 |
{
|
|
4968 |
$$ = new Item_null(); |
|
4969 |
YYSession->m_lip->next_state=MY_LEX_OPERATOR_OR_IDENT; |
|
4970 |
}
|
|
4971 |
| FALSE_SYM |
|
4972 |
{
|
|
4973 |
$$= new drizzled::item::False(); |
|
4974 |
}
|
|
4975 |
| TRUE_SYM |
|
4976 |
{
|
|
4977 |
$$= new drizzled::item::True(); |
|
4978 |
}
|
|
4979 |
;
|
|
4980 |
||
2198.6.10
by Brian Aker
Scope out timestamp to only take certain types of values as default. |
4981 |
date_literal: |
4982 |
text_literal { $$ = $1; } |
|
4983 |
| NULL_SYM |
|
4984 |
{
|
|
4985 |
$$ = new Item_null(); |
|
4986 |
YYSession->m_lip->next_state=MY_LEX_OPERATOR_OR_IDENT; |
|
4987 |
}
|
|
4988 |
| NUM_literal { $$ = $1; } |
|
4989 |
| DATE_SYM text_literal { $$ = $2; } |
|
4990 |
| TIMESTAMP_SYM text_literal { $$ = $2; } |
|
4991 |
;
|
|
4992 |
||
1
by brian
clean slate |
4993 |
NUM_literal: |
4994 |
NUM
|
|
4995 |
{
|
|
4996 |
int error; |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
4997 |
$$ = new Item_int($1.str, (int64_t) internal::my_strtoll10($1.str, NULL, &error), $1.length); |
1
by brian
clean slate |
4998 |
}
|
4999 |
| LONG_NUM |
|
5000 |
{
|
|
5001 |
int error; |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
5002 |
$$ = new Item_int($1.str, (int64_t) internal::my_strtoll10($1.str, NULL, &error), $1.length); |
1
by brian
clean slate |
5003 |
}
|
5004 |
| ULONGLONG_NUM |
|
5005 |
{ $$ = new Item_uint($1.str, $1.length); } |
|
5006 |
| DECIMAL_NUM |
|
5007 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5008 |
$$= new Item_decimal($1.str, $1.length, YYSession->charset()); |
5009 |
if (YYSession->is_error()) |
|
1
by brian
clean slate |
5010 |
{
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5011 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5012 |
}
|
5013 |
}
|
|
5014 |
| FLOAT_NUM |
|
5015 |
{
|
|
5016 |
$$ = new Item_float($1.str, $1.length); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5017 |
if (YYSession->is_error()) |
1
by brian
clean slate |
5018 |
{
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5019 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5020 |
}
|
5021 |
}
|
|
5022 |
;
|
|
5023 |
||
5024 |
/**********************************************************************
|
|
5025 |
** Creating different items. |
|
5026 |
**********************************************************************/
|
|
5027 |
||
5028 |
insert_ident: |
|
2114.4.8
by Brian Aker
Merge in additional parser encapsulation. |
5029 |
simple_ident { $$=$1; } |
1
by brian
clean slate |
5030 |
| table_wild { $$=$1; } |
5031 |
;
|
|
5032 |
||
5033 |
table_wild: |
|
5034 |
ident '.' '*' |
|
5035 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5036 |
$$= parser::buildTableWild(&Lex, NULL_LEX_STRING, $1); |
1
by brian
clean slate |
5037 |
}
|
5038 |
| ident '.' ident '.' '*' |
|
5039 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5040 |
$$= parser::buildTableWild(&Lex, $1, $3); |
1
by brian
clean slate |
5041 |
}
|
5042 |
;
|
|
5043 |
||
5044 |
order_ident: |
|
5045 |
expr { $$=$1; } |
|
5046 |
;
|
|
5047 |
||
5048 |
simple_ident: |
|
5049 |
ident
|
|
5050 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5051 |
$$= parser::buildIdent(&Lex, NULL_LEX_STRING, NULL_LEX_STRING, $1); |
1
by brian
clean slate |
5052 |
}
|
5053 |
| simple_ident_q { $$= $1; } |
|
5054 |
;
|
|
5055 |
||
5056 |
simple_ident_q: |
|
5057 |
ident '.' ident |
|
5058 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5059 |
$$= parser::buildIdent(&Lex, NULL_LEX_STRING, $1, $3); |
1
by brian
clean slate |
5060 |
}
|
5061 |
| '.' ident '.' ident |
|
5062 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5063 |
$$= parser::buildIdent(&Lex, NULL_LEX_STRING, $2, $4); |
1
by brian
clean slate |
5064 |
}
|
5065 |
| ident '.' ident '.' ident |
|
5066 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5067 |
$$= parser::buildIdent(&Lex, $1, $3, $5); |
1
by brian
clean slate |
5068 |
}
|
5069 |
;
|
|
5070 |
||
5071 |
field_ident: |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5072 |
ident
|
2114.4.4
by Brian Aker
Merge in field ident wrap from parser. |
5073 |
{
|
5074 |
$$=$1; |
|
5075 |
}
|
|
1
by brian
clean slate |
5076 |
| ident '.' ident '.' ident |
5077 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5078 |
if (not parser::checkFieldIdent(&Lex, $1, $3)) |
2114.4.4
by Brian Aker
Merge in field ident wrap from parser. |
5079 |
DRIZZLE_YYABORT; |
5080 |
||
1
by brian
clean slate |
5081 |
$$=$5; |
5082 |
}
|
|
5083 |
| ident '.' ident |
|
5084 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5085 |
if (not parser::checkFieldIdent(&Lex, NULL_LEX_STRING, $1)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5086 |
DRIZZLE_YYABORT; |
2114.4.4
by Brian Aker
Merge in field ident wrap from parser. |
5087 |
|
1
by brian
clean slate |
5088 |
$$=$3; |
5089 |
}
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5090 |
| '.' ident |
2114.4.4
by Brian Aker
Merge in field ident wrap from parser. |
5091 |
{ /* For Delphi */ |
5092 |
$$=$2; |
|
5093 |
}
|
|
1
by brian
clean slate |
5094 |
;
|
5095 |
||
5096 |
table_ident: |
|
2114.4.7
by Brian Aker
Pull simple_ident into method. |
5097 |
ident
|
5098 |
{
|
|
5099 |
$$= new Table_ident($1); |
|
5100 |
}
|
|
5101 |
| schema_name '.' ident |
|
5102 |
{
|
|
5103 |
$$=new Table_ident($1,$3); |
|
5104 |
}
|
|
5105 |
| '.' ident |
|
5106 |
{ /* For Delphi */ |
|
5107 |
$$= new Table_ident($2); |
|
5108 |
}
|
|
1
by brian
clean slate |
5109 |
;
|
5110 |
||
2060.2.5
by Brian Aker
Adjust name, we aren't really return an ident, it is just a name. |
5111 |
schema_name: |
2060.2.6
by Brian Aker
Look ma, no shift conflicts, and we get the keywords back. |
5112 |
ident
|
2060.2.3
by Brian Aker
Clarify schema_ident definition. |
5113 |
;
|
5114 |
||
2073.1.2
by Brian Aker
Basic DDL for catalog. |
5115 |
catalog_name: |
5116 |
ident
|
|
5117 |
;
|
|
5118 |
||
1
by brian
clean slate |
5119 |
IDENT_sys: |
2227.4.10
by Olaf van der Spek
Session::lex() |
5120 |
IDENT
|
2029.1.26
by Brian Aker
Merge in work for reserved words in SQL standard. |
5121 |
{
|
5122 |
$$= $1; |
|
5123 |
}
|
|
1
by brian
clean slate |
5124 |
| IDENT_QUOTED |
5125 |
{
|
|
2254
by Brian Aker
Shift CHARSET_INFO to charset_info_st |
5126 |
const charset_info_st * const cs= system_charset_info; |
929.1.2
by Brian Aker
Remove line conversions (it is all coming over the wire as UTf8) |
5127 |
int dummy_error; |
5128 |
uint32_t wlen= cs->cset->well_formed_len(cs, $1.str, |
|
5129 |
$1.str+$1.length, |
|
5130 |
$1.length, &dummy_error); |
|
5131 |
if (wlen < $1.length) |
|
1
by brian
clean slate |
5132 |
{
|
929.1.2
by Brian Aker
Remove line conversions (it is all coming over the wire as UTf8) |
5133 |
my_error(ER_INVALID_CHARACTER_STRING, MYF(0), |
5134 |
cs->csname, $1.str + wlen); |
|
5135 |
DRIZZLE_YYABORT; |
|
1
by brian
clean slate |
5136 |
}
|
929.1.2
by Brian Aker
Remove line conversions (it is all coming over the wire as UTf8) |
5137 |
$$= $1; |
1
by brian
clean slate |
5138 |
}
|
5139 |
;
|
|
5140 |
||
5141 |
TEXT_STRING_sys: |
|
5142 |
TEXT_STRING
|
|
5143 |
{
|
|
929.1.2
by Brian Aker
Remove line conversions (it is all coming over the wire as UTf8) |
5144 |
$$= $1; |
1
by brian
clean slate |
5145 |
}
|
5146 |
;
|
|
5147 |
||
5148 |
TEXT_STRING_literal: |
|
5149 |
TEXT_STRING
|
|
5150 |
{
|
|
929.1.2
by Brian Aker
Remove line conversions (it is all coming over the wire as UTf8) |
5151 |
$$= $1; |
1
by brian
clean slate |
5152 |
}
|
5153 |
;
|
|
5154 |
||
5155 |
TEXT_STRING_filesystem: |
|
5156 |
TEXT_STRING
|
|
5157 |
{
|
|
929.1.2
by Brian Aker
Remove line conversions (it is all coming over the wire as UTf8) |
5158 |
$$= $1; |
1
by brian
clean slate |
5159 |
}
|
5160 |
;
|
|
5161 |
||
5162 |
ident: |
|
5163 |
IDENT_sys { $$=$1; } |
|
5164 |
| keyword |
|
5165 |
{
|
|
2029.1.15
by Brian Aker
Remove useless copy. |
5166 |
$$.str= YYSession->strmake($1.str, $1.length); |
1
by brian
clean slate |
5167 |
$$.length= $1.length; |
5168 |
}
|
|
5169 |
;
|
|
5170 |
||
5171 |
ident_or_text: |
|
2029.1.22
by Brian Aker
Merge in change to use row_format spefically *this is backward compatible |
5172 |
IDENT_sys { $$=$1;} |
5173 |
| TEXT_STRING_sys { $$=$1;} |
|
5174 |
;
|
|
5175 |
||
2029.1.24
by Brian Aker
Reduce the conflicts based on engine options. |
5176 |
engine_option_value: |
5177 |
IDENT_sys { $$=$1;} |
|
1
by brian
clean slate |
5178 |
| TEXT_STRING_sys { $$=$1;} |
2029.1.21
by Brian Aker
Reduce dependency on LEX_HOME. |
5179 |
;
|
5180 |
||
2029.1.26
by Brian Aker
Merge in work for reserved words in SQL standard. |
5181 |
keyword_exception_for_variable: |
5182 |
TIMESTAMP_SYM {} |
|
5183 |
| SQL_BUFFER_RESULT {} |
|
5184 |
| IDENTITY_SYM {} |
|
1
by brian
clean slate |
5185 |
;
|
5186 |
||
5187 |
/* Keyword that we allow for identifiers (except SP labels) */ |
|
5188 |
keyword: |
|
5189 |
keyword_sp {} |
|
5190 |
| BEGIN_SYM {} |
|
5191 |
| CHECKSUM_SYM {} |
|
5192 |
| CLOSE_SYM {} |
|
5193 |
| COMMENT_SYM {} |
|
5194 |
| COMMIT_SYM {} |
|
5195 |
| CONTAINS_SYM {} |
|
5196 |
| DEALLOCATE_SYM {} |
|
2029.1.24
by Brian Aker
Reduce the conflicts based on engine options. |
5197 |
| DO_SYM {} |
1
by brian
clean slate |
5198 |
| END {} |
5199 |
| FLUSH_SYM {} |
|
5200 |
| NO_SYM {} |
|
5201 |
| OPEN_SYM {} |
|
5202 |
| ROLLBACK_SYM {} |
|
5203 |
| SAVEPOINT_SYM {} |
|
5204 |
| SECURITY_SYM {} |
|
5205 |
| SERVER_SYM {} |
|
2029.1.24
by Brian Aker
Reduce the conflicts based on engine options. |
5206 |
| SIGNED_SYM {} |
1
by brian
clean slate |
5207 |
| START_SYM {} |
5208 |
| STOP_SYM {} |
|
5209 |
| TRUNCATE_SYM {} |
|
5210 |
;
|
|
5211 |
||
5212 |
/*
|
|
5213 |
* Keywords that we allow for labels in SPs. |
|
5214 |
* Anything that's the beginning of a statement or characteristics |
|
5215 |
* must be in keyword above, otherwise we get (harmful) shift/reduce |
|
5216 |
* conflicts. |
|
5217 |
*/
|
|
5218 |
keyword_sp: |
|
5219 |
ACTION {} |
|
5220 |
| ADDDATE_SYM {} |
|
5221 |
| AFTER_SYM {} |
|
5222 |
| AGGREGATE_SYM {} |
|
5223 |
| ANY_SYM {} |
|
5224 |
| AT_SYM {} |
|
5225 |
| AUTO_INC {} |
|
5226 |
| AVG_SYM {} |
|
5227 |
| BIT_SYM {} |
|
5228 |
| BOOL_SYM {} |
|
5229 |
| BOOLEAN_SYM {} |
|
5230 |
| BTREE_SYM {} |
|
5231 |
| CASCADED {} |
|
5232 |
| CHAIN_SYM {} |
|
5233 |
| COALESCE {} |
|
5234 |
| COLLATION_SYM {} |
|
5235 |
| COLUMNS {} |
|
5236 |
| COMMITTED_SYM {} |
|
5237 |
| COMPACT_SYM {} |
|
5238 |
| COMPRESSED_SYM {} |
|
5239 |
| CONCURRENT {} |
|
2060.2.9
by Brian Aker
Document conflict. |
5240 |
| CONNECTION_SYM {} /* Causes conflict because of kill */ |
1
by brian
clean slate |
5241 |
| CONSISTENT_SYM {} |
5242 |
| CUBE_SYM {} |
|
5243 |
| DATA_SYM {} |
|
1273.13.18
by Brian Aker
Update code, first pass through cleaner method for recursing through |
5244 |
| DATABASES {} |
1008.3.17
by Stewart Smith
Start work to construct table proto in parser: |
5245 |
| DATETIME_SYM {} |
2068.6.1
by Brian Aker
Cut down the number of keywords/small style cleanup. |
5246 |
| DATE_SYM {} /* Create conflict */ |
1
by brian
clean slate |
5247 |
| DAY_SYM {} |
5248 |
| DISABLE_SYM {} |
|
5249 |
| DISCARD {} |
|
5250 |
| DUMPFILE {} |
|
5251 |
| DUPLICATE_SYM {} |
|
5252 |
| DYNAMIC_SYM {} |
|
5253 |
| ENDS_SYM {} |
|
1008.3.17
by Stewart Smith
Start work to construct table proto in parser: |
5254 |
| ENUM_SYM {} |
1
by brian
clean slate |
5255 |
| ENGINE_SYM {} |
5256 |
| ERRORS {} |
|
5257 |
| ESCAPE_SYM {} |
|
5258 |
| EXCLUSIVE_SYM {} |
|
5259 |
| EXTENDED_SYM {} |
|
5260 |
| FOUND_SYM {} |
|
5261 |
| ENABLE_SYM {} |
|
5262 |
| FULL {} |
|
5263 |
| FILE_SYM {} |
|
5264 |
| FIRST_SYM {} |
|
5265 |
| FIXED_SYM {} |
|
5266 |
| FRAC_SECOND_SYM {} |
|
5267 |
| GLOBAL_SYM {} |
|
5268 |
| HASH_SYM {} |
|
5269 |
| HOUR_SYM {} |
|
5270 |
| IDENTIFIED_SYM {} |
|
5271 |
| IMPORT {} |
|
5272 |
| INDEXES {} |
|
5273 |
| ISOLATION {} |
|
5274 |
| KEY_BLOCK_SIZE {} |
|
5275 |
| LAST_SYM {} |
|
5276 |
| LEVEL_SYM {} |
|
5277 |
| LOCAL_SYM {} |
|
5278 |
| LOCKS_SYM {} |
|
5279 |
| LOGS_SYM {} |
|
5280 |
| MAX_VALUE_SYM {} |
|
5281 |
| MEDIUM_SYM {} |
|
5282 |
| MERGE_SYM {} |
|
5283 |
| MICROSECOND_SYM {} |
|
5284 |
| MINUTE_SYM {} |
|
5285 |
| MODIFY_SYM {} |
|
5286 |
| MODE_SYM {} |
|
5287 |
| MONTH_SYM {} |
|
5288 |
| NAME_SYM {} |
|
5289 |
| NAMES_SYM {} |
|
5290 |
| NATIONAL_SYM {} |
|
5291 |
| NEXT_SYM {} |
|
5292 |
| NEW_SYM {} |
|
5293 |
| NONE_SYM {} |
|
5294 |
| OFFLINE_SYM {} |
|
5295 |
| OFFSET_SYM {} |
|
5296 |
| ONE_SHOT_SYM {} |
|
5297 |
| ONE_SYM {} |
|
5298 |
| ONLINE_SYM {} |
|
5299 |
| PARTIAL {} |
|
5300 |
| PREV_SYM {} |
|
5301 |
| PROCESS {} |
|
5302 |
| PROCESSLIST_SYM {} |
|
5303 |
| QUARTER_SYM {} |
|
2068.6.1
by Brian Aker
Cut down the number of keywords/small style cleanup. |
5304 |
| QUERY_SYM {} // Causes conflict |
1
by brian
clean slate |
5305 |
| REDUNDANT_SYM {} |
5306 |
| REPEATABLE_SYM {} |
|
5307 |
| RETURNS_SYM {} |
|
5308 |
| ROLLUP_SYM {} |
|
5309 |
| ROUTINE_SYM {} |
|
5310 |
| ROWS_SYM {} |
|
5311 |
| ROW_FORMAT_SYM {} |
|
5312 |
| ROW_SYM {} |
|
5313 |
| SECOND_SYM {} |
|
5314 |
| SERIAL_SYM {} |
|
5315 |
| SERIALIZABLE_SYM {} |
|
5316 |
| SESSION_SYM {} |
|
5317 |
| SIMPLE_SYM {} |
|
5318 |
| SHARE_SYM {} |
|
5319 |
| SNAPSHOT_SYM {} |
|
5320 |
| STATUS_SYM {} |
|
5321 |
| STRING_SYM {} |
|
5322 |
| SUBDATE_SYM {} |
|
5323 |
| SUBJECT_SYM {} |
|
5324 |
| SUSPEND_SYM {} |
|
5325 |
| TABLES {} |
|
108
by Brian Aker
Removed unwanted ALTER TABLESPACE, left in valuable bits. |
5326 |
| TABLESPACE {} |
1008.3.17
by Stewart Smith
Start work to construct table proto in parser: |
5327 |
| TEMPORARY_SYM {} |
1
by brian
clean slate |
5328 |
| TEXT_SYM {} |
5329 |
| TRANSACTION_SYM {} |
|
1999.4.7
by Brian Aker
Merge in first pass of TIME type (closer to EPOCH time). |
5330 |
| TIME_SYM {} |
1
by brian
clean slate |
5331 |
| TIMESTAMP_ADD {} |
5332 |
| TIMESTAMP_DIFF {} |
|
5333 |
| TYPE_SYM {} |
|
5334 |
| UNCOMMITTED_SYM {} |
|
5335 |
| UNDOFILE_SYM {} |
|
5336 |
| UNKNOWN_SYM {} |
|
2068.6.1
by Brian Aker
Cut down the number of keywords/small style cleanup. |
5337 |
| UUID_SYM {} |
1
by brian
clean slate |
5338 |
| USER {} |
5339 |
| VARIABLES {} |
|
5340 |
| VALUE_SYM {} |
|
5341 |
| WARNINGS {} |
|
5342 |
| WEEK_SYM {} |
|
5343 |
| WORK_SYM {} |
|
5344 |
| YEAR_SYM {} |
|
5345 |
;
|
|
5346 |
||
5347 |
/* Option functions */ |
|
5348 |
||
5349 |
set: |
|
2030.1.1
by Brian Aker
Small set of symbol updates. |
5350 |
SET_SYM opt_option |
1
by brian
clean slate |
5351 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5352 |
Lex.statement= new statement::SetOption(YYSession); |
1
by brian
clean slate |
5353 |
}
|
5354 |
option_value_list
|
|
5355 |
{}
|
|
5356 |
;
|
|
5357 |
||
5358 |
opt_option: |
|
5359 |
/* empty */ {} |
|
5360 |
| OPTION {} |
|
5361 |
;
|
|
5362 |
||
5363 |
option_value_list: |
|
5364 |
option_type_value
|
|
5365 |
| option_value_list ',' option_type_value |
|
5366 |
;
|
|
5367 |
||
5368 |
option_type_value: |
|
2104.3.11
by Brian Aker
Encapsulate more out of the parser. |
5369 |
{ } |
1
by brian
clean slate |
5370 |
ext_option_value
|
2104.3.11
by Brian Aker
Encapsulate more out of the parser. |
5371 |
{ } |
1
by brian
clean slate |
5372 |
;
|
5373 |
||
5374 |
option_type: |
|
5375 |
option_type2 {} |
|
5376 |
| GLOBAL_SYM { $$=OPT_GLOBAL; } |
|
5377 |
| LOCAL_SYM { $$=OPT_SESSION; } |
|
5378 |
| SESSION_SYM { $$=OPT_SESSION; } |
|
5379 |
;
|
|
5380 |
||
5381 |
option_type2: |
|
5382 |
/* empty */ { $$= OPT_DEFAULT; } |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5383 |
| ONE_SHOT_SYM { ((statement::SetOption *)Lex.statement)->one_shot_set= true; $$= OPT_SESSION; } |
1
by brian
clean slate |
5384 |
;
|
5385 |
||
5386 |
opt_var_type: |
|
5387 |
/* empty */ { $$=OPT_SESSION; } |
|
5388 |
| GLOBAL_SYM { $$=OPT_GLOBAL; } |
|
5389 |
| LOCAL_SYM { $$=OPT_SESSION; } |
|
5390 |
| SESSION_SYM { $$=OPT_SESSION; } |
|
5391 |
;
|
|
5392 |
||
5393 |
opt_var_ident_type: |
|
5394 |
/* empty */ { $$=OPT_DEFAULT; } |
|
5395 |
| GLOBAL_SYM '.' { $$=OPT_GLOBAL; } |
|
5396 |
| LOCAL_SYM '.' { $$=OPT_SESSION; } |
|
5397 |
| SESSION_SYM '.' { $$=OPT_SESSION; } |
|
5398 |
;
|
|
5399 |
||
5400 |
ext_option_value: |
|
5401 |
sys_option_value
|
|
5402 |
| option_type2 option_value |
|
5403 |
;
|
|
5404 |
||
5405 |
sys_option_value: |
|
5406 |
option_type internal_variable_name equal set_expr_or_default |
|
5407 |
{
|
|
5408 |
if ($2.var) |
|
5409 |
{ /* System variable */ |
|
5410 |
if ($1) |
|
2060.2.1
by Brian Aker
Merge in SQL reserved word patch |
5411 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5412 |
Lex.option_type= $1; |
2060.2.1
by Brian Aker
Merge in SQL reserved word patch |
5413 |
}
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5414 |
Lex.var_list.push_back(SetVarPtr(new set_var(Lex.option_type, $2.var, &$2.base_name, $4))); |
1
by brian
clean slate |
5415 |
}
|
5416 |
}
|
|
5417 |
| option_type TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types |
|
5418 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5419 |
Lex.option_type= $1; |
5420 |
Lex.var_list.push_back(SetVarPtr(new set_var(Lex.option_type, |
|
2060.2.1
by Brian Aker
Merge in SQL reserved word patch |
5421 |
find_sys_var("tx_isolation"), |
5422 |
&null_lex_str, |
|
5423 |
new Item_int((int32_t) |
|
5424 |
$5)))); |
|
1
by brian
clean slate |
5425 |
}
|
5426 |
;
|
|
5427 |
||
5428 |
option_value: |
|
2029.1.26
by Brian Aker
Merge in work for reserved words in SQL standard. |
5429 |
'@' user_variable_ident equal expr |
1
by brian
clean slate |
5430 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5431 |
Lex.var_list.push_back(SetVarPtr(new set_var_user(new Item_func_set_user_var($2,$4)))); |
1
by brian
clean slate |
5432 |
}
|
5433 |
| '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default |
|
5434 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5435 |
Lex.var_list.push_back(SetVarPtr(new set_var($3, $4.var, &$4.base_name, $6))); |
1
by brian
clean slate |
5436 |
}
|
5437 |
;
|
|
5438 |
||
2029.1.26
by Brian Aker
Merge in work for reserved words in SQL standard. |
5439 |
user_variable_ident: |
5440 |
internal_variable_ident { $$=$1;} |
|
5441 |
| TEXT_STRING_sys { $$=$1;} |
|
5442 |
| LEX_HOSTNAME { $$=$1;} |
|
5443 |
;
|
|
5444 |
||
5445 |
internal_variable_ident: |
|
5446 |
keyword_exception_for_variable
|
|
5447 |
{
|
|
5448 |
$$.str= YYSession->strmake($1.str, $1.length); |
|
5449 |
$$.length= $1.length; |
|
5450 |
}
|
|
5451 |
| IDENT_sys { $$=$1; } |
|
5452 |
;
|
|
5453 |
||
1
by brian
clean slate |
5454 |
internal_variable_name: |
2029.1.26
by Brian Aker
Merge in work for reserved words in SQL standard. |
5455 |
internal_variable_ident
|
1
by brian
clean slate |
5456 |
{
|
5457 |
/* We have to lookup here since local vars can shadow sysvars */ |
|
5458 |
{
|
|
5459 |
/* Not an SP local variable */ |
|
2060.2.1
by Brian Aker
Merge in SQL reserved word patch |
5460 |
sys_var *tmp= find_sys_var(std::string($1.str, $1.length)); |
1
by brian
clean slate |
5461 |
if (!tmp) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5462 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5463 |
$$.var= tmp; |
5464 |
$$.base_name= null_lex_str; |
|
5465 |
}
|
|
5466 |
}
|
|
5467 |
;
|
|
5468 |
||
5469 |
isolation_types: |
|
5470 |
READ_SYM UNCOMMITTED_SYM { $$= ISO_READ_UNCOMMITTED; } |
|
5471 |
| READ_SYM COMMITTED_SYM { $$= ISO_READ_COMMITTED; } |
|
5472 |
| REPEATABLE_SYM READ_SYM { $$= ISO_REPEATABLE_READ; } |
|
5473 |
| SERIALIZABLE_SYM { $$= ISO_SERIALIZABLE; } |
|
5474 |
;
|
|
5475 |
||
5476 |
set_expr_or_default: |
|
5477 |
expr { $$=$1; } |
|
5478 |
| DEFAULT { $$=0; } |
|
5479 |
| ON { $$=new Item_string("ON", 2, system_charset_info); } |
|
5480 |
| ALL { $$=new Item_string("ALL", 3, system_charset_info); } |
|
5481 |
| BINARY { $$=new Item_string("binary", 6, system_charset_info); } |
|
5482 |
;
|
|
5483 |
||
5484 |
table_or_tables: |
|
5485 |
TABLE_SYM
|
|
5486 |
| TABLES |
|
5487 |
;
|
|
5488 |
||
5489 |
unlock: |
|
5490 |
UNLOCK_SYM
|
|
5491 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5492 |
Lex.statement= new statement::UnlockTables(YYSession); |
1
by brian
clean slate |
5493 |
}
|
5494 |
table_or_tables
|
|
5495 |
{}
|
|
5496 |
;
|
|
5497 |
||
5498 |
begin: |
|
5499 |
BEGIN_SYM
|
|
5500 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5501 |
Lex.statement= new statement::StartTransaction(YYSession); |
1
by brian
clean slate |
5502 |
}
|
5503 |
opt_work {} |
|
5504 |
;
|
|
5505 |
||
5506 |
opt_work: |
|
5507 |
/* empty */ {} |
|
5508 |
| WORK_SYM {} |
|
5509 |
;
|
|
5510 |
||
5511 |
opt_chain: |
|
5512 |
/* empty */ |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5513 |
{ $$= (YYSession->variables.completion_type == 1); } |
1
by brian
clean slate |
5514 |
| AND_SYM NO_SYM CHAIN_SYM { $$=0; } |
5515 |
| AND_SYM CHAIN_SYM { $$=1; } |
|
5516 |
;
|
|
5517 |
||
5518 |
opt_release: |
|
5519 |
/* empty */ |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
5520 |
{ $$= (YYSession->variables.completion_type == 2); } |
1
by brian
clean slate |
5521 |
| RELEASE_SYM { $$=1; } |
5522 |
| NO_SYM RELEASE_SYM { $$=0; } |
|
5523 |
;
|
|
5524 |
||
5525 |
opt_savepoint: |
|
5526 |
/* empty */ {} |
|
5527 |
| SAVEPOINT_SYM {} |
|
5528 |
;
|
|
5529 |
||
5530 |
commit: |
|
5531 |
COMMIT_SYM opt_work opt_chain opt_release |
|
5532 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5533 |
Lex.statement= new statement::Commit(YYSession, $3, $4); |
1
by brian
clean slate |
5534 |
}
|
5535 |
;
|
|
5536 |
||
5537 |
rollback: |
|
5538 |
ROLLBACK_SYM opt_work opt_chain opt_release |
|
5539 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5540 |
Lex.statement= new statement::Rollback(YYSession, $3, $4); |
1
by brian
clean slate |
5541 |
}
|
2029.1.29
by Brian Aker
Modify savepoint to not allow keyword usage. |
5542 |
| ROLLBACK_SYM opt_work TO_SYM opt_savepoint savepoint_ident |
1
by brian
clean slate |
5543 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5544 |
Lex.statement= new statement::RollbackToSavepoint(YYSession, $5); |
1
by brian
clean slate |
5545 |
}
|
5546 |
;
|
|
5547 |
||
5548 |
savepoint: |
|
2029.1.29
by Brian Aker
Modify savepoint to not allow keyword usage. |
5549 |
SAVEPOINT_SYM savepoint_ident |
1
by brian
clean slate |
5550 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5551 |
Lex.statement= new statement::Savepoint(YYSession, $2); |
1
by brian
clean slate |
5552 |
}
|
5553 |
;
|
|
5554 |
||
5555 |
release: |
|
2029.1.29
by Brian Aker
Modify savepoint to not allow keyword usage. |
5556 |
RELEASE_SYM SAVEPOINT_SYM savepoint_ident |
1
by brian
clean slate |
5557 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5558 |
Lex.statement= new statement::ReleaseSavepoint(YYSession, $3); |
1
by brian
clean slate |
5559 |
}
|
5560 |
;
|
|
5561 |
||
2029.1.29
by Brian Aker
Modify savepoint to not allow keyword usage. |
5562 |
savepoint_ident: |
5563 |
IDENT_sys
|
|
5564 |
;
|
|
5565 |
||
1
by brian
clean slate |
5566 |
/*
|
5567 |
UNIONS : glue selects together |
|
5568 |
*/
|
|
5569 |
||
5570 |
||
5571 |
union_clause: |
|
5572 |
/* empty */ {} |
|
5573 |
| union_list |
|
5574 |
;
|
|
5575 |
||
5576 |
union_list: |
|
5577 |
UNION_SYM union_option |
|
5578 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5579 |
if (parser::add_select_to_union_list(YYSession, &Lex, (bool)$2)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5580 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5581 |
}
|
5582 |
select_init
|
|
5583 |
{
|
|
5584 |
/*
|
|
5585 |
Remove from the name resolution context stack the context of the |
|
5586 |
last select in the union. |
|
5587 |
*/
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5588 |
Lex.pop_context(); |
1
by brian
clean slate |
5589 |
}
|
5590 |
;
|
|
5591 |
||
5592 |
union_opt: |
|
5593 |
/* Empty */ { $$= 0; } |
|
5594 |
| union_list { $$= 1; } |
|
5595 |
| union_order_or_limit { $$= 1; } |
|
5596 |
;
|
|
5597 |
||
5598 |
union_order_or_limit: |
|
5599 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5600 |
assert(Lex.current_select->linkage != GLOBAL_OPTIONS_TYPE); |
5601 |
Select_Lex *sel= Lex.current_select; |
|
849
by Brian Aker
Remove dead keywords. |
5602 |
Select_Lex_Unit *unit= sel->master_unit(); |
846
by Brian Aker
Removing on typedeffed class. |
5603 |
Select_Lex *fake= unit->fake_select_lex; |
1
by brian
clean slate |
5604 |
if (fake) |
5605 |
{
|
|
5606 |
unit->global_parameters= fake; |
|
5607 |
fake->no_table_names_allowed= 1; |
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5608 |
Lex.current_select= fake; |
1
by brian
clean slate |
5609 |
}
|
2114.4.10
by Brian Aker
Remove current_session from a couple of locations, encapsulate where in |
5610 |
YYSession->setWhere("global ORDER clause"); |
1
by brian
clean slate |
5611 |
}
|
5612 |
order_or_limit
|
|
5613 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5614 |
YYSession->lex().current_select->no_table_names_allowed= 0; |
2114.4.10
by Brian Aker
Remove current_session from a couple of locations, encapsulate where in |
5615 |
YYSession->setWhere(""); |
1
by brian
clean slate |
5616 |
}
|
5617 |
;
|
|
5618 |
||
5619 |
order_or_limit: |
|
5620 |
order_clause opt_limit_clause_init |
|
5621 |
| limit_clause |
|
5622 |
;
|
|
5623 |
||
5624 |
union_option: |
|
5625 |
/* empty */ { $$=1; } |
|
5626 |
| DISTINCT { $$=1; } |
|
5627 |
| ALL { $$=0; } |
|
5628 |
;
|
|
5629 |
||
5630 |
query_specification: |
|
5631 |
SELECT_SYM select_init2_derived |
|
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
5632 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5633 |
$$= Lex.current_select->master_unit()->first_select(); |
1
by brian
clean slate |
5634 |
}
|
5635 |
| '(' select_paren_derived ')' |
|
5636 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5637 |
$$= Lex.current_select->master_unit()->first_select(); |
1
by brian
clean slate |
5638 |
}
|
5639 |
;
|
|
5640 |
||
5641 |
query_expression_body: |
|
5642 |
query_specification
|
|
5643 |
| query_expression_body |
|
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
5644 |
UNION_SYM union_option |
1
by brian
clean slate |
5645 |
{
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5646 |
if (parser::add_select_to_union_list(YYSession, &Lex, (bool)$3)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5647 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5648 |
}
|
5649 |
query_specification
|
|
5650 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5651 |
Lex.pop_context(); |
1
by brian
clean slate |
5652 |
$$= $1; |
5653 |
}
|
|
5654 |
;
|
|
5655 |
||
5656 |
/* Corresponds to <query expression> in the SQL:2003 standard. */ |
|
5657 |
subselect: |
|
5658 |
subselect_start query_expression_body subselect_end |
|
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
5659 |
{
|
1
by brian
clean slate |
5660 |
$$= $2; |
5661 |
}
|
|
5662 |
;
|
|
5663 |
||
5664 |
subselect_start: |
|
5665 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5666 |
if (not Lex.expr_allows_subselect) |
1
by brian
clean slate |
5667 |
{
|
2104.3.5
by Brian Aker
Fixed case where parser error message might be null. |
5668 |
parser::my_parse_error(YYSession->m_lip); |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5669 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5670 |
}
|
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
5671 |
/*
|
1
by brian
clean slate |
5672 |
we are making a "derived table" for the parenthesis |
1237.6.1
by Brian Aker
Remove dead bits in parser/whitespace/etc. |
5673 |
as we need to have a lex level to fit the union |
5674 |
after the parenthesis, e.g. |
|
5675 |
(SELECT .. ) UNION ... becomes |
|
1
by brian
clean slate |
5676 |
SELECT * FROM ((SELECT ...) UNION ...) |
5677 |
*/
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5678 |
if (new_select(&Lex, 1)) |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
5679 |
DRIZZLE_YYABORT; |
1
by brian
clean slate |
5680 |
}
|
5681 |
;
|
|
5682 |
||
5683 |
subselect_end: |
|
5684 |
{
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5685 |
Lex.pop_context(); |
5686 |
Select_Lex *child= Lex.current_select; |
|
5687 |
Lex.current_select= Lex.current_select->return_after_parsing(); |
|
5688 |
Lex.nest_level--; |
|
5689 |
Lex.current_select->n_child_sum_items += child->n_sum_items; |
|
1
by brian
clean slate |
5690 |
/*
|
5691 |
A subselect can add fields to an outer select. Reserve space for |
|
5692 |
them. |
|
5693 |
*/
|
|
2227.4.10
by Olaf van der Spek
Session::lex() |
5694 |
Lex.current_select->select_n_where_fields+= |
1
by brian
clean slate |
5695 |
child->select_n_where_fields; |
5696 |
}
|
|
5697 |
;
|
|
5698 |
/**
|
|
5699 |
@} (end of group Parser) |
|
5700 |
*/
|