MySQL 5.6.14 Source Code Document
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
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
113
pars_get_lex_chars
(
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
*
130
pars_variable_declaration
(
131
/*======================*/
132
sym_node_t
* node,
134
pars_res_word_t
*
type
);
135
/*********************************************************************/
138
UNIV_INTERN
139
func_node_t
*
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
159
func_node_t
*
160
pars_op
(
161
/*====*/
162
int
func,
163
que_node_t* arg1,
164
que_node_t* arg2);
166
/*********************************************************************/
169
UNIV_INTERN
170
order_node_t
*
171
pars_order_by
(
172
/*==========*/
173
sym_node_t
* column,
174
pars_res_word_t
* asc);
175
/*********************************************************************/
179
UNIV_INTERN
180
sel_node_t
*
181
pars_select_list
(
182
/*=============*/
183
que_node_t* select_list,
184
sym_node_t
* into_list);
185
/*********************************************************************/
188
UNIV_INTERN
189
que_node_t*
190
pars_cursor_declaration
(
191
/*====================*/
192
sym_node_t
* sym_node,
194
sel_node_t
* select_node);
195
/*********************************************************************/
198
UNIV_INTERN
199
que_node_t*
200
pars_function_declaration
(
201
/*======================*/
202
sym_node_t
* sym_node);
204
/*********************************************************************/
207
UNIV_INTERN
208
sel_node_t
*
209
pars_select_statement
(
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
223
col_assign_node_t
*
224
pars_column_assignment
(
225
/*===================*/
226
sym_node_t
* column,
227
que_node_t* exp);
228
/*********************************************************************/
231
UNIV_INTERN
232
upd_node_t
*
233
pars_update_statement_start
(
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
*
244
pars_update_statement
(
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
*
255
pars_insert_statement
(
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
*
265
pars_parameter_declaration
(
266
/*=======================*/
267
sym_node_t
* node,
269
ulint param_type,
271
pars_res_word_t
*
type
);
272
/*********************************************************************/
275
UNIV_INTERN
276
elsif_node_t
*
277
pars_elsif_element
(
278
/*===============*/
279
que_node_t* cond,
280
que_node_t* stat_list);
281
/*********************************************************************/
284
UNIV_INTERN
285
if_node_t
*
286
pars_if_statement
(
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
*
296
pars_for_statement
(
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
306
while_node_t
*
307
pars_while_statement
(
308
/*=================*/
309
que_node_t* cond,
310
que_node_t* stat_list);
311
/*********************************************************************/
314
UNIV_INTERN
315
exit_node_t
*
316
pars_exit_statement
(
void
);
317
/*=====================*/
318
/*********************************************************************/
321
UNIV_INTERN
322
return_node_t
*
323
pars_return_statement
(
void
);
324
/*=======================*/
325
/*********************************************************************/
328
UNIV_INTERN
329
func_node_t
*
330
pars_procedure_call
(
331
/*================*/
332
que_node_t* res_word,
333
que_node_t* args);
334
/*********************************************************************/
337
UNIV_INTERN
338
assign_node_t
*
339
pars_assignment_statement
(
340
/*======================*/
341
sym_node_t
* var,
342
que_node_t* val);
343
/*********************************************************************/
347
UNIV_INTERN
348
fetch_node_t
*
349
pars_fetch_statement
(
350
/*=================*/
351
sym_node_t
*
cursor
,
352
sym_node_t
* into_list,
353
sym_node_t
* user_func);
354
/*********************************************************************/
357
UNIV_INTERN
358
open_node_t
*
359
pars_open_statement
(
360
/*================*/
361
ulint
type
,
363
sym_node_t
*
cursor
);
364
/*********************************************************************/
367
UNIV_INTERN
368
row_printf_node_t
*
369
pars_row_printf_statement
(
370
/*======================*/
371
sel_node_t
* sel_node);
372
/*********************************************************************/
375
UNIV_INTERN
376
commit_node_t
*
377
pars_commit_statement
(
void
);
378
/*=======================*/
379
/*********************************************************************/
382
UNIV_INTERN
383
roll_node_t
*
384
pars_rollback_statement
(
void
);
385
/*=========================*/
386
/*********************************************************************/
389
UNIV_INTERN
390
sym_node_t
*
391
pars_column_def
(
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
*
407
pars_create_table
(
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
*
430
pars_create_index
(
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
*
444
pars_procedure_definition
(
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
*
459
pars_stored_procedure_call
(
460
/*=======================*/
461
sym_node_t
* sym_node);
462
/******************************************************************/
467
UNIV_INTERN
468
que_thr_t
*
469
pars_complete_graph_for_exec
(
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
481
pars_info_t
*
482
pars_info_create
(
void
);
483
/*==================*/
484
485
/****************************************************************/
487
UNIV_INTERN
488
void
489
pars_info_free
(
490
/*===========*/
491
pars_info_t
* info);
493
/****************************************************************/
495
UNIV_INTERN
496
void
497
pars_info_add_literal
(
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
512
pars_info_add_str_literal
(
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
535
pars_info_bind_varchar_literal
(
536
/*===========================*/
537
pars_info_t
* info,
538
const
char
*
name
,
539
const
byte* str,
540
ulint str_len);
541
/****************************************************************/
550
UNIV_INTERN
551
void
552
pars_info_bind_int4_literal
(
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
562
pars_info_bind_int8_literal
(
563
/*=======================*/
564
pars_info_t
* info,
565
const
char
*
name
,
566
const
ib_uint64_t* val);
567
/****************************************************************/
569
UNIV_INTERN
570
void
571
pars_info_bind_function
(
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
581
pars_info_bind_id
(
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
598
pars_info_add_int4_literal
(
599
/*=======================*/
600
pars_info_t
* info,
601
const
char
*
name
,
602
lint val);
604
/****************************************************************/
613
UNIV_INTERN
614
void
615
pars_info_add_ull_literal
(
616
/*======================*/
617
pars_info_t
* info,
618
const
char
*
name
,
619
ib_uint64_t val);
621
/****************************************************************/
624
UNIV_INTERN
625
void
626
pars_info_bind_ull_literal
(
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
637
pars_info_add_id
(
638
/*=============*/
639
pars_info_t
* info,
640
const
char
*
name
,
641
const
char
*
id
);
643
/****************************************************************/
646
UNIV_INTERN
647
pars_bound_lit_t
*
648
pars_info_get_bound_lit
(
649
/*====================*/
650
pars_info_t
* info,
651
const
char
*
name
);
653
/****************************************************************/
656
UNIV_INTERN
657
pars_bound_id_t
*
658
pars_info_get_bound_id
(
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
{
672
mem_heap_t
*
heap
;
674
ib_vector_t
*
funcs
;
676
ib_vector_t
*
bound_lits
;
678
ib_vector_t
*
bound_ids
;
681
ibool
graph_owns_us
;
683
};
684
686
struct
pars_user_func_t
{
687
const
char
*
name
;
688
pars_user_func_cb_t
func
;
689
void
*
arg
;
690
};
691
693
struct
pars_bound_lit_t
{
694
const
char
*
name
;
695
const
void
*
address
;
696
ulint
length
;
697
ulint
type
;
698
ulint
prtype
;
699
sym_node_t
*
node
;
700
};
701
703
struct
pars_bound_id_t
{
704
const
char
*
name
;
705
const
char
*
id
;
706
};
707
709
struct
pars_res_word_t
{
710
int
code
;
712
};
713
716
struct
func_node_t
{
717
que_common_t
common
;
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
731
struct
order_node_t
{
732
que_common_t
common
;
733
sym_node_t
*
column
;
734
ibool
asc
;
735
};
736
738
struct
proc_node_t
{
739
que_common_t
common
;
740
sym_node_t
* proc_id;
742
sym_node_t
*
param_list
;
743
que_node_t*
stat_list
;
744
sym_tab_t
*
sym_tab
;
745
};
746
748
struct
elsif_node_t
{
749
que_common_t
common
;
750
que_node_t*
cond
;
751
que_node_t*
stat_list
;
752
};
753
755
struct
if_node_t
{
756
que_common_t
common
;
757
que_node_t*
cond
;
758
que_node_t*
stat_list
;
759
que_node_t*
else_part
;
760
elsif_node_t
*
elsif_list
;
761
};
762
764
struct
while_node_t
{
765
que_common_t
common
;
766
que_node_t*
cond
;
767
que_node_t*
stat_list
;
768
};
769
771
struct
for_node_t
{
772
que_common_t
common
;
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
{
789
que_common_t
common
;
790
};
791
793
struct
return_node_t
{
794
que_common_t
common
;
795
};
796
798
struct
assign_node_t
{
799
que_common_t
common
;
800
sym_node_t
*
var
;
801
que_node_t*
val
;
802
};
803
805
struct
col_assign_node_t
{
806
que_common_t
common
;
807
sym_node_t
*
col
;
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
storage
innobase
include
pars0pars.h
Generated on Sat Nov 9 2013 01:26:35 for MySQL 5.6.14 Source Code Document by
1.8.1.2