InnoDB Plugin  1.0
pars0pars.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free Software
7 Foundation; version 2 of the License.
8 
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc.,
15 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
16 
17 *****************************************************************************/
18 
19 /**************************************************/
26 #ifndef pars0pars_h
27 #define pars0pars_h
28 
29 #include "univ.i"
30 #include "que0types.h"
31 #include "usr0types.h"
32 #include "pars0types.h"
33 #include "row0types.h"
34 #include "trx0types.h"
35 #include "ut0vec.h"
36 
41 typedef ibool (*pars_user_func_cb_t)(void* arg, void* user_arg);
42 
45 extern int yydebug;
46 
47 #ifdef UNIV_SQL_DEBUG
48 
50 extern ibool pars_print_lexed;
51 #endif /* UNIV_SQL_DEBUG */
52 
53 /* Global variable used while parsing a single procedure or query : the code is
54 NOT re-entrant */
55 extern sym_tab_t* pars_sym_tab_global;
56 
57 extern pars_res_word_t pars_to_char_token;
58 extern pars_res_word_t pars_to_number_token;
59 extern pars_res_word_t pars_to_binary_token;
60 extern pars_res_word_t pars_binary_to_number_token;
61 extern pars_res_word_t pars_substr_token;
62 extern pars_res_word_t pars_replstr_token;
63 extern pars_res_word_t pars_concat_token;
64 extern pars_res_word_t pars_length_token;
65 extern pars_res_word_t pars_instr_token;
66 extern pars_res_word_t pars_sysdate_token;
67 extern pars_res_word_t pars_printf_token;
68 extern pars_res_word_t pars_assert_token;
69 extern pars_res_word_t pars_rnd_token;
70 extern pars_res_word_t pars_rnd_str_token;
71 extern pars_res_word_t pars_count_token;
72 extern pars_res_word_t pars_sum_token;
73 extern pars_res_word_t pars_distinct_token;
74 extern pars_res_word_t pars_binary_token;
75 extern pars_res_word_t pars_blob_token;
76 extern pars_res_word_t pars_int_token;
77 extern pars_res_word_t pars_bigint_token;
78 extern pars_res_word_t pars_char_token;
79 extern pars_res_word_t pars_float_token;
80 extern pars_res_word_t pars_update_token;
81 extern pars_res_word_t pars_asc_token;
82 extern pars_res_word_t pars_desc_token;
83 extern pars_res_word_t pars_open_token;
84 extern pars_res_word_t pars_close_token;
85 extern pars_res_word_t pars_share_token;
86 extern pars_res_word_t pars_unique_token;
87 extern pars_res_word_t pars_clustered_token;
88 
89 extern ulint pars_star_denoter;
90 
91 /* Procedure parameter types */
92 #define PARS_INPUT 0
93 #define PARS_OUTPUT 1
94 #define PARS_NOT_PARAM 2
95 
96 int
97 yyparse(void);
98 
99 /*************************************************************/
102 UNIV_INTERN
103 que_t*
104 pars_sql(
105 /*=====*/
106  pars_info_t* info,
107  const char* str);
108 /*************************************************************/
111 UNIV_INTERN
112 int
114 /*===============*/
115  char* buf,
116  int max_size);
118 /*************************************************************/
120 UNIV_INTERN
121 void
122 yyerror(
123 /*====*/
124  const char* s);
125 /*********************************************************************/
128 UNIV_INTERN
129 sym_node_t*
131 /*======================*/
132  sym_node_t* node,
134  pars_res_word_t* type);
135 /*********************************************************************/
138 UNIV_INTERN
140 pars_func(
141 /*======*/
142  que_node_t* res_word,
143  que_node_t* arg);
144 /*************************************************************************
145 Rebind a LIKE search string. NOTE: We ignore any '%' characters embedded
146 within the search string.
147 @return own: function node in a query tree */
148 UNIV_INTERN
149 int
150 pars_like_rebind(
151 /*=============*/
152  sym_node_t* node, /* in: The search string node.*/
153  const byte* ptr, /* in: literal to (re) bind */
154  ulint len); /* in: length of literal to (re) bind*/
155 /*********************************************************************/
158 UNIV_INTERN
160 pars_op(
161 /*====*/
162  int func,
163  que_node_t* arg1,
164  que_node_t* arg2);
166 /*********************************************************************/
169 UNIV_INTERN
172 /*==========*/
173  sym_node_t* column,
174  pars_res_word_t* asc);
175 /*********************************************************************/
179 UNIV_INTERN
180 sel_node_t*
182 /*=============*/
183  que_node_t* select_list,
184  sym_node_t* into_list);
185 /*********************************************************************/
188 UNIV_INTERN
189 que_node_t*
191 /*====================*/
192  sym_node_t* sym_node,
194  sel_node_t* select_node);
195 /*********************************************************************/
198 UNIV_INTERN
199 que_node_t*
201 /*======================*/
202  sym_node_t* sym_node);
204 /*********************************************************************/
207 UNIV_INTERN
208 sel_node_t*
210 /*==================*/
211  sel_node_t* select_node,
213  sym_node_t* table_list,
214  que_node_t* search_cond,
215  pars_res_word_t* for_update,
216  pars_res_word_t* consistent_read,
218  order_node_t* order_by);
219 /*********************************************************************/
222 UNIV_INTERN
225 /*===================*/
226  sym_node_t* column,
227  que_node_t* exp);
228 /*********************************************************************/
231 UNIV_INTERN
232 upd_node_t*
234 /*========================*/
235  ibool is_delete,
236  sym_node_t* table_sym,
237  col_assign_node_t* col_assign_list);
239 /*********************************************************************/
242 UNIV_INTERN
243 upd_node_t*
245 /*==================*/
246  upd_node_t* node,
247  sym_node_t* cursor_sym,
249  que_node_t* search_cond);
250 /*********************************************************************/
253 UNIV_INTERN
254 ins_node_t*
256 /*==================*/
257  sym_node_t* table_sym,
258  que_node_t* values_list,
259  sel_node_t* select);
260 /*********************************************************************/
263 UNIV_INTERN
264 sym_node_t*
266 /*=======================*/
267  sym_node_t* node,
269  ulint param_type,
271  pars_res_word_t* type);
272 /*********************************************************************/
275 UNIV_INTERN
278 /*===============*/
279  que_node_t* cond,
280  que_node_t* stat_list);
281 /*********************************************************************/
284 UNIV_INTERN
285 if_node_t*
287 /*==============*/
288  que_node_t* cond,
289  que_node_t* stat_list,
290  que_node_t* else_part);
291 /*********************************************************************/
294 UNIV_INTERN
295 for_node_t*
297 /*===============*/
298  sym_node_t* loop_var,
299  que_node_t* loop_start_limit,
300  que_node_t* loop_end_limit,
301  que_node_t* stat_list);
302 /*********************************************************************/
305 UNIV_INTERN
308 /*=================*/
309  que_node_t* cond,
310  que_node_t* stat_list);
311 /*********************************************************************/
314 UNIV_INTERN
316 pars_exit_statement(void);
317 /*=====================*/
318 /*********************************************************************/
321 UNIV_INTERN
324 /*=======================*/
325 /*********************************************************************/
328 UNIV_INTERN
331 /*================*/
332  que_node_t* res_word,
333  que_node_t* args);
334 /*********************************************************************/
337 UNIV_INTERN
340 /*======================*/
341  sym_node_t* var,
342  que_node_t* val);
343 /*********************************************************************/
347 UNIV_INTERN
350 /*=================*/
351  sym_node_t* cursor,
352  sym_node_t* into_list,
353  sym_node_t* user_func);
354 /*********************************************************************/
357 UNIV_INTERN
360 /*================*/
361  ulint type,
363  sym_node_t* cursor);
364 /*********************************************************************/
367 UNIV_INTERN
370 /*======================*/
371  sel_node_t* sel_node);
372 /*********************************************************************/
375 UNIV_INTERN
378 /*=======================*/
379 /*********************************************************************/
382 UNIV_INTERN
385 /*=========================*/
386 /*********************************************************************/
389 UNIV_INTERN
390 sym_node_t*
392 /*============*/
393  sym_node_t* sym_node,
395  pars_res_word_t* type,
396  sym_node_t* len,
398  void* is_unsigned,
400  void* is_not_null);
402 /*********************************************************************/
405 UNIV_INTERN
406 tab_node_t*
408 /*==============*/
409  sym_node_t* table_sym,
411  sym_node_t* column_defs,
412  sym_node_t* compact, /* in: non-NULL if COMPACT table. */
413  sym_node_t* block_size, /* in: block size (can be NULL) */
414  void* not_fit_in_memory);
425 /*********************************************************************/
428 UNIV_INTERN
429 ind_node_t*
431 /*==============*/
432  pars_res_word_t* unique_def,
433  pars_res_word_t* clustered_def,
434  sym_node_t* index_sym,
436  sym_node_t* table_sym,
438  sym_node_t* column_list);
439 /*********************************************************************/
442 UNIV_INTERN
443 que_fork_t*
445 /*======================*/
446  sym_node_t* sym_node,
448  sym_node_t* param_list,
449  que_node_t* stat_list);
451 /*************************************************************/
457 UNIV_INTERN
458 que_fork_t*
460 /*=======================*/
461  sym_node_t* sym_node);
462 /******************************************************************/
467 UNIV_INTERN
468 que_thr_t*
470 /*=========================*/
471  que_node_t* node,
473  trx_t* trx,
474  mem_heap_t* heap)
475  __attribute__((nonnull(2,3), warn_unused_result));
476 
477 /****************************************************************/
480 UNIV_INTERN
482 pars_info_create(void);
483 /*==================*/
484 
485 /****************************************************************/
487 UNIV_INTERN
488 void
490 /*===========*/
491  pars_info_t* info);
493 /****************************************************************/
495 UNIV_INTERN
496 void
498 /*==================*/
499  pars_info_t* info,
500  const char* name,
501  const void* address,
502  ulint length,
503  ulint type,
504  ulint prtype);
507 /****************************************************************/
510 UNIV_INTERN
511 void
513 /*======================*/
514  pars_info_t* info,
515  const char* name,
516  const char* str);
517 /********************************************************************
518 If the literal value already exists then it rebinds otherwise it
519 creates a new entry.*/
520 UNIV_INTERN
521 void
522 pars_info_bind_literal(
523 /*===================*/
524  pars_info_t* info, /* in: info struct */
525  const char* name, /* in: name */
526  const void* address, /* in: address */
527  ulint length, /* in: length of data */
528  ulint type, /* in: type, e.g. DATA_FIXBINARY */
529  ulint prtype); /* in: precise type, e.g. */
530 /********************************************************************
531 If the literal value already exists then it rebinds otherwise it
532 creates a new entry.*/
533 UNIV_INTERN
534 void
536 /*===========================*/
537  pars_info_t* info,
538  const char* name,
539  const byte* str,
540  ulint str_len);
541 /****************************************************************/
550 UNIV_INTERN
551 void
553 /*=======================*/
554  pars_info_t* info,
555  const char* name,
556  const ib_uint32_t* val);
557 /********************************************************************
558 If the literal value already exists then it rebinds otherwise it
559 creates a new entry. */
560 UNIV_INTERN
561 void
563 /*=======================*/
564  pars_info_t* info,
565  const char* name,
566  const ib_uint64_t* val);
567 /****************************************************************/
569 UNIV_INTERN
570 void
572 /*===================*/
573  pars_info_t* info,
574  const char* name,
575  pars_user_func_cb_t func,
576  void* arg);
577 /****************************************************************/
579 UNIV_INTERN
580 void
582 /*=============*/
583  pars_info_t* info,
584  ibool copy_name,/* in: make a copy of name if TRUE */
585  const char* name,
586  const char* id);
587 /****************************************************************/
596 UNIV_INTERN
597 void
599 /*=======================*/
600  pars_info_t* info,
601  const char* name,
602  lint val);
604 /****************************************************************/
613 UNIV_INTERN
614 void
616 /*======================*/
617  pars_info_t* info,
618  const char* name,
619  ib_uint64_t val);
621 /****************************************************************/
624 UNIV_INTERN
625 void
627 /*=======================*/
628  pars_info_t* info,
629  const char* name,
630  const ib_uint64_t* val)
631  __attribute__((nonnull));
632 
633 /****************************************************************/
635 UNIV_INTERN
636 void
638 /*=============*/
639  pars_info_t* info,
640  const char* name,
641  const char* id);
643 /****************************************************************/
646 UNIV_INTERN
649 /*====================*/
650  pars_info_t* info,
651  const char* name);
653 /****************************************************************/
656 UNIV_INTERN
659 /*===================*/
660  pars_info_t* info,
661  const char* name);
663 /******************************************************************/
665 UNIV_INTERN
666 void
667 pars_lexer_close(void);
668 /*==================*/
669 
671 struct pars_info_t {
683 };
684 
687  const char* name;
689  void* arg;
690 };
691 
694  const char* name;
695  const void* address;
696  ulint length;
697  ulint type;
698  ulint prtype;
700 };
701 
704  const char* name;
705  const char* id;
706 };
707 
710  int code;
712 };
713 
716 struct func_node_t{
718  int func;
719  ulint fclass;
720  que_node_t* args;
721  UT_LIST_NODE_T(func_node_t) cond_list;
725  UT_LIST_NODE_T(func_node_t) func_node_list;
728 };
729 
735 };
736 
738 struct proc_node_t{
740  sym_node_t* proc_id;
743  que_node_t* stat_list;
745 };
746 
750  que_node_t* cond;
751  que_node_t* stat_list;
752 };
753 
755 struct if_node_t{
757  que_node_t* cond;
758  que_node_t* stat_list;
759  que_node_t* else_part;
761 };
762 
766  que_node_t* cond;
767  que_node_t* stat_list;
768 };
769 
771 struct for_node_t{
773  sym_node_t* loop_var;
778  que_node_t* loop_start_limit;
779  que_node_t* loop_end_limit;
780  lint loop_end_value;
784  que_node_t* stat_list;
785 };
786 
788 struct exit_node_t{
790 };
791 
795 };
796 
801  que_node_t* val;
802 };
803 
808  que_node_t* val;
809 };
810 
812 /* @{ */
813 #define PARS_FUNC_ARITH 1
814 #define PARS_FUNC_LOGICAL 2
815 #define PARS_FUNC_CMP 3
816 #define PARS_FUNC_PREDEFINED 4
817 #define PARS_FUNC_AGGREGATE 5
818 #define PARS_FUNC_OTHER 6
820 /* @} */
821 
822 #ifndef UNIV_NONINL
823 #include "pars0pars.ic"
824 #endif
825 
826 #endif