PageRenderTime 33ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

/package/oracle-mysql/0005-bison_3_breaks_mysql_server_build.patch

https://gitlab.com/cronmod-dev/buildroot
Patch | 1421 lines | 1380 code | 41 blank | 0 comment | 0 complexity | fa271adb96185f54e2f1e960ed777e7e MD5 | raw file
  1. fix the yacc code in mysql
  2. Signed-off-by: Marcelo Gutierrez (UTN/FRH) <kuyurix@gmail.com>
  3. ---
  4. diff -uNr mysql-5.1.73.orig/sql/sql_lex.cc mysql-5.1.73/sql/sql_lex.cc
  5. --- mysql-5.1.73.orig/sql/sql_lex.cc 2013-11-04 18:52:27.000000000 +0000
  6. +++ mysql-5.1.73/sql/sql_lex.cc 2014-02-12 14:12:04.244111625 +0000
  7. @@ -775,14 +775,13 @@
  8. (which can't be followed by a signed number)
  9. */
  10. -int MYSQLlex(void *arg, void *yythd)
  11. +int MYSQLlex(void *arg, THD *thd)
  12. {
  13. reg1 uchar c= 0;
  14. bool comment_closed;
  15. int tokval, result_state;
  16. uint length;
  17. enum my_lex_states state;
  18. - THD *thd= (THD *)yythd;
  19. Lex_input_stream *lip= & thd->m_parser_state->m_lip;
  20. LEX *lex= thd->lex;
  21. YYSTYPE *yylval=(YYSTYPE*) arg;
  22. diff -uNr mysql-5.1.73.orig/sql/sql_lex.h mysql-5.1.73/sql/sql_lex.h
  23. --- mysql-5.1.73.orig/sql/sql_lex.h 2013-11-04 18:52:27.000000000 +0000
  24. +++ mysql-5.1.73/sql/sql_lex.h 2014-02-12 14:17:19.424106423 +0000
  25. @@ -2072,7 +2072,7 @@
  26. extern void lex_free(void);
  27. extern void lex_start(THD *thd);
  28. extern void lex_end(LEX *lex);
  29. -extern int MYSQLlex(void *arg, void *yythd);
  30. +extern int MYSQLlex(void *arg, THD *thd);
  31. extern void trim_whitespace(CHARSET_INFO *cs, LEX_STRING *str);
  32. diff -uNr mysql-5.1.73.orig/sql/sql_parse.cc mysql-5.1.73/sql/sql_parse.cc
  33. --- mysql-5.1.73.orig/sql/sql_parse.cc 2013-11-04 18:52:27.000000000 +0000
  34. +++ mysql-5.1.73/sql/sql_parse.cc 2014-02-12 14:19:20.424104427 +0000
  35. @@ -8012,7 +8012,7 @@
  36. }
  37. -extern int MYSQLparse(void *thd); // from sql_yacc.cc
  38. +extern int MYSQLparse(THD *thd); // from sql_yacc.cc
  39. /**
  40. diff -uNr mysql-5.1.73.orig/sql/sql_yacc.yy mysql-5.1.73/sql/sql_yacc.yy
  41. --- mysql-5.1.73.orig/sql/sql_yacc.yy 2013-11-04 18:52:27.000000000 +0000
  42. +++ mysql-5.1.73/sql/sql_yacc.yy 2014-02-12 20:17:06.707750140 +0000
  43. @@ -23,19 +23,13 @@
  44. */
  45. %{
  46. -/* thd is passed as an argument to yyparse(), and subsequently to yylex().
  47. -** The type will be void*, so it must be cast to (THD*) when used.
  48. -** Use the YYTHD macro for this.
  49. -*/
  50. -#define YYPARSE_PARAM yythd
  51. -#define YYLEX_PARAM yythd
  52. -#define YYTHD ((THD *)yythd)
  53. -#define YYLIP (& YYTHD->m_parser_state->m_lip)
  54. +
  55. +#define YYLIP (& thd->m_parser_state->m_lip)
  56. #define MYSQL_YACC
  57. #define YYINITDEPTH 100
  58. #define YYMAXDEPTH 3200 /* Because of 64K stack */
  59. -#define Lex (YYTHD->lex)
  60. +#define Lex (thd->lex)
  61. #define Select Lex->current_select
  62. #include "mysql_priv.h"
  63. #include "slave.h"
  64. @@ -55,7 +49,7 @@
  65. #pragma warning (disable : 4065)
  66. #endif
  67. -int yylex(void *yylval, void *yythd);
  68. +int yylex(void *yylval, THD *thd);
  69. const LEX_STRING null_lex_str= {0,0};
  70. @@ -64,7 +58,7 @@
  71. ulong val= *(F); \
  72. if (my_yyoverflow((B), (D), &val)) \
  73. { \
  74. - yyerror((char*) (A)); \
  75. + yyerror(current_thd, (char*) (A)); \
  76. return 2; \
  77. } \
  78. else \
  79. @@ -76,7 +70,7 @@
  80. #define MYSQL_YYABORT \
  81. do \
  82. { \
  83. - LEX::cleanup_lex_after_parse_error(YYTHD);\
  84. + LEX::cleanup_lex_after_parse_error(thd);\
  85. YYABORT; \
  86. } while (0)
  87. @@ -159,9 +153,8 @@
  88. to abort from the parser.
  89. */
  90. -void MYSQLerror(const char *s)
  91. +void MYSQLerror(THD *thd, const char *s)
  92. {
  93. - THD *thd= current_thd;
  94. /*
  95. Restore the original LEX if it was replaced when parsing
  96. @@ -675,7 +668,10 @@
  97. bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
  98. %}
  99. -%pure_parser /* We have threads */
  100. +/* We have threads */
  101. +%define api.pure
  102. +%parse-param { THD *thd }
  103. +%lex-param { THD *thd }
  104. /*
  105. Currently there are 169 shift/reduce conflicts.
  106. We should not introduce new conflicts any more.
  107. @@ -1516,7 +1512,6 @@
  108. query:
  109. END_OF_INPUT
  110. {
  111. - THD *thd= YYTHD;
  112. if (!thd->bootstrap &&
  113. (!(thd->lex->select_lex.options & OPTION_FOUND_COMMENT)))
  114. {
  115. @@ -1530,7 +1525,7 @@
  116. {
  117. Lex_input_stream *lip = YYLIP;
  118. - if ((YYTHD->client_capabilities & CLIENT_MULTI_QUERIES) &&
  119. + if ((thd->client_capabilities & CLIENT_MULTI_QUERIES) &&
  120. ! lip->stmt_prepare_mode &&
  121. ! lip->eof())
  122. {
  123. @@ -1626,7 +1621,6 @@
  124. deallocate:
  125. deallocate_or_drop PREPARE_SYM ident
  126. {
  127. - THD *thd= YYTHD;
  128. LEX *lex= thd->lex;
  129. lex->sql_command= SQLCOM_DEALLOCATE_PREPARE;
  130. lex->prepared_stmt_name= $3;
  131. @@ -1641,7 +1635,6 @@
  132. prepare:
  133. PREPARE_SYM ident FROM prepare_src
  134. {
  135. - THD *thd= YYTHD;
  136. LEX *lex= thd->lex;
  137. lex->sql_command= SQLCOM_PREPARE;
  138. lex->prepared_stmt_name= $2;
  139. @@ -1651,14 +1644,12 @@
  140. prepare_src:
  141. TEXT_STRING_sys
  142. {
  143. - THD *thd= YYTHD;
  144. LEX *lex= thd->lex;
  145. lex->prepared_stmt_code= $1;
  146. lex->prepared_stmt_code_is_varref= FALSE;
  147. }
  148. | '@' ident_or_text
  149. {
  150. - THD *thd= YYTHD;
  151. LEX *lex= thd->lex;
  152. lex->prepared_stmt_code= $2;
  153. lex->prepared_stmt_code_is_varref= TRUE;
  154. @@ -1668,7 +1659,6 @@
  155. execute:
  156. EXECUTE_SYM ident
  157. {
  158. - THD *thd= YYTHD;
  159. LEX *lex= thd->lex;
  160. lex->sql_command= SQLCOM_EXECUTE;
  161. lex->prepared_stmt_name= $2;
  162. @@ -1826,7 +1816,6 @@
  163. create:
  164. CREATE opt_table_options TABLE_SYM opt_if_not_exists table_ident
  165. {
  166. - THD *thd= YYTHD;
  167. LEX *lex= thd->lex;
  168. lex->sql_command= SQLCOM_CREATE_TABLE;
  169. if (!lex->select_lex.add_table_to_list(thd, $5, NULL,
  170. @@ -1844,13 +1833,13 @@
  171. }
  172. create2
  173. {
  174. - LEX *lex= YYTHD->lex;
  175. + LEX *lex= thd->lex;
  176. lex->current_select= &lex->select_lex;
  177. if ((lex->create_info.used_fields & HA_CREATE_USED_ENGINE) &&
  178. !lex->create_info.db_type)
  179. {
  180. - lex->create_info.db_type= ha_default_handlerton(YYTHD);
  181. - push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN,
  182. + lex->create_info.db_type= ha_default_handlerton(thd);
  183. + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
  184. ER_WARN_USING_OTHER_HANDLER,
  185. ER(ER_WARN_USING_OTHER_HANDLER),
  186. ha_resolve_storage_engine_name(lex->create_info.db_type),
  187. @@ -1979,7 +1968,7 @@
  188. event_tail:
  189. remember_name EVENT_SYM opt_if_not_exists sp_name
  190. {
  191. - THD *thd= YYTHD;
  192. + THD *thd= thd;
  193. LEX *lex=Lex;
  194. lex->stmt_definition_begin= $1;
  195. @@ -2046,7 +2035,7 @@
  196. ev_starts:
  197. /* empty */
  198. {
  199. - Item *item= new (YYTHD->mem_root) Item_func_now_local();
  200. + Item *item= new (thd->mem_root) Item_func_now_local();
  201. if (item == NULL)
  202. MYSQL_YYABORT;
  203. Lex->event_parse_data->item_starts= item;
  204. @@ -2096,7 +2085,6 @@
  205. ev_sql_stmt:
  206. {
  207. - THD *thd= YYTHD;
  208. LEX *lex= thd->lex;
  209. Lex_input_stream *lip= YYLIP;
  210. @@ -2139,7 +2127,6 @@
  211. }
  212. ev_sql_stmt_inner
  213. {
  214. - THD *thd= YYTHD;
  215. LEX *lex= thd->lex;
  216. /* return back to the original memory root ASAP */
  217. @@ -2198,11 +2185,10 @@
  218. $$= new sp_name($1, $3, true);
  219. if ($$ == NULL)
  220. MYSQL_YYABORT;
  221. - $$->init_qname(YYTHD);
  222. + $$->init_qname(thd);
  223. }
  224. | ident
  225. {
  226. - THD *thd= YYTHD;
  227. LEX *lex= thd->lex;
  228. LEX_STRING db;
  229. if (check_routine_name(&$1))
  230. @@ -2272,7 +2258,7 @@
  231. lex->sql_command= SQLCOM_CALL;
  232. lex->spname= $2;
  233. lex->value_list.empty();
  234. - sp_add_used_routine(lex, YYTHD, $2, TYPE_ENUM_PROCEDURE);
  235. + sp_add_used_routine(lex, thd, $2, TYPE_ENUM_PROCEDURE);
  236. }
  237. opt_sp_cparam_list {}
  238. ;
  239. @@ -2345,7 +2331,7 @@
  240. (enum enum_field_types)$3,
  241. sp_param_in);
  242. - if (lex->sphead->fill_field_definition(YYTHD, lex,
  243. + if (lex->sphead->fill_field_definition(thd, lex,
  244. (enum enum_field_types) $3,
  245. &spvar->field_def))
  246. {
  247. @@ -2382,7 +2368,7 @@
  248. (enum enum_field_types)$4,
  249. (sp_param_mode_t)$1);
  250. - if (lex->sphead->fill_field_definition(YYTHD, lex,
  251. + if (lex->sphead->fill_field_definition(thd, lex,
  252. (enum enum_field_types) $4,
  253. &spvar->field_def))
  254. {
  255. @@ -2445,13 +2431,12 @@
  256. {
  257. LEX *lex= Lex;
  258. - lex->sphead->reset_lex(YYTHD);
  259. + lex->sphead->reset_lex(thd);
  260. lex->spcont->declare_var_boundary($2);
  261. }
  262. type
  263. sp_opt_default
  264. {
  265. - THD *thd= YYTHD;
  266. LEX *lex= Lex;
  267. sp_pcontext *pctx= lex->spcont;
  268. uint num_vars= pctx->context_var_count();
  269. @@ -2477,7 +2462,7 @@
  270. spvar->type= var_type;
  271. spvar->dflt= dflt_value_item;
  272. - if (lex->sphead->fill_field_definition(YYTHD, lex, var_type,
  273. + if (lex->sphead->fill_field_definition(thd, lex, var_type,
  274. &spvar->field_def))
  275. {
  276. MYSQL_YYABORT;
  277. @@ -2501,7 +2486,7 @@
  278. }
  279. pctx->declare_var_boundary(0);
  280. - if (lex->sphead->restore_lex(YYTHD))
  281. + if (lex->sphead->restore_lex(thd))
  282. MYSQL_YYABORT;
  283. $$.vars= $2;
  284. $$.conds= $$.hndlrs= $$.curs= 0;
  285. @@ -2516,7 +2501,7 @@
  286. my_error(ER_SP_DUP_COND, MYF(0), $2.str);
  287. MYSQL_YYABORT;
  288. }
  289. - if(YYTHD->lex->spcont->push_cond(&$2, $5))
  290. + if(thd->lex->spcont->push_cond(&$2, $5))
  291. MYSQL_YYABORT;
  292. $$.vars= $$.hndlrs= $$.curs= 0;
  293. $$.conds= 1;
  294. @@ -2602,7 +2587,7 @@
  295. sp_cursor_stmt:
  296. {
  297. - Lex->sphead->reset_lex(YYTHD);
  298. + Lex->sphead->reset_lex(thd);
  299. }
  300. select
  301. {
  302. @@ -2618,7 +2603,7 @@
  303. }
  304. lex->sp_lex_in_use= TRUE;
  305. $$= lex;
  306. - if (lex->sphead->restore_lex(YYTHD))
  307. + if (lex->sphead->restore_lex(thd))
  308. MYSQL_YYABORT;
  309. }
  310. ;
  311. @@ -2662,7 +2647,7 @@
  312. sp_cond:
  313. ulong_num
  314. { /* mysql errno */
  315. - $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t));
  316. + $$= (sp_cond_type_t *)thd->alloc(sizeof(sp_cond_type_t));
  317. if ($$ == NULL)
  318. MYSQL_YYABORT;
  319. $$->type= sp_cond_type_t::number;
  320. @@ -2675,7 +2660,7 @@
  321. my_error(ER_SP_BAD_SQLSTATE, MYF(0), $3.str);
  322. MYSQL_YYABORT;
  323. }
  324. - $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t));
  325. + $$= (sp_cond_type_t *)thd->alloc(sizeof(sp_cond_type_t));
  326. if ($$ == NULL)
  327. MYSQL_YYABORT;
  328. $$->type= sp_cond_type_t::state;
  329. @@ -2705,21 +2690,21 @@
  330. }
  331. | SQLWARNING_SYM /* SQLSTATEs 01??? */
  332. {
  333. - $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t));
  334. + $$= (sp_cond_type_t *)thd->alloc(sizeof(sp_cond_type_t));
  335. if ($$ == NULL)
  336. MYSQL_YYABORT;
  337. $$->type= sp_cond_type_t::warning;
  338. }
  339. | not FOUND_SYM /* SQLSTATEs 02??? */
  340. {
  341. - $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t));
  342. + $$= (sp_cond_type_t *)thd->alloc(sizeof(sp_cond_type_t));
  343. if ($$ == NULL)
  344. MYSQL_YYABORT;
  345. $$->type= sp_cond_type_t::notfound;
  346. }
  347. | SQLEXCEPTION_SYM /* All other SQLSTATEs */
  348. {
  349. - $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t));
  350. + $$= (sp_cond_type_t *)thd->alloc(sizeof(sp_cond_type_t));
  351. if ($$ == NULL)
  352. MYSQL_YYABORT;
  353. $$->type= sp_cond_type_t::exception;
  354. @@ -2789,7 +2774,6 @@
  355. sp_proc_stmt_statement:
  356. {
  357. - THD *thd= YYTHD;
  358. LEX *lex= thd->lex;
  359. Lex_input_stream *lip= YYLIP;
  360. @@ -2798,7 +2782,6 @@
  361. }
  362. statement
  363. {
  364. - THD *thd= YYTHD;
  365. LEX *lex= thd->lex;
  366. Lex_input_stream *lip= YYLIP;
  367. sp_head *sp= lex->sphead;
  368. @@ -2845,7 +2828,7 @@
  369. sp_proc_stmt_return:
  370. RETURN_SYM
  371. - { Lex->sphead->reset_lex(YYTHD); }
  372. + { Lex->sphead->reset_lex(thd); }
  373. expr
  374. {
  375. LEX *lex= Lex;
  376. @@ -2867,7 +2850,7 @@
  377. MYSQL_YYABORT;
  378. sp->m_flags|= sp_head::HAS_RETURN;
  379. }
  380. - if (sp->restore_lex(YYTHD))
  381. + if (sp->restore_lex(thd))
  382. MYSQL_YYABORT;
  383. }
  384. ;
  385. @@ -3094,7 +3077,7 @@
  386. ;
  387. sp_if:
  388. - { Lex->sphead->reset_lex(YYTHD); }
  389. + { Lex->sphead->reset_lex(thd); }
  390. expr THEN_SYM
  391. {
  392. LEX *lex= Lex;
  393. @@ -3108,7 +3091,7 @@
  394. sp->add_cont_backpatch(i) ||
  395. sp->add_instr(i))
  396. MYSQL_YYABORT;
  397. - if (sp->restore_lex(YYTHD))
  398. + if (sp->restore_lex(thd))
  399. MYSQL_YYABORT;
  400. }
  401. sp_proc_stmts1
  402. @@ -3147,7 +3130,7 @@
  403. {
  404. LEX *lex= Lex;
  405. case_stmt_action_case(lex);
  406. - lex->sphead->reset_lex(YYTHD); /* For expr $3 */
  407. + lex->sphead->reset_lex(thd); /* For expr $3 */
  408. }
  409. expr
  410. {
  411. @@ -3156,7 +3139,7 @@
  412. MYSQL_YYABORT;
  413. /* For expr $3 */
  414. - if (lex->sphead->restore_lex(YYTHD))
  415. + if (lex->sphead->restore_lex(thd))
  416. MYSQL_YYABORT;
  417. }
  418. simple_when_clause_list
  419. @@ -3198,7 +3181,7 @@
  420. simple_when_clause:
  421. WHEN_SYM
  422. {
  423. - Lex->sphead->reset_lex(YYTHD); /* For expr $3 */
  424. + Lex->sphead->reset_lex(thd); /* For expr $3 */
  425. }
  426. expr
  427. {
  428. @@ -3208,7 +3191,7 @@
  429. if (case_stmt_action_when(lex, $3, true))
  430. MYSQL_YYABORT;
  431. /* For expr $3 */
  432. - if (lex->sphead->restore_lex(YYTHD))
  433. + if (lex->sphead->restore_lex(thd))
  434. MYSQL_YYABORT;
  435. }
  436. THEN_SYM
  437. @@ -3223,7 +3206,7 @@
  438. searched_when_clause:
  439. WHEN_SYM
  440. {
  441. - Lex->sphead->reset_lex(YYTHD); /* For expr $3 */
  442. + Lex->sphead->reset_lex(thd); /* For expr $3 */
  443. }
  444. expr
  445. {
  446. @@ -3231,7 +3214,7 @@
  447. if (case_stmt_action_when(lex, $3, false))
  448. MYSQL_YYABORT;
  449. /* For expr $3 */
  450. - if (lex->sphead->restore_lex(YYTHD))
  451. + if (lex->sphead->restore_lex(thd))
  452. MYSQL_YYABORT;
  453. }
  454. THEN_SYM
  455. @@ -3395,7 +3378,7 @@
  456. MYSQL_YYABORT;
  457. }
  458. | WHILE_SYM
  459. - { Lex->sphead->reset_lex(YYTHD); }
  460. + { Lex->sphead->reset_lex(thd); }
  461. expr DO_SYM
  462. {
  463. LEX *lex= Lex;
  464. @@ -3409,7 +3392,7 @@
  465. sp->new_cont_backpatch(i) ||
  466. sp->add_instr(i))
  467. MYSQL_YYABORT;
  468. - if (sp->restore_lex(YYTHD))
  469. + if (sp->restore_lex(thd))
  470. MYSQL_YYABORT;
  471. }
  472. sp_proc_stmts1 END WHILE_SYM
  473. @@ -3424,7 +3407,7 @@
  474. lex->sphead->do_cont_backpatch();
  475. }
  476. | REPEAT_SYM sp_proc_stmts1 UNTIL_SYM
  477. - { Lex->sphead->reset_lex(YYTHD); }
  478. + { Lex->sphead->reset_lex(thd); }
  479. expr END REPEAT_SYM
  480. {
  481. LEX *lex= Lex;
  482. @@ -3436,7 +3419,7 @@
  483. if (i == NULL ||
  484. lex->sphead->add_instr(i))
  485. MYSQL_YYABORT;
  486. - if (lex->sphead->restore_lex(YYTHD))
  487. + if (lex->sphead->restore_lex(thd))
  488. MYSQL_YYABORT;
  489. /* We can shortcut the cont_backpatch here */
  490. i->m_cont_dest= ip+1;
  491. @@ -3859,7 +3842,6 @@
  492. create3 {}
  493. | LIKE table_ident
  494. {
  495. - THD *thd= YYTHD;
  496. TABLE_LIST *src_table;
  497. LEX *lex= thd->lex;
  498. @@ -3873,7 +3855,6 @@
  499. }
  500. | '(' LIKE table_ident ')'
  501. {
  502. - THD *thd= YYTHD;
  503. TABLE_LIST *src_table;
  504. LEX *lex= thd->lex;
  505. @@ -4342,7 +4323,6 @@
  506. bit_expr
  507. {
  508. Item *part_expr= $1;
  509. - THD *thd= YYTHD;
  510. LEX *lex= thd->lex;
  511. Name_resolution_context *context= &lex->current_select->context;
  512. TABLE_LIST *save_list= context->table_list;
  513. @@ -4364,7 +4344,7 @@
  514. my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
  515. MYSQL_YYABORT;
  516. }
  517. - if (part_expr->fix_fields(YYTHD, (Item**)0) ||
  518. + if (part_expr->fix_fields(thd, (Item**)0) ||
  519. ((context->table_list= save_list), FALSE) ||
  520. (!part_expr->const_item()) ||
  521. (!lex->safe_to_cache_query))
  522. @@ -4629,7 +4609,7 @@
  523. | TYPE_SYM opt_equal storage_engines
  524. {
  525. Lex->create_info.db_type= $3;
  526. - WARN_DEPRECATED(yythd, "6.0", "TYPE=storage_engine",
  527. + WARN_DEPRECATED(thd, "6.0", "TYPE=storage_engine",
  528. "'ENGINE=storage_engine'");
  529. Lex->create_info.used_fields|= HA_CREATE_USED_ENGINE;
  530. }
  531. @@ -4791,19 +4771,19 @@
  532. storage_engines:
  533. ident_or_text
  534. {
  535. - plugin_ref plugin= ha_resolve_by_name(YYTHD, &$1);
  536. + plugin_ref plugin= ha_resolve_by_name(thd, &$1);
  537. if (plugin)
  538. $$= plugin_data(plugin, handlerton*);
  539. else
  540. {
  541. - if (YYTHD->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION)
  542. + if (thd->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION)
  543. {
  544. my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str);
  545. MYSQL_YYABORT;
  546. }
  547. $$= 0;
  548. - push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN,
  549. + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
  550. ER_UNKNOWN_STORAGE_ENGINE,
  551. ER(ER_UNKNOWN_STORAGE_ENGINE),
  552. $1.str);
  553. @@ -4815,7 +4795,7 @@
  554. ident_or_text
  555. {
  556. plugin_ref plugin;
  557. - if ((plugin= ha_resolve_by_name(YYTHD, &$1)))
  558. + if ((plugin= ha_resolve_by_name(thd, &$1)))
  559. $$= plugin_data(plugin, handlerton*);
  560. else
  561. {
  562. @@ -5043,7 +5023,7 @@
  563. {
  564. char buff[sizeof("YEAR()") + MY_INT64_NUM_DECIMAL_DIGITS + 1];
  565. my_snprintf(buff, sizeof(buff), "YEAR(%lu)", length);
  566. - push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_NOTE,
  567. + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
  568. ER_WARN_DEPRECATED_SYNTAX,
  569. ER(ER_WARN_DEPRECATED_SYNTAX),
  570. buff, "YEAR(4)");
  571. @@ -5057,7 +5037,7 @@
  572. { $$=MYSQL_TYPE_TIME; }
  573. | TIMESTAMP opt_field_length
  574. {
  575. - if (YYTHD->variables.sql_mode & MODE_MAXDB)
  576. + if (thd->variables.sql_mode & MODE_MAXDB)
  577. $$=MYSQL_TYPE_DATETIME;
  578. else
  579. {
  580. @@ -5189,7 +5169,7 @@
  581. real_type:
  582. REAL
  583. {
  584. - $$= YYTHD->variables.sql_mode & MODE_REAL_AS_FLOAT ?
  585. + $$= thd->variables.sql_mode & MODE_REAL_AS_FLOAT ?
  586. MYSQL_TYPE_FLOAT : MYSQL_TYPE_DOUBLE;
  587. }
  588. | DOUBLE_SYM
  589. @@ -5263,7 +5243,7 @@
  590. | DEFAULT now_or_signed_literal { Lex->default_value=$2; }
  591. | ON UPDATE_SYM NOW_SYM optional_braces
  592. {
  593. - Item *item= new (YYTHD->mem_root) Item_func_now_local();
  594. + Item *item= new (thd->mem_root) Item_func_now_local();
  595. if (item == NULL)
  596. MYSQL_YYABORT;
  597. Lex->on_update_value= item;
  598. @@ -5312,7 +5292,7 @@
  599. now_or_signed_literal:
  600. NOW_SYM optional_braces
  601. {
  602. - $$= new (YYTHD->mem_root) Item_func_now_local();
  603. + $$= new (thd->mem_root) Item_func_now_local();
  604. if ($$ == NULL)
  605. MYSQL_YYABORT;
  606. }
  607. @@ -5673,7 +5653,6 @@
  608. alter:
  609. ALTER opt_ignore TABLE_SYM table_ident
  610. {
  611. - THD *thd= YYTHD;
  612. LEX *lex= thd->lex;
  613. lex->name.str= 0;
  614. lex->name.length= 0;
  615. @@ -5799,7 +5778,7 @@
  616. Event_parse_data.
  617. */
  618. - if (!(Lex->event_parse_data= Event_parse_data::new_instance(YYTHD)))
  619. + if (!(Lex->event_parse_data= Event_parse_data::new_instance(thd)))
  620. MYSQL_YYABORT;
  621. Lex->event_parse_data->identifier= $4;
  622. @@ -6192,7 +6171,6 @@
  623. {
  624. if (!$4)
  625. {
  626. - THD *thd= YYTHD;
  627. $4= thd->variables.collation_database;
  628. }
  629. $5= $5 ? $5 : $4;
  630. @@ -6556,7 +6534,7 @@
  631. assign_to_keycache:
  632. table_ident cache_keys_spec
  633. {
  634. - if (!Select->add_table_to_list(YYTHD, $1, NULL, 0, TL_READ,
  635. + if (!Select->add_table_to_list(thd, $1, NULL, 0, TL_READ,
  636. Select->pop_index_hints()))
  637. MYSQL_YYABORT;
  638. }
  639. @@ -6585,7 +6563,7 @@
  640. preload_keys:
  641. table_ident cache_keys_spec opt_ignore_leaves
  642. {
  643. - if (!Select->add_table_to_list(YYTHD, $1, NULL, $3, TL_READ,
  644. + if (!Select->add_table_to_list(thd, $1, NULL, $3, TL_READ,
  645. Select->pop_index_hints()))
  646. MYSQL_YYABORT;
  647. }
  648. @@ -6593,7 +6571,7 @@
  649. cache_keys_spec:
  650. {
  651. - Lex->select_lex.alloc_index_hints(YYTHD);
  652. + Lex->select_lex.alloc_index_hints(thd);
  653. Select->set_index_hint_type(INDEX_HINT_USE,
  654. global_system_variables.old_mode ?
  655. INDEX_HINT_MASK_JOIN :
  656. @@ -6813,7 +6791,6 @@
  657. | select_item
  658. | '*'
  659. {
  660. - THD *thd= YYTHD;
  661. Item *item= new (thd->mem_root)
  662. Item_field(&thd->lex->current_select->context,
  663. NULL, NULL, "*");
  664. @@ -6828,7 +6805,6 @@
  665. select_item:
  666. remember_name select_item2 remember_end select_alias
  667. {
  668. - THD *thd= YYTHD;
  669. DBUG_ASSERT($1 < $3);
  670. if (add_item_to_list(thd, $2))
  671. @@ -6929,7 +6905,7 @@
  672. else
  673. {
  674. /* X OR Y */
  675. - $$ = new (YYTHD->mem_root) Item_cond_or($1, $3);
  676. + $$ = new (thd->mem_root) Item_cond_or($1, $3);
  677. if ($$ == NULL)
  678. MYSQL_YYABORT;
  679. }
  680. @@ -6937,7 +6913,7 @@
  681. | expr XOR expr %prec XOR
  682. {
  683. /* XOR is a proprietary extension */
  684. - $$ = new (YYTHD->mem_root) Item_cond_xor($1, $3);
  685. + $$ = new (thd->mem_root) Item_cond_xor($1, $3);
  686. if ($$ == NULL)
  687. MYSQL_YYABORT;
  688. }
  689. @@ -6979,50 +6955,50 @@
  690. else
  691. {
  692. /* X AND Y */
  693. - $$ = new (YYTHD->mem_root) Item_cond_and($1, $3);
  694. + $$ = new (thd->mem_root) Item_cond_and($1, $3);
  695. if ($$ == NULL)
  696. MYSQL_YYABORT;
  697. }
  698. }
  699. | NOT_SYM expr %prec NOT_SYM
  700. {
  701. - $$= negate_expression(YYTHD, $2);
  702. + $$= negate_expression(thd, $2);
  703. if ($$ == NULL)
  704. MYSQL_YYABORT;
  705. }
  706. | bool_pri IS TRUE_SYM %prec IS
  707. {
  708. - $$= new (YYTHD->mem_root) Item_func_istrue($1);
  709. + $$= new (thd->mem_root) Item_func_istrue($1);
  710. if ($$ == NULL)
  711. MYSQL_YYABORT;
  712. }
  713. | bool_pri IS not TRUE_SYM %prec IS
  714. {
  715. - $$= new (YYTHD->mem_root) Item_func_isnottrue($1);
  716. + $$= new (thd->mem_root) Item_func_isnottrue($1);
  717. if ($$ == NULL)
  718. MYSQL_YYABORT;
  719. }
  720. | bool_pri IS FALSE_SYM %prec IS
  721. {
  722. - $$= new (YYTHD->mem_root) Item_func_isfalse($1);
  723. + $$= new (thd->mem_root) Item_func_isfalse($1);
  724. if ($$ == NULL)
  725. MYSQL_YYABORT;
  726. }
  727. | bool_pri IS not FALSE_SYM %prec IS
  728. {
  729. - $$= new (YYTHD->mem_root) Item_func_isnotfalse($1);
  730. + $$= new (thd->mem_root) Item_func_isnotfalse($1);
  731. if ($$ == NULL)
  732. MYSQL_YYABORT;
  733. }
  734. | bool_pri IS UNKNOWN_SYM %prec IS
  735. {
  736. - $$= new (YYTHD->mem_root) Item_func_isnull($1);
  737. + $$= new (thd->mem_root) Item_func_isnull($1);
  738. if ($$ == NULL)
  739. MYSQL_YYABORT;
  740. }
  741. | bool_pri IS not UNKNOWN_SYM %prec IS
  742. {
  743. - $$= new (YYTHD->mem_root) Item_func_isnotnull($1);
  744. + $$= new (thd->mem_root) Item_func_isnotnull($1);
  745. if ($$ == NULL)
  746. MYSQL_YYABORT;
  747. }
  748. @@ -7032,19 +7008,19 @@
  749. bool_pri:
  750. bool_pri IS NULL_SYM %prec IS
  751. {
  752. - $$= new (YYTHD->mem_root) Item_func_isnull($1);
  753. + $$= new (thd->mem_root) Item_func_isnull($1);
  754. if ($$ == NULL)
  755. MYSQL_YYABORT;
  756. }
  757. | bool_pri IS not NULL_SYM %prec IS
  758. {
  759. - $$= new (YYTHD->mem_root) Item_func_isnotnull($1);
  760. + $$= new (thd->mem_root) Item_func_isnotnull($1);
  761. if ($$ == NULL)
  762. MYSQL_YYABORT;
  763. }
  764. | bool_pri EQUAL_SYM predicate %prec EQUAL_SYM
  765. {
  766. - $$= new (YYTHD->mem_root) Item_func_equal($1,$3);
  767. + $$= new (thd->mem_root) Item_func_equal($1,$3);
  768. if ($$ == NULL)
  769. MYSQL_YYABORT;
  770. }
  771. @@ -7066,13 +7042,12 @@
  772. predicate:
  773. bit_expr IN_SYM '(' subselect ')'
  774. {
  775. - $$= new (YYTHD->mem_root) Item_in_subselect($1, $4);
  776. + $$= new (thd->mem_root) Item_in_subselect($1, $4);
  777. if ($$ == NULL)
  778. MYSQL_YYABORT;
  779. }
  780. | bit_expr not IN_SYM '(' subselect ')'
  781. {
  782. - THD *thd= YYTHD;
  783. Item *item= new (thd->mem_root) Item_in_subselect($1, $5);
  784. if (item == NULL)
  785. MYSQL_YYABORT;
  786. @@ -7082,7 +7057,7 @@
  787. }
  788. | bit_expr IN_SYM '(' expr ')'
  789. {
  790. - $$= handle_sql2003_note184_exception(YYTHD, $1, true, $4);
  791. + $$= handle_sql2003_note184_exception(thd, $1, true, $4);
  792. if ($$ == NULL)
  793. MYSQL_YYABORT;
  794. }
  795. @@ -7090,13 +7065,13 @@
  796. {
  797. $6->push_front($4);
  798. $6->push_front($1);
  799. - $$= new (YYTHD->mem_root) Item_func_in(*$6);
  800. + $$= new (thd->mem_root) Item_func_in(*$6);
  801. if ($$ == NULL)
  802. MYSQL_YYABORT;
  803. }
  804. | bit_expr not IN_SYM '(' expr ')'
  805. {
  806. - $$= handle_sql2003_note184_exception(YYTHD, $1, false, $5);
  807. + $$= handle_sql2003_note184_exception(thd, $1, false, $5);
  808. if ($$ == NULL)
  809. MYSQL_YYABORT;
  810. }
  811. @@ -7104,7 +7079,7 @@
  812. {
  813. $7->push_front($5);
  814. $7->push_front($1);
  815. - Item_func_in *item = new (YYTHD->mem_root) Item_func_in(*$7);
  816. + Item_func_in *item = new (thd->mem_root) Item_func_in(*$7);
  817. if (item == NULL)
  818. MYSQL_YYABORT;
  819. item->negate();
  820. @@ -7112,14 +7087,14 @@
  821. }
  822. | bit_expr BETWEEN_SYM bit_expr AND_SYM predicate
  823. {
  824. - $$= new (YYTHD->mem_root) Item_func_between($1,$3,$5);
  825. + $$= new (thd->mem_root) Item_func_between($1,$3,$5);
  826. if ($$ == NULL)
  827. MYSQL_YYABORT;
  828. }
  829. | bit_expr not BETWEEN_SYM bit_expr AND_SYM predicate
  830. {
  831. Item_func_between *item;
  832. - item= new (YYTHD->mem_root) Item_func_between($1,$4,$6);
  833. + item= new (thd->mem_root) Item_func_between($1,$4,$6);
  834. if (item == NULL)
  835. MYSQL_YYABORT;
  836. item->negate();
  837. @@ -7127,42 +7102,42 @@
  838. }
  839. | bit_expr SOUNDS_SYM LIKE bit_expr
  840. {
  841. - Item *item1= new (YYTHD->mem_root) Item_func_soundex($1);
  842. - Item *item4= new (YYTHD->mem_root) Item_func_soundex($4);
  843. + Item *item1= new (thd->mem_root) Item_func_soundex($1);
  844. + Item *item4= new (thd->mem_root) Item_func_soundex($4);
  845. if ((item1 == NULL) || (item4 == NULL))
  846. MYSQL_YYABORT;
  847. - $$= new (YYTHD->mem_root) Item_func_eq(item1, item4);
  848. + $$= new (thd->mem_root) Item_func_eq(item1, item4);
  849. if ($$ == NULL)
  850. MYSQL_YYABORT;
  851. }
  852. | bit_expr LIKE simple_expr opt_escape
  853. {
  854. - $$= new (YYTHD->mem_root) Item_func_like($1,$3,$4,Lex->escape_used);
  855. + $$= new (thd->mem_root) Item_func_like($1,$3,$4,Lex->escape_used);
  856. if ($$ == NULL)
  857. MYSQL_YYABORT;
  858. }
  859. | bit_expr not LIKE simple_expr opt_escape
  860. {
  861. - Item *item= new (YYTHD->mem_root) Item_func_like($1,$4,$5,
  862. + Item *item= new (thd->mem_root) Item_func_like($1,$4,$5,
  863. Lex->escape_used);
  864. if (item == NULL)
  865. MYSQL_YYABORT;
  866. - $$= new (YYTHD->mem_root) Item_func_not(item);
  867. + $$= new (thd->mem_root) Item_func_not(item);
  868. if ($$ == NULL)
  869. MYSQL_YYABORT;
  870. }
  871. | bit_expr REGEXP bit_expr
  872. {
  873. - $$= new (YYTHD->mem_root) Item_func_regex($1,$3);
  874. + $$= new (thd->mem_root) Item_func_regex($1,$3);
  875. if ($$ == NULL)
  876. MYSQL_YYABORT;
  877. }
  878. | bit_expr not REGEXP bit_expr
  879. {
  880. - Item *item= new (YYTHD->mem_root) Item_func_regex($1,$4);
  881. + Item *item= new (thd->mem_root) Item_func_regex($1,$4);
  882. if (item == NULL)
  883. MYSQL_YYABORT;
  884. - $$= negate_expression(YYTHD, item);
  885. + $$= negate_expression(thd, item);
  886. if ($$ == NULL)
  887. MYSQL_YYABORT;
  888. }
  889. @@ -7172,85 +7147,85 @@
  890. bit_expr:
  891. bit_expr '|' bit_expr %prec '|'
  892. {
  893. - $$= new (YYTHD->mem_root) Item_func_bit_or($1,$3);
  894. + $$= new (thd->mem_root) Item_func_bit_or($1,$3);
  895. if ($$ == NULL)
  896. MYSQL_YYABORT;
  897. }
  898. | bit_expr '&' bit_expr %prec '&'
  899. {
  900. - $$= new (YYTHD->mem_root) Item_func_bit_and($1,$3);
  901. + $$= new (thd->mem_root) Item_func_bit_and($1,$3);
  902. if ($$ == NULL)
  903. MYSQL_YYABORT;
  904. }
  905. | bit_expr SHIFT_LEFT bit_expr %prec SHIFT_LEFT
  906. {
  907. - $$= new (YYTHD->mem_root) Item_func_shift_left($1,$3);
  908. + $$= new (thd->mem_root) Item_func_shift_left($1,$3);
  909. if ($$ == NULL)
  910. MYSQL_YYABORT;
  911. }
  912. | bit_expr SHIFT_RIGHT bit_expr %prec SHIFT_RIGHT
  913. {
  914. - $$= new (YYTHD->mem_root) Item_func_shift_right($1,$3);
  915. + $$= new (thd->mem_root) Item_func_shift_right($1,$3);
  916. if ($$ == NULL)
  917. MYSQL_YYABORT;
  918. }
  919. | bit_expr '+' bit_expr %prec '+'
  920. {
  921. - $$= new (YYTHD->mem_root) Item_func_plus($1,$3);
  922. + $$= new (thd->mem_root) Item_func_plus($1,$3);
  923. if ($$ == NULL)
  924. MYSQL_YYABORT;
  925. }
  926. | bit_expr '-' bit_expr %prec '-'
  927. {
  928. - $$= new (YYTHD->mem_root) Item_func_minus($1,$3);
  929. + $$= new (thd->mem_root) Item_func_minus($1,$3);
  930. if ($$ == NULL)
  931. MYSQL_YYABORT;
  932. }
  933. | bit_expr '+' INTERVAL_SYM expr interval %prec '+'
  934. {
  935. - $$= new (YYTHD->mem_root) Item_date_add_interval($1,$4,$5,0);
  936. + $$= new (thd->mem_root) Item_date_add_interval($1,$4,$5,0);
  937. if ($$ == NULL)
  938. MYSQL_YYABORT;
  939. }
  940. | bit_expr '-' INTERVAL_SYM expr interval %prec '-'
  941. {
  942. - $$= new (YYTHD->mem_root) Item_date_add_interval($1,$4,$5,1);
  943. + $$= new (thd->mem_root) Item_date_add_interval($1,$4,$5,1);
  944. if ($$ == NULL)
  945. MYSQL_YYABORT;
  946. }
  947. | bit_expr '*' bit_expr %prec '*'
  948. {
  949. - $$= new (YYTHD->mem_root) Item_func_mul($1,$3);
  950. + $$= new (thd->mem_root) Item_func_mul($1,$3);
  951. if ($$ == NULL)
  952. MYSQL_YYABORT;
  953. }
  954. | bit_expr '/' bit_expr %prec '/'
  955. {
  956. - $$= new (YYTHD->mem_root) Item_func_div($1,$3);
  957. + $$= new (thd->mem_root) Item_func_div($1,$3);
  958. if ($$ == NULL)
  959. MYSQL_YYABORT;
  960. }
  961. | bit_expr '%' bit_expr %prec '%'
  962. {
  963. - $$= new (YYTHD->mem_root) Item_func_mod($1,$3);
  964. + $$= new (thd->mem_root) Item_func_mod($1,$3);
  965. if ($$ == NULL)
  966. MYSQL_YYABORT;
  967. }
  968. | bit_expr DIV_SYM bit_expr %prec DIV_SYM
  969. {
  970. - $$= new (YYTHD->mem_root) Item_func_int_div($1,$3);
  971. + $$= new (thd->mem_root) Item_func_int_div($1,$3);
  972. if ($$ == NULL)
  973. MYSQL_YYABORT;
  974. }
  975. | bit_expr MOD_SYM bit_expr %prec MOD_SYM
  976. {
  977. - $$= new (YYTHD->mem_root) Item_func_mod($1,$3);
  978. + $$= new (thd->mem_root) Item_func_mod($1,$3);
  979. if ($$ == NULL)
  980. MYSQL_YYABORT;
  981. }
  982. | bit_expr '^' bit_expr
  983. {
  984. - $$= new (YYTHD->mem_root) Item_func_bit_xor($1,$3);
  985. + $$= new (thd->mem_root) Item_func_bit_xor($1,$3);
  986. if ($$ == NULL)
  987. MYSQL_YYABORT;
  988. }
  989. @@ -7299,7 +7274,6 @@
  990. | function_call_conflict
  991. | simple_expr COLLATE_SYM ident_or_text %prec NEG
  992. {
  993. - THD *thd= YYTHD;
  994. Item *i1= new (thd->mem_root) Item_string($3.str,
  995. $3.length,
  996. thd->charset());
  997. @@ -7315,7 +7289,7 @@
  998. | sum_expr
  999. | simple_expr OR_OR_SYM simple_expr
  1000. {
  1001. - $$= new (YYTHD->mem_root) Item_func_concat($1, $3);
  1002. + $$= new (thd->mem_root) Item_func_concat($1, $3);
  1003. if ($$ == NULL)
  1004. MYSQL_YYABORT;
  1005. }
  1006. @@ -7325,25 +7299,25 @@
  1007. }
  1008. | '-' simple_expr %prec NEG
  1009. {
  1010. - $$= new (YYTHD->mem_root) Item_func_neg($2);
  1011. + $$= new (thd->mem_root) Item_func_neg($2);
  1012. if ($$ == NULL)
  1013. MYSQL_YYABORT;
  1014. }
  1015. | '~' simple_expr %prec NEG
  1016. {
  1017. - $$= new (YYTHD->mem_root) Item_func_bit_neg($2);
  1018. + $$= new (thd->mem_root) Item_func_bit_neg($2);
  1019. if ($$ == NULL)
  1020. MYSQL_YYABORT;
  1021. }
  1022. | not2 simple_expr %prec NEG
  1023. {
  1024. - $$= negate_expression(YYTHD, $2);
  1025. + $$= negate_expression(thd, $2);
  1026. if ($$ == NULL)
  1027. MYSQL_YYABORT;
  1028. }
  1029. | '(' subselect ')'
  1030. {
  1031. - $$= new (YYTHD->mem_root) Item_singlerow_subselect($2);
  1032. + $$= new (thd->mem_root) Item_singlerow_subselect($2);
  1033. if ($$ == NULL)
  1034. MYSQL_YYABORT;
  1035. }
  1036. @@ -7352,20 +7326,20 @@
  1037. | '(' expr ',' expr_list ')'
  1038. {
  1039. $4->push_front($2);
  1040. - $$= new (YYTHD->mem_root) Item_row(*$4);
  1041. + $$= new (thd->mem_root) Item_row(*$4);
  1042. if ($$ == NULL)
  1043. MYSQL_YYABORT;
  1044. }
  1045. | ROW_SYM '(' expr ',' expr_list ')'
  1046. {
  1047. $5->push_front($3);
  1048. - $$= new (YYTHD->mem_root) Item_row(*$5);
  1049. + $$= new (thd->mem_root) Item_row(*$5);
  1050. if ($$ == NULL)
  1051. MYSQL_YYABORT;
  1052. }
  1053. | EXISTS '(' subselect ')'
  1054. {
  1055. - $$= new (YYTHD->mem_root) Item_exists_subselect($3);
  1056. + $$= new (thd->mem_root) Item_exists_subselect($3);
  1057. if ($$ == NULL)
  1058. MYSQL_YYABORT;
  1059. }
  1060. @@ -7374,7 +7348,7 @@
  1061. | MATCH ident_list_arg AGAINST '(' bit_expr fulltext_options ')'
  1062. {
  1063. $2->push_front($5);
  1064. - Item_func_match *i1= new (YYTHD->mem_root) Item_func_match(*$2, $6);
  1065. + Item_func_match *i1= new (thd->mem_root) Item_func_match(*$2, $6);
  1066. if (i1 == NULL)
  1067. MYSQL_YYABORT;
  1068. Select->add_ftfunc_to_list(i1);
  1069. @@ -7382,7 +7356,7 @@
  1070. }
  1071. | BINARY simple_expr %prec NEG
  1072. {
  1073. - $$= create_func_cast(YYTHD, $2, ITEM_CAST_CHAR, NULL, NULL,
  1074. + $$= create_func_cast(thd, $2, ITEM_CAST_CHAR, NULL, NULL,
  1075. &my_charset_bin);
  1076. if ($$ == NULL)
  1077. MYSQL_YYABORT;
  1078. @@ -7390,27 +7364,27 @@
  1079. | CAST_SYM '(' expr AS cast_type ')'
  1080. {
  1081. LEX *lex= Lex;
  1082. - $$= create_func_cast(YYTHD, $3, $5, lex->length, lex->dec,
  1083. + $$= create_func_cast(thd, $3, $5, lex->length, lex->dec,
  1084. lex->charset);
  1085. if ($$ == NULL)
  1086. MYSQL_YYABORT;
  1087. }
  1088. | CASE_SYM opt_expr when_list opt_else END
  1089. {
  1090. - $$= new (YYTHD->mem_root) Item_func_case(* $3, $2, $4 );
  1091. + $$= new (thd->mem_root) Item_func_case(* $3, $2, $4 );
  1092. if ($$ == NULL)
  1093. MYSQL_YYABORT;
  1094. }
  1095. | CONVERT_SYM '(' expr ',' cast_type ')'
  1096. {
  1097. - $$= create_func_cast(YYTHD, $3, $5, Lex->length, Lex->dec,
  1098. + $$= create_func_cast(thd, $3, $5, Lex->length, Lex->dec,
  1099. Lex->charset);
  1100. if ($$ == NULL)
  1101. MYSQL_YYABORT;
  1102. }
  1103. | CONVERT_SYM '(' expr USING charset_name ')'
  1104. {
  1105. - $$= new (YYTHD->mem_root) Item_func_conv_charset($3,$5);
  1106. + $$= new (thd->mem_root) Item_func_conv_charset($3,$5);
  1107. if ($$ == NULL)
  1108. MYSQL_YYABORT;
  1109. }
  1110. @@ -7423,14 +7397,14 @@
  1111. my_error(ER_WRONG_COLUMN_NAME, MYF(0), il->my_name()->str);
  1112. MYSQL_YYABORT;
  1113. }
  1114. - $$= new (YYTHD->mem_root) Item_default_value(Lex->current_context(),
  1115. + $$= new (thd->mem_root) Item_default_value(Lex->current_context(),
  1116. $3);
  1117. if ($$ == NULL)
  1118. MYSQL_YYABORT;
  1119. }
  1120. | VALUES '(' simple_ident_nospvar ')'
  1121. {
  1122. - $$= new (YYTHD->mem_root) Item_insert_value(Lex->current_context(),
  1123. + $$= new (thd->mem_root) Item_insert_value(Lex->current_context(),
  1124. $3);
  1125. if ($$ == NULL)
  1126. MYSQL_YYABORT;
  1127. @@ -7438,7 +7412,7 @@
  1128. | INTERVAL_SYM expr interval '+' expr %prec INTERVAL_SYM
  1129. /* we cannot put interval before - */
  1130. {
  1131. - $$= new (YYTHD->mem_root) Item_date_add_interval($5,$2,$3,0);
  1132. + $$= new (thd->mem_root) Item_date_add_interval($5,$2,$3,0);
  1133. if ($$ == NULL)
  1134. MYSQL_YYABORT;
  1135. }
  1136. @@ -7453,19 +7427,19 @@
  1137. function_call_keyword:
  1138. CHAR_SYM '(' expr_list ')'
  1139. {
  1140. - $$= new (YYTHD->mem_root) Item_func_char(*$3);
  1141. + $$= new (thd->mem_root) Item_func_char(*$3);
  1142. if ($$ == NULL)
  1143. MYSQL_YYABORT;
  1144. }
  1145. | CHAR_SYM '(' expr_list USING charset_name ')'
  1146. {
  1147. - $$= new (YYTHD->mem_root) Item_func_char(*$3, $5);
  1148. + $$= new (thd->mem_root) Item_func_char(*$3, $5);
  1149. if ($$ == NULL)
  1150. MYSQL_YYABORT;
  1151. }
  1152. | CURRENT_USER optional_braces
  1153. {
  1154. - $$= new (YYTHD->mem_root) Item_func_current_user(Lex->current_context());
  1155. + $$= new (thd->mem_root) Item_func_current_user(Lex->current_context());
  1156. if ($$ == NULL)
  1157. MYSQL_YYABORT;
  1158. Lex->set_stmt_unsafe();
  1159. @@ -7473,31 +7447,30 @@
  1160. }
  1161. | DATE_SYM '(' expr ')'
  1162. {
  1163. - $$= new (YYTHD->mem_root) Item_date_typecast($3);
  1164. + $$= new (thd->mem_root) Item_date_typecast($3);
  1165. if ($$ == NULL)
  1166. MYSQL_YYABORT;
  1167. }
  1168. | DAY_SYM '(' expr ')'
  1169. {
  1170. - $$= new (YYTHD->mem_root) Item_func_dayofmonth($3);
  1171. + $$= new (thd->mem_root) Item_func_dayofmonth($3);
  1172. if ($$ == NULL)
  1173. MYSQL_YYABORT;
  1174. }
  1175. | HOUR_SYM '(' expr ')'
  1176. {
  1177. - $$= new (YYTHD->mem_root) Item_func_hour($3);
  1178. + $$= new (thd->mem_root) Item_func_hour($3);
  1179. if ($$ == NULL)
  1180. MYSQL_YYABORT;
  1181. }
  1182. | INSERT '(' expr ',' expr ',' expr ',' expr ')'
  1183. {
  1184. - $$= new (YYTHD->mem_root) Item_func_insert($3,$5,$7,$9);
  1185. + $$= new (thd->mem_root) Item_func_insert($3,$5,$7,$9);
  1186. if ($$ == NULL)
  1187. MYSQL_YYABORT;
  1188. }
  1189. | INTERVAL_SYM '(' expr ',' expr ')' %prec INTERVAL_SYM
  1190. {
  1191. - THD *thd= YYTHD;
  1192. List<Item> *list= new (thd->mem_root) List<Item>;
  1193. if (list == NULL)
  1194. MYSQL_YYABORT;
  1195. @@ -7512,7 +7485,6 @@
  1196. }
  1197. | INTERVAL_SYM '(' expr ',' expr ',' expr_list ')' %prec INTERVAL_SYM
  1198. {
  1199. - THD *thd= YYTHD;
  1200. $7->push_front($5);
  1201. $7->push_front($3);
  1202. Item_row *item= new (thd->mem_root) Item_row(*$7);
  1203. @@ -7524,103 +7496,103 @@
  1204. }
  1205. | LEFT '(' expr ',' expr ')'
  1206. {
  1207. - $$= new (YYTHD->mem_root) Item_func_left($3,$5);
  1208. + $$= new (thd->mem_root) Item_func_left($3,$5);
  1209. if ($$ == NULL)
  1210. MYSQL_YYABORT;
  1211. }
  1212. | MINUTE_SYM '(' expr ')'
  1213. {
  1214. - $$= new (YYTHD->mem_root) Item_func_minute($3);
  1215. + $$= new (thd->mem_root) Item_func_minute($3);
  1216. if ($$ == NULL)
  1217. MYSQL_YYABORT;
  1218. }
  1219. | MONTH_SYM '(' expr ')'
  1220. {
  1221. - $$= new (YYTHD->mem_root) Item_func_month($3);
  1222. + $$= new (thd->mem_root) Item_func_month($3);
  1223. if ($$ == NULL)
  1224. MYSQL_YYABORT;
  1225. }
  1226. | RIGHT '(' expr ',' expr ')'
  1227. {
  1228. - $$= new (YYTHD->mem_root) Item_func_right($3,$5);
  1229. + $$= new (thd->mem_root) Item_func_right($3,$5);
  1230. if ($$ == NULL)
  1231. MYSQL_YYABORT;
  1232. }
  1233. | SECOND_SYM '(' expr ')'
  1234. {
  1235. - $$= new (YYTHD->mem_root) Item_func_second($3);
  1236. + $$= new (thd->mem_root) Item_func_second($3);
  1237. if ($$ == NULL)
  1238. MYSQL_YYABORT;
  1239. }
  1240. | TIME_SYM '(' expr ')'
  1241. {
  1242. - $$= new (YYTHD->mem_root) Item_time_typecast($3);
  1243. + $$= new (thd->mem_root) Item_time_typecast($3);
  1244. if ($$ == NULL)
  1245. MYSQL_YYABORT;
  1246. }
  1247. | TIMESTAMP '(' expr ')'
  1248. {
  1249. - $$= new (YYTHD->mem_root) Item_datetime_typecast($3);
  1250. + $$= new (thd->mem_root) Item_datetime_typecast($3);
  1251. if ($$ == NULL)
  1252. MYSQL_YYABORT;
  1253. }
  1254. | TIMESTAMP '(' expr ',' expr ')'
  1255. {
  1256. - $$= new (YYTHD->mem_root) Item_func_add_time($3, $5, 1, 0);
  1257. + $$= new (thd->mem_root) Item_func_add_time($3, $5, 1, 0);
  1258. if ($$ == NULL)
  1259. MYSQL_YYABORT;
  1260. }
  1261. | TRIM '(' expr ')'
  1262. {
  1263. - $$= new (YYTHD->mem_root) Item_func_trim($3);
  1264. + $$= new (thd->mem_root) Item_func_trim($3);
  1265. if ($$ == NULL)
  1266. MYSQL_YYABORT;
  1267. }
  1268. | TRIM '(' LEADING expr FROM expr ')'
  1269. {
  1270. - $$= new (YYTHD->mem_root) Item_func_ltrim($6,$4);
  1271. + $$= new (thd->mem_root) Item_func_ltrim($6,$4);
  1272. if ($$ == NULL)
  1273. MYSQL_YYABORT;
  1274. }
  1275. | TRIM '(' TRAILING expr FROM expr ')'
  1276. {
  1277. - $$= new (YYTHD->mem_root) Item_func_rtrim($6,$4);
  1278. + $$= new (thd->mem_root) Item_func_rtrim($6,$4);
  1279. if ($$ == NULL)
  1280. MYSQL_YYABORT;
  1281. }
  1282. | TRIM '(' BOTH expr FROM expr ')'
  1283. {
  1284. - $$= new (YYTHD->mem_root) Item_func_trim($6,$4);
  1285. + $$= new (thd->mem_root) Item_func_trim($6,$4);
  1286. if ($$ == NULL)
  1287. MYSQL_YYABORT;
  1288. }
  1289. | TRIM '(' LEADING FROM expr ')'
  1290. {
  1291. - $$= new (YYTHD->mem_root) Item_func_ltrim($5);
  1292. + $$= new (thd->mem_root) Item_func_ltrim($5);
  1293. if ($$ == NULL)
  1294. MYSQL_YYABORT;
  1295. }
  1296. | TRIM '(' TRAILING FROM expr ')'
  1297. {
  1298. - $$= new (YYTHD->mem_root) Item_func_rtrim($5);
  1299. + $$= new (thd->mem_root) Item_func_rtrim($5);
  1300. if ($$ == NULL)
  1301. MYSQL_YYABORT;
  1302. }
  1303. | TRIM '(' BOTH FROM expr ')'
  1304. {
  1305. - $$= new (YYTHD->mem_root) Item_func_trim($5);
  1306. + $$= new (thd->mem_root) Item_func_trim($5);
  1307. if ($$ == NULL)
  1308. MYSQL_YYABORT;
  1309. }
  1310. | TRIM '(' expr FROM expr ')'
  1311. {
  1312. - $$= new (YYTHD->mem_root) Item_func_trim($5,$3);
  1313. + $$= new (thd->mem_root) Item_func_trim($5,$3);
  1314. if ($$ == NULL)
  1315. MYSQL_YYABORT;
  1316. }
  1317. | USER '(' ')'
  1318. {
  1319. - $$= new (YYTHD->mem_root) Item_func_user();
  1320. + $$= new (thd->mem_root) Item_func_user();
  1321. if ($$ == NULL)
  1322. MYSQL_YYABORT;
  1323. Lex->set_stmt_unsafe();
  1324. @@ -7628,7 +7600,7 @@
  1325. }
  1326. | YEAR_SYM '(' expr ')'
  1327. {
  1328. - $$= new (YYTHD->mem_root) Item_func_year($3);
  1329. + $$= new (thd->mem_root) Item_func_year($3);
  1330. if ($$ == NULL)
  1331. MYSQL_YYABORT;
  1332. }
  1333. @@ -7649,34 +7621,34 @@
  1334. function_call_nonkeyword:
  1335. ADDDATE_SYM '(' expr ',' expr ')'
  1336. {
  1337. - $$= new (YYTHD->mem_root) Item_date_add_interval($3, $5,
  1338. + $$= new (thd->mem_root) Item_date_add_interval($3, $5,
  1339. INTERVAL_DAY, 0);
  1340. if ($$ == NULL)
  1341. MYSQL_YYABORT;
  1342. }
  1343. | ADDDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')'
  1344. {
  1345. - $$= new (YYTHD->mem_root) Item_date_add_interval($3, $6, $7, 0);
  1346. + $$= new (thd->mem_root) Item_date_add_interval($3, $6, $7, 0);
  1347. if ($$ == NULL)
  1348. MYSQL_YYABORT;
  1349. }
  1350. | CURDATE optional_braces
  1351. {
  1352. - $$= new (YYTHD->mem_root) Item_func_curdate_local();
  1353. + $$= new (thd->mem_root) Item_func_curdate_local();
  1354. if ($$ == NULL)
  1355. MYSQL_YYABORT;
  1356. Lex->safe_to_cache_query=0;
  1357. }
  1358. | CURTIME optional_braces
  1359. {
  1360. - $$= new (YYTHD->mem_root) Item_func_curtime_local();
  1361. + $$= new (thd->mem_root) Item_func_curtime_local();
  1362. if ($$ == NULL)
  1363. MYSQL_YYABORT;
  1364. Lex->safe_to_cache_query=0;
  1365. }
  1366. | CURTIME '(' expr ')'
  1367. {
  1368. - $$= new (YYTHD->mem_root) Item_func_curtime_local($3);
  1369. + $$= new (thd->mem_root) Item_func_curtime_local($3);
  1370. if ($$ == NULL)
  1371. MYSQL_YYABORT;
  1372. Lex->safe_to_cache_query=0;
  1373. @@ -7684,83 +7656,83 @@
  1374. | DATE_ADD_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')'
  1375. %prec INTERVAL_SYM
  1376. {
  1377. - $$= new (YYTHD->mem_root) Item_date_add_interval($3,$6,$7,0);
  1378. + $$= new (thd->mem_root) Item_date_add_interval($3,$6,$7,0);
  1379. if ($$ == NULL)
  1380. MYSQL_YYABORT;