205
202
a parse error is discovered internally by the Bison generated
208
void my_parse_error(parser::error_t &arg)
205
void my_parse_error(Lex_input_stream *lip)
210
Lex_input_stream *lip= arg.session->m_lip;
212
209
const char *yytext= lip->get_tok_start();
213
210
/* Push an error into the error stack */
214
my_printf_error(ER_PARSE_ERROR, ER(ER_PARSE_ERROR), MYF(0), arg.s,
211
my_printf_error(ER_PARSE_ERROR, ER(ER_PARSE_ERROR), MYF(0), ER(ER_SYNTAX_ERROR),
215
212
(yytext ? yytext : ""),
216
void my_parse_error(const char *message)
218
my_printf_error(ER_PARSE_ERROR_UNKNOWN, ER(ER_PARSE_ERROR_UNKNOWN), MYF(0), message);
219
221
bool check_reserved_words(LEX_STRING *name)
221
223
if (!my_strcasecmp(system_charset_info, name->str, "GLOBAL") ||
233
@brief Bison callback to report a syntax/OOM error
235
This function is invoked by the bison-generated parser
236
when a syntax error, a parse error or an out-of-memory
237
condition occurs. This function is not invoked when the
238
parser is requested to abort by semantic action code
239
by means of YYABORT or YYACCEPT macros. This is why these
240
macros should not be used (use DRIZZLE_YYABORT/DRIZZLE_YYACCEPT
243
The parser will abort immediately after invoking this callback.
245
This function is not for use in semantic actions and is internal to
246
the parser, as it performs some pre-return cleanup.
247
In semantic actions, please use parser::my_parse_error or my_error to
248
push an error into the error stack and DRIZZLE_YYABORT
249
to abort from the parser.
251
void errorOn(const char *s)
253
Session *session= current_session;
255
/* "parse error" changed into "syntax error" between bison 1.75 and 1.875 */
256
if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0)
258
parser::my_parse_error(session->m_lip);
262
parser::my_parse_error(s);
266
bool buildOrderBy(Session *session)
268
Select_Lex *sel= session->getLex()->current_select;
269
Select_Lex_Unit *unit= sel-> master_unit();
271
if (sel->linkage != GLOBAL_OPTIONS_TYPE &&
272
sel->olap != UNSPECIFIED_OLAP_TYPE &&
273
(sel->linkage != UNION_TYPE || sel->braces))
275
my_error(ER_WRONG_USAGE, MYF(0),
276
"CUBE/ROLLUP", "ORDER BY");
280
if (session->getLex()->sql_command != SQLCOM_ALTER_TABLE && !unit->fake_select_lex)
283
A query of the of the form (SELECT ...) ORDER BY order_list is
284
executed in the same way as the query
285
SELECT ... ORDER BY order_list
286
unless the SELECT construct contains ORDER BY or LIMIT clauses.
287
Otherwise we create a fake Select_Lex if it has not been created
290
Select_Lex *first_sl= unit->first_select();
291
if (!unit->is_union() &&
292
(first_sl->order_list.elements ||
293
first_sl->select_limit) &&
294
unit->add_fake_select_lex(session->getLex()->session))
231
303
} // namespace parser
232
304
} // namespace drizzled