~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/pars/pars0pars.c

  • Committer: Brian Aker
  • Date: 2009-01-24 09:43:35 UTC
  • Revision ID: brian@gir-3.local-20090124094335-6qdtvc35gl5fvivz
Adding in an example singe thread scheduler

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (c) 1996, 2009, Innobase Oy. 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., 59 Temple
15
 
Place, Suite 330, Boston, MA 02111-1307 USA
16
 
 
17
 
*****************************************************************************/
18
 
 
19
 
/**************************************************//**
20
 
@file pars/pars0pars.c
 
1
/******************************************************
21
2
SQL parser
22
3
 
 
4
(c) 1996 Innobase Oy
 
5
 
23
6
Created 11/19/1996 Heikki Tuuri
24
7
*******************************************************/
25
8
 
52
35
#include "eval0eval.h"
53
36
 
54
37
#ifdef UNIV_SQL_DEBUG
55
 
/** If the following is set TRUE, the lexer will print the SQL string
 
38
/* If the following is set TRUE, the lexer will print the SQL string
56
39
as it tokenizes it */
57
 
UNIV_INTERN ibool       pars_print_lexed        = FALSE;
 
40
 
 
41
ibool   pars_print_lexed        = FALSE;
58
42
#endif /* UNIV_SQL_DEBUG */
59
43
 
60
44
/* Global variable used while parsing a single procedure or query : the code is
95
79
UNIV_INTERN pars_res_word_t     pars_unique_token = {PARS_UNIQUE_TOKEN};
96
80
UNIV_INTERN pars_res_word_t     pars_clustered_token = {PARS_CLUSTERED_TOKEN};
97
81
 
98
 
/** Global variable used to denote the '*' in SELECT * FROM.. */
99
 
UNIV_INTERN ulint       pars_star_denoter       = 12345678;
100
 
 
101
 
 
102
 
/*********************************************************************//**
103
 
Determines the class of a function code.
104
 
@return function class: PARS_FUNC_ARITH, ... */
 
82
/* Global variable used to denote the '*' in SELECT * FROM.. */
 
83
#define PARS_STAR_DENOTER       12345678
 
84
UNIV_INTERN ulint       pars_star_denoter       = PARS_STAR_DENOTER;
 
85
 
 
86
 
 
87
/*************************************************************************
 
88
Determines the class of a function code. */
105
89
static
106
90
ulint
107
91
pars_func_get_class(
108
92
/*================*/
109
 
        int     func)   /*!< in: function code: '=', PARS_GE_TOKEN, ... */
 
93
                        /* out: function class: PARS_FUNC_ARITH, ... */
 
94
        int     func)   /* in: function code: '=', PARS_GE_TOKEN, ... */
110
95
{
111
96
        switch (func) {
112
97
        case '+': case '-': case '*': case '/':
144
129
        }
145
130
}
146
131
 
147
 
/*********************************************************************//**
148
 
Parses an operator or predefined function expression.
149
 
@return own: function node in a query tree */
 
132
/*************************************************************************
 
133
Parses an operator or predefined function expression. */
150
134
static
151
135
func_node_t*
152
136
pars_func_low(
153
137
/*==========*/
154
 
        int             func,   /*!< in: function token code */
155
 
        que_node_t*     arg)    /*!< in: first argument in the argument list */
 
138
                                /* out, own: function node in a query tree */
 
139
        int             func,   /* in: function token code */
 
140
        que_node_t*     arg)    /* in: first argument in the argument list */
156
141
{
157
142
        func_node_t*    node;
158
143
 
173
158
        return(node);
174
159
}
175
160
 
176
 
/*********************************************************************//**
177
 
Parses a function expression.
178
 
@return own: function node in a query tree */
 
161
/*************************************************************************
 
162
Parses a function expression. */
179
163
UNIV_INTERN
180
164
func_node_t*
181
165
pars_func(
182
166
/*======*/
183
 
        que_node_t*     res_word,/*!< in: function name reserved word */
184
 
        que_node_t*     arg)    /*!< in: first argument in the argument list */
 
167
                                /* out, own: function node in a query tree */
 
168
        que_node_t*     res_word,/* in: function name reserved word */
 
169
        que_node_t*     arg)    /* in: first argument in the argument list */
185
170
{
186
171
        return(pars_func_low(((pars_res_word_t*)res_word)->code, arg));
187
172
}
188
173
 
189
 
/*********************************************************************//**
190
 
Parses an operator expression.
191
 
@return own: function node in a query tree */
 
174
/*************************************************************************
 
175
Parses an operator expression. */
192
176
UNIV_INTERN
193
177
func_node_t*
194
178
pars_op(
195
179
/*====*/
196
 
        int             func,   /*!< in: operator token code */
197
 
        que_node_t*     arg1,   /*!< in: first argument */
198
 
        que_node_t*     arg2)   /*!< in: second argument or NULL for an unary
 
180
                                /* out, own: function node in a query tree */
 
181
        int             func,   /* in: operator token code */
 
182
        que_node_t*     arg1,   /* in: first argument */
 
183
        que_node_t*     arg2)   /* in: second argument or NULL for an unary
199
184
                                operator */
200
185
{
201
186
        que_node_list_add_last(NULL, arg1);
207
192
        return(pars_func_low(func, arg1));
208
193
}
209
194
 
210
 
/*********************************************************************//**
211
 
Parses an ORDER BY clause. Order by a single column only is supported.
212
 
@return own: order-by node in a query tree */
 
195
/*************************************************************************
 
196
Parses an ORDER BY clause. Order by a single column only is supported. */
213
197
UNIV_INTERN
214
198
order_node_t*
215
199
pars_order_by(
216
200
/*==========*/
217
 
        sym_node_t*     column, /*!< in: column name */
218
 
        pars_res_word_t* asc)   /*!< in: &pars_asc_token or pars_desc_token */
 
201
                                /* out, own: order-by node in a query tree */
 
202
        sym_node_t*     column, /* in: column name */
 
203
        pars_res_word_t* asc)   /* in: &pars_asc_token or pars_desc_token */
219
204
{
220
205
        order_node_t*   node;
221
206
 
235
220
        return(node);
236
221
}
237
222
 
238
 
/*********************************************************************//**
 
223
/*************************************************************************
239
224
Determine if a data type is a built-in string data type of the InnoDB
240
 
SQL parser.
241
 
@return TRUE if string data type */
 
225
SQL parser. */
242
226
static
243
227
ibool
244
228
pars_is_string_type(
245
229
/*================*/
246
 
        ulint   mtype)  /*!< in: main data type */
 
230
                        /* out: TRUE if string data type */
 
231
        ulint   mtype)  /* in: main data type */
247
232
{
248
233
        switch (mtype) {
249
234
        case DATA_VARCHAR: case DATA_CHAR:
254
239
        return(FALSE);
255
240
}
256
241
 
257
 
/*********************************************************************//**
 
242
/*************************************************************************
258
243
Resolves the data type of a function in an expression. The argument data
259
244
types must already be resolved. */
260
245
static
261
246
void
262
247
pars_resolve_func_data_type(
263
248
/*========================*/
264
 
        func_node_t*    node)   /*!< in: function node */
 
249
        func_node_t*    node)   /* in: function node */
265
250
{
266
251
        que_node_t*     arg;
267
252
 
347
332
        }
348
333
}
349
334
 
350
 
/*********************************************************************//**
 
335
/*************************************************************************
351
336
Resolves the meaning of variables in an expression and the data types of
352
337
functions. It is an error if some identifier cannot be resolved here. */
353
338
static
354
339
void
355
340
pars_resolve_exp_variables_and_types(
356
341
/*=================================*/
357
 
        sel_node_t*     select_node,    /*!< in: select node or NULL; if
 
342
        sel_node_t*     select_node,    /* in: select node or NULL; if
358
343
                                        this is not NULL then the variable
359
344
                                        sym nodes are added to the
360
345
                                        copy_variables list of select_node */
361
 
        que_node_t*     exp_node)       /*!< in: expression */
 
346
        que_node_t*     exp_node)       /* in: expression */
362
347
{
363
348
        func_node_t*    func_node;
364
349
        que_node_t*     arg;
437
422
                        que_node_get_data_type(node));
438
423
}
439
424
 
440
 
/*********************************************************************//**
 
425
/*************************************************************************
441
426
Resolves the meaning of variables in an expression list. It is an error if
442
427
some identifier cannot be resolved here. Resolves also the data types of
443
428
functions. */
445
430
void
446
431
pars_resolve_exp_list_variables_and_types(
447
432
/*======================================*/
448
 
        sel_node_t*     select_node,    /*!< in: select node or NULL */
449
 
        que_node_t*     exp_node)       /*!< in: expression list first node, or
 
433
        sel_node_t*     select_node,    /* in: select node or NULL */
 
434
        que_node_t*     exp_node)       /* in: expression list first node, or
450
435
                                        NULL */
451
436
{
452
437
        while (exp_node) {
456
441
        }
457
442
}
458
443
 
459
 
/*********************************************************************//**
 
444
/*************************************************************************
460
445
Resolves the columns in an expression. */
461
446
static
462
447
void
463
448
pars_resolve_exp_columns(
464
449
/*=====================*/
465
 
        sym_node_t*     table_node,     /*!< in: first node in a table list */
466
 
        que_node_t*     exp_node)       /*!< in: expression */
 
450
        sym_node_t*     table_node,     /* in: first node in a table list */
 
451
        que_node_t*     exp_node)       /* in: expression */
467
452
{
468
453
        func_node_t*    func_node;
469
454
        que_node_t*     arg;
537
522
        }
538
523
}
539
524
 
540
 
/*********************************************************************//**
 
525
/*************************************************************************
541
526
Resolves the meaning of columns in an expression list. */
542
527
static
543
528
void
544
529
pars_resolve_exp_list_columns(
545
530
/*==========================*/
546
 
        sym_node_t*     table_node,     /*!< in: first node in a table list */
547
 
        que_node_t*     exp_node)       /*!< in: expression list first node, or
 
531
        sym_node_t*     table_node,     /* in: first node in a table list */
 
532
        que_node_t*     exp_node)       /* in: expression list first node, or
548
533
                                        NULL */
549
534
{
550
535
        while (exp_node) {
554
539
        }
555
540
}
556
541
 
557
 
/*********************************************************************//**
 
542
/*************************************************************************
558
543
Retrieves the table definition for a table name id. */
559
544
static
560
545
void
561
546
pars_retrieve_table_def(
562
547
/*====================*/
563
 
        sym_node_t*     sym_node)       /*!< in: table node */
 
548
        sym_node_t*     sym_node)       /* in: table node */
564
549
{
565
550
        const char*     table_name;
566
551
 
577
562
        ut_a(sym_node->table);
578
563
}
579
564
 
580
 
/*********************************************************************//**
581
 
Retrieves the table definitions for a list of table name ids.
582
 
@return number of tables */
 
565
/*************************************************************************
 
566
Retrieves the table definitions for a list of table name ids. */
583
567
static
584
568
ulint
585
569
pars_retrieve_table_list_defs(
586
570
/*==========================*/
587
 
        sym_node_t*     sym_node)       /*!< in: first table node in list */
 
571
                                        /* out: number of tables */
 
572
        sym_node_t*     sym_node)       /* in: first table node in list */
588
573
{
589
574
        ulint           count           = 0;
590
575
 
604
589
        return(count);
605
590
}
606
591
 
607
 
/*********************************************************************//**
 
592
/*************************************************************************
608
593
Adds all columns to the select list if the query is SELECT * FROM ... */
609
594
static
610
595
void
611
596
pars_select_all_columns(
612
597
/*====================*/
613
 
        sel_node_t*     select_node)    /*!< in: select node already containing
 
598
        sel_node_t*     select_node)    /* in: select node already containing
614
599
                                        the table list */
615
600
{
616
601
        sym_node_t*     col_node;
641
626
        }
642
627
}
643
628
 
644
 
/*********************************************************************//**
 
629
/*************************************************************************
645
630
Parses a select list; creates a query graph node for the whole SELECT
646
 
statement.
647
 
@return own: select node in a query tree */
 
631
statement. */
648
632
UNIV_INTERN
649
633
sel_node_t*
650
634
pars_select_list(
651
635
/*=============*/
652
 
        que_node_t*     select_list,    /*!< in: select list */
653
 
        sym_node_t*     into_list)      /*!< in: variables list or NULL */
 
636
                                        /* out, own: select node in a query
 
637
                                        tree */
 
638
        que_node_t*     select_list,    /* in: select list */
 
639
        sym_node_t*     into_list)      /* in: variables list or NULL */
654
640
{
655
641
        sel_node_t*     node;
656
642
 
664
650
        return(node);
665
651
}
666
652
 
667
 
/*********************************************************************//**
 
653
/*************************************************************************
668
654
Checks if the query is an aggregate query, in which case the selct list must
669
655
contain only aggregate function items. */
670
656
static
671
657
void
672
658
pars_check_aggregate(
673
659
/*=================*/
674
 
        sel_node_t*     select_node)    /*!< in: select node already containing
 
660
        sel_node_t*     select_node)    /* in: select node already containing
675
661
                                        the select list */
676
662
{
677
663
        que_node_t*     exp_node;
707
693
        }
708
694
}
709
695
 
710
 
/*********************************************************************//**
711
 
Parses a select statement.
712
 
@return own: select node in a query tree */
 
696
/*************************************************************************
 
697
Parses a select statement. */
713
698
UNIV_INTERN
714
699
sel_node_t*
715
700
pars_select_statement(
716
701
/*==================*/
717
 
        sel_node_t*     select_node,    /*!< in: select node already containing
 
702
                                        /* out, own: select node in a query
 
703
                                        tree */
 
704
        sel_node_t*     select_node,    /* in: select node already containing
718
705
                                        the select list */
719
 
        sym_node_t*     table_list,     /*!< in: table list */
720
 
        que_node_t*     search_cond,    /*!< in: search condition or NULL */
721
 
        pars_res_word_t* for_update,    /*!< in: NULL or &pars_update_token */
722
 
        pars_res_word_t* lock_shared,   /*!< in: NULL or &pars_share_token */
723
 
        order_node_t*   order_by)       /*!< in: NULL or an order-by node */
 
706
        sym_node_t*     table_list,     /* in: table list */
 
707
        que_node_t*     search_cond,    /* in: search condition or NULL */
 
708
        pars_res_word_t* for_update,    /* in: NULL or &pars_update_token */
 
709
        pars_res_word_t* lock_shared,   /* in: NULL or &pars_share_token */
 
710
        order_node_t*   order_by)       /* in: NULL or an order-by node */
724
711
{
725
712
        select_node->state = SEL_NODE_OPEN;
726
713
 
790
777
        return(select_node);
791
778
}
792
779
 
793
 
/*********************************************************************//**
794
 
Parses a cursor declaration.
795
 
@return sym_node */
 
780
/*************************************************************************
 
781
Parses a cursor declaration. */
796
782
UNIV_INTERN
797
783
que_node_t*
798
784
pars_cursor_declaration(
799
785
/*====================*/
800
 
        sym_node_t*     sym_node,       /*!< in: cursor id node in the symbol
 
786
                                        /* out: sym_node */
 
787
        sym_node_t*     sym_node,       /* in: cursor id node in the symbol
801
788
                                        table */
802
 
        sel_node_t*     select_node)    /*!< in: select node */
 
789
        sel_node_t*     select_node)    /* in: select node */
803
790
{
804
791
        sym_node->resolved = TRUE;
805
792
        sym_node->token_type = SYM_CURSOR;
811
798
        return(sym_node);
812
799
}
813
800
 
814
 
/*********************************************************************//**
815
 
Parses a function declaration.
816
 
@return sym_node */
 
801
/*************************************************************************
 
802
Parses a function declaration. */
817
803
UNIV_INTERN
818
804
que_node_t*
819
805
pars_function_declaration(
820
806
/*======================*/
821
 
        sym_node_t*     sym_node)       /*!< in: function id node in the symbol
 
807
                                        /* out: sym_node */
 
808
        sym_node_t*     sym_node)       /* in: function id node in the symbol
822
809
                                        table */
823
810
{
824
811
        sym_node->resolved = TRUE;
831
818
        return(sym_node);
832
819
}
833
820
 
834
 
/*********************************************************************//**
835
 
Parses a delete or update statement start.
836
 
@return own: update node in a query tree */
 
821
/*************************************************************************
 
822
Parses a delete or update statement start. */
837
823
UNIV_INTERN
838
824
upd_node_t*
839
825
pars_update_statement_start(
840
826
/*========================*/
841
 
        ibool           is_delete,      /*!< in: TRUE if delete */
842
 
        sym_node_t*     table_sym,      /*!< in: table name node */
843
 
        col_assign_node_t* col_assign_list)/*!< in: column assignment list, NULL
 
827
                                        /* out, own: update node in a query
 
828
                                        tree */
 
829
        ibool           is_delete,      /* in: TRUE if delete */
 
830
        sym_node_t*     table_sym,      /* in: table name node */
 
831
        col_assign_node_t* col_assign_list)/* in: column assignment list, NULL
844
832
                                        if delete */
845
833
{
846
834
        upd_node_t*     node;
855
843
        return(node);
856
844
}
857
845
 
858
 
/*********************************************************************//**
859
 
Parses a column assignment in an update.
860
 
@return column assignment node */
 
846
/*************************************************************************
 
847
Parses a column assignment in an update. */
861
848
UNIV_INTERN
862
849
col_assign_node_t*
863
850
pars_column_assignment(
864
851
/*===================*/
865
 
        sym_node_t*     column, /*!< in: column to assign */
866
 
        que_node_t*     exp)    /*!< in: value to assign */
 
852
                                /* out: column assignment node */
 
853
        sym_node_t*     column, /* in: column to assign */
 
854
        que_node_t*     exp)    /* in: value to assign */
867
855
{
868
856
        col_assign_node_t*      node;
869
857
 
877
865
        return(node);
878
866
}
879
867
 
880
 
/*********************************************************************//**
 
868
/*************************************************************************
881
869
Processes an update node assignment list. */
882
870
static
883
871
void
884
872
pars_process_assign_list(
885
873
/*=====================*/
886
 
        upd_node_t*     node)   /*!< in: update node */
 
874
        upd_node_t*     node)   /* in: update node */
887
875
{
888
876
        col_assign_node_t*      col_assign_list;
889
877
        sym_node_t*             table_sym;
944
932
 
945
933
                if (!dict_col_get_fixed_size(
946
934
                            dict_index_get_nth_col(clust_index,
947
 
                                                   upd_field->field_no),
948
 
                            dict_table_is_comp(node->table))) {
 
935
                                                   upd_field->field_no))) {
949
936
                        changes_field_size = 0;
950
937
                }
951
938
 
964
951
        node->cmpl_info = changes_ord_field | changes_field_size;
965
952
}
966
953
 
967
 
/*********************************************************************//**
968
 
Parses an update or delete statement.
969
 
@return own: update node in a query tree */
 
954
/*************************************************************************
 
955
Parses an update or delete statement. */
970
956
UNIV_INTERN
971
957
upd_node_t*
972
958
pars_update_statement(
973
959
/*==================*/
974
 
        upd_node_t*     node,           /*!< in: update node */
975
 
        sym_node_t*     cursor_sym,     /*!< in: pointer to a cursor entry in
 
960
                                        /* out, own: update node in a query
 
961
                                        tree */
 
962
        upd_node_t*     node,           /* in: update node */
 
963
        sym_node_t*     cursor_sym,     /* in: pointer to a cursor entry in
976
964
                                        the symbol table or NULL */
977
 
        que_node_t*     search_cond)    /*!< in: search condition or NULL */
 
965
        que_node_t*     search_cond)    /* in: search condition or NULL */
978
966
{
979
967
        sym_node_t*     table_sym;
980
968
        sel_node_t*     sel_node;
1047
1035
                node->pcur = &(plan->pcur);
1048
1036
        }
1049
1037
 
 
1038
        if (!node->is_delete && node->searched_update
 
1039
            && (node->cmpl_info & UPD_NODE_NO_SIZE_CHANGE)
 
1040
            && (node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
 
1041
 
 
1042
                /* The select node can perform the update in-place */
 
1043
 
 
1044
                ut_a(plan->asc);
 
1045
 
 
1046
                node->select_will_do_update = TRUE;
 
1047
                sel_node->select_will_do_update = TRUE;
 
1048
                sel_node->latch_mode = BTR_MODIFY_LEAF;
 
1049
        }
 
1050
 
1050
1051
        return(node);
1051
1052
}
1052
1053
 
1053
 
/*********************************************************************//**
1054
 
Parses an insert statement.
1055
 
@return own: update node in a query tree */
 
1054
/*************************************************************************
 
1055
Parses an insert statement. */
1056
1056
UNIV_INTERN
1057
1057
ins_node_t*
1058
1058
pars_insert_statement(
1059
1059
/*==================*/
1060
 
        sym_node_t*     table_sym,      /*!< in: table name node */
1061
 
        que_node_t*     values_list,    /*!< in: value expression list or NULL */
1062
 
        sel_node_t*     select)         /*!< in: select condition or NULL */
 
1060
                                        /* out, own: update node in a query
 
1061
                                        tree */
 
1062
        sym_node_t*     table_sym,      /* in: table name node */
 
1063
        que_node_t*     values_list,    /* in: value expression list or NULL */
 
1064
        sel_node_t*     select)         /* in: select condition or NULL */
1063
1065
{
1064
1066
        ins_node_t*     node;
1065
1067
        dtuple_t*       row;
1107
1109
        return(node);
1108
1110
}
1109
1111
 
1110
 
/*********************************************************************//**
 
1112
/*************************************************************************
1111
1113
Set the type of a dfield. */
1112
1114
static
1113
1115
void
1114
1116
pars_set_dfield_type(
1115
1117
/*=================*/
1116
 
        dfield_t*               dfield,         /*!< in: dfield */
1117
 
        pars_res_word_t*        type,           /*!< in: pointer to a type
 
1118
        dfield_t*               dfield,         /* in: dfield */
 
1119
        pars_res_word_t*        type,           /* in: pointer to a type
1118
1120
                                                token */
1119
 
        ulint                   len,            /*!< in: length, or 0 */
1120
 
        ibool                   is_unsigned,    /*!< in: if TRUE, column is
 
1121
        ulint                   len,            /* in: length, or 0 */
 
1122
        ibool                   is_unsigned,    /* in: if TRUE, column is
1121
1123
                                                UNSIGNED. */
1122
 
        ibool                   is_not_null)    /*!< in: if TRUE, column is
 
1124
        ibool                   is_not_null)    /* in: if TRUE, column is
1123
1125
                                                NOT NULL. */
1124
1126
{
1125
1127
        ulint flags = 0;
1157
1159
        }
1158
1160
}
1159
1161
 
1160
 
/*********************************************************************//**
1161
 
Parses a variable declaration.
1162
 
@return own: symbol table node of type SYM_VAR */
 
1162
/*************************************************************************
 
1163
Parses a variable declaration. */
1163
1164
UNIV_INTERN
1164
1165
sym_node_t*
1165
1166
pars_variable_declaration(
1166
1167
/*======================*/
1167
 
        sym_node_t*     node,   /*!< in: symbol table node allocated for the
 
1168
                                /* out, own: symbol table node of type
 
1169
                                SYM_VAR */
 
1170
        sym_node_t*     node,   /* in: symbol table node allocated for the
1168
1171
                                id of the variable */
1169
 
        pars_res_word_t* type)  /*!< in: pointer to a type token */
 
1172
        pars_res_word_t* type)  /* in: pointer to a type token */
1170
1173
{
1171
1174
        node->resolved = TRUE;
1172
1175
        node->token_type = SYM_VAR;
1178
1181
        return(node);
1179
1182
}
1180
1183
 
1181
 
/*********************************************************************//**
1182
 
Parses a procedure parameter declaration.
1183
 
@return own: symbol table node of type SYM_VAR */
 
1184
/*************************************************************************
 
1185
Parses a procedure parameter declaration. */
1184
1186
UNIV_INTERN
1185
1187
sym_node_t*
1186
1188
pars_parameter_declaration(
1187
1189
/*=======================*/
1188
 
        sym_node_t*     node,   /*!< in: symbol table node allocated for the
 
1190
                                /* out, own: symbol table node of type
 
1191
                                SYM_VAR */
 
1192
        sym_node_t*     node,   /* in: symbol table node allocated for the
1189
1193
                                id of the parameter */
1190
1194
        ulint           param_type,
1191
 
                                /*!< in: PARS_INPUT or PARS_OUTPUT */
1192
 
        pars_res_word_t* type)  /*!< in: pointer to a type token */
 
1195
                                /* in: PARS_INPUT or PARS_OUTPUT */
 
1196
        pars_res_word_t* type)  /* in: pointer to a type token */
1193
1197
{
1194
1198
        ut_a((param_type == PARS_INPUT) || (param_type == PARS_OUTPUT));
1195
1199
 
1200
1204
        return(node);
1201
1205
}
1202
1206
 
1203
 
/*********************************************************************//**
 
1207
/*************************************************************************
1204
1208
Sets the parent field in a query node list. */
1205
1209
static
1206
1210
void
1207
1211
pars_set_parent_in_list(
1208
1212
/*====================*/
1209
 
        que_node_t*     node_list,      /*!< in: first node in a list */
1210
 
        que_node_t*     parent)         /*!< in: parent value to set in all
 
1213
        que_node_t*     node_list,      /* in: first node in a list */
 
1214
        que_node_t*     parent)         /* in: parent value to set in all
1211
1215
                                        nodes of the list */
1212
1216
{
1213
1217
        que_common_t*   common;
1221
1225
        }
1222
1226
}
1223
1227
 
1224
 
/*********************************************************************//**
1225
 
Parses an elsif element.
1226
 
@return elsif node */
 
1228
/*************************************************************************
 
1229
Parses an elsif element. */
1227
1230
UNIV_INTERN
1228
1231
elsif_node_t*
1229
1232
pars_elsif_element(
1230
1233
/*===============*/
1231
 
        que_node_t*     cond,           /*!< in: if-condition */
1232
 
        que_node_t*     stat_list)      /*!< in: statement list */
 
1234
                                        /* out: elsif node */
 
1235
        que_node_t*     cond,           /* in: if-condition */
 
1236
        que_node_t*     stat_list)      /* in: statement list */
1233
1237
{
1234
1238
        elsif_node_t*   node;
1235
1239
 
1246
1250
        return(node);
1247
1251
}
1248
1252
 
1249
 
/*********************************************************************//**
1250
 
Parses an if-statement.
1251
 
@return if-statement node */
 
1253
/*************************************************************************
 
1254
Parses an if-statement. */
1252
1255
UNIV_INTERN
1253
1256
if_node_t*
1254
1257
pars_if_statement(
1255
1258
/*==============*/
1256
 
        que_node_t*     cond,           /*!< in: if-condition */
1257
 
        que_node_t*     stat_list,      /*!< in: statement list */
1258
 
        que_node_t*     else_part)      /*!< in: else-part statement list
 
1259
                                        /* out: if-statement node */
 
1260
        que_node_t*     cond,           /* in: if-condition */
 
1261
        que_node_t*     stat_list,      /* in: statement list */
 
1262
        que_node_t*     else_part)      /* in: else-part statement list
1259
1263
                                        or elsif element list */
1260
1264
{
1261
1265
        if_node_t*      node;
1297
1301
        return(node);
1298
1302
}
1299
1303
 
1300
 
/*********************************************************************//**
1301
 
Parses a while-statement.
1302
 
@return while-statement node */
 
1304
/*************************************************************************
 
1305
Parses a while-statement. */
1303
1306
UNIV_INTERN
1304
1307
while_node_t*
1305
1308
pars_while_statement(
1306
1309
/*=================*/
1307
 
        que_node_t*     cond,           /*!< in: while-condition */
1308
 
        que_node_t*     stat_list)      /*!< in: statement list */
 
1310
                                        /* out: while-statement node */
 
1311
        que_node_t*     cond,           /* in: while-condition */
 
1312
        que_node_t*     stat_list)      /* in: statement list */
1309
1313
{
1310
1314
        while_node_t*   node;
1311
1315
 
1324
1328
        return(node);
1325
1329
}
1326
1330
 
1327
 
/*********************************************************************//**
1328
 
Parses a for-loop-statement.
1329
 
@return for-statement node */
 
1331
/*************************************************************************
 
1332
Parses a for-loop-statement. */
1330
1333
UNIV_INTERN
1331
1334
for_node_t*
1332
1335
pars_for_statement(
1333
1336
/*===============*/
1334
 
        sym_node_t*     loop_var,       /*!< in: loop variable */
1335
 
        que_node_t*     loop_start_limit,/*!< in: loop start expression */
1336
 
        que_node_t*     loop_end_limit, /*!< in: loop end expression */
1337
 
        que_node_t*     stat_list)      /*!< in: statement list */
 
1337
                                        /* out: for-statement node */
 
1338
        sym_node_t*     loop_var,       /* in: loop variable */
 
1339
        que_node_t*     loop_start_limit,/* in: loop start expression */
 
1340
        que_node_t*     loop_end_limit, /* in: loop end expression */
 
1341
        que_node_t*     stat_list)      /* in: statement list */
1338
1342
{
1339
1343
        for_node_t*     node;
1340
1344
 
1360
1364
        return(node);
1361
1365
}
1362
1366
 
1363
 
/*********************************************************************//**
1364
 
Parses an exit statement.
1365
 
@return exit statement node */
 
1367
/*************************************************************************
 
1368
Parses an exit statement. */
1366
1369
UNIV_INTERN
1367
1370
exit_node_t*
1368
1371
pars_exit_statement(void)
1369
1372
/*=====================*/
 
1373
                                        /* out: exit statement node */
1370
1374
{
1371
1375
        exit_node_t*    node;
1372
1376
 
1376
1380
        return(node);
1377
1381
}
1378
1382
 
1379
 
/*********************************************************************//**
1380
 
Parses a return-statement.
1381
 
@return return-statement node */
 
1383
/*************************************************************************
 
1384
Parses a return-statement. */
1382
1385
UNIV_INTERN
1383
1386
return_node_t*
1384
1387
pars_return_statement(void)
1385
1388
/*=======================*/
 
1389
                                        /* out: return-statement node */
1386
1390
{
1387
1391
        return_node_t*  node;
1388
1392
 
1393
1397
        return(node);
1394
1398
}
1395
1399
 
1396
 
/*********************************************************************//**
1397
 
Parses an assignment statement.
1398
 
@return assignment statement node */
 
1400
/*************************************************************************
 
1401
Parses an assignment statement. */
1399
1402
UNIV_INTERN
1400
1403
assign_node_t*
1401
1404
pars_assignment_statement(
1402
1405
/*======================*/
1403
 
        sym_node_t*     var,    /*!< in: variable to assign */
1404
 
        que_node_t*     val)    /*!< in: value to assign */
 
1406
                                /* out: assignment statement node */
 
1407
        sym_node_t*     var,    /* in: variable to assign */
 
1408
        que_node_t*     val)    /* in: value to assign */
1405
1409
{
1406
1410
        assign_node_t*  node;
1407
1411
 
1421
1425
        return(node);
1422
1426
}
1423
1427
 
1424
 
/*********************************************************************//**
1425
 
Parses a procedure call.
1426
 
@return function node */
 
1428
/*************************************************************************
 
1429
Parses a procedure call. */
1427
1430
UNIV_INTERN
1428
1431
func_node_t*
1429
1432
pars_procedure_call(
1430
1433
/*================*/
1431
 
        que_node_t*     res_word,/*!< in: procedure name reserved word */
1432
 
        que_node_t*     args)   /*!< in: argument list */
 
1434
                                /* out: function node */
 
1435
        que_node_t*     res_word,/* in: procedure name reserved word */
 
1436
        que_node_t*     args)   /* in: argument list */
1433
1437
{
1434
1438
        func_node_t*    node;
1435
1439
 
1440
1444
        return(node);
1441
1445
}
1442
1446
 
1443
 
/*********************************************************************//**
 
1447
/*************************************************************************
1444
1448
Parses a fetch statement. into_list or user_func (but not both) must be
1445
 
non-NULL.
1446
 
@return fetch statement node */
 
1449
non-NULL. */
1447
1450
UNIV_INTERN
1448
1451
fetch_node_t*
1449
1452
pars_fetch_statement(
1450
1453
/*=================*/
1451
 
        sym_node_t*     cursor,         /*!< in: cursor node */
1452
 
        sym_node_t*     into_list,      /*!< in: variables to set, or NULL */
1453
 
        sym_node_t*     user_func)      /*!< in: user function name, or NULL */
 
1454
                                        /* out: fetch statement node */
 
1455
        sym_node_t*     cursor,         /* in: cursor node */
 
1456
        sym_node_t*     into_list,      /* in: variables to set, or NULL */
 
1457
        sym_node_t*     user_func)      /* in: user function name, or NULL */
1454
1458
{
1455
1459
        sym_node_t*     cursor_decl;
1456
1460
        fetch_node_t*   node;
1492
1496
        return(node);
1493
1497
}
1494
1498
 
1495
 
/*********************************************************************//**
1496
 
Parses an open or close cursor statement.
1497
 
@return fetch statement node */
 
1499
/*************************************************************************
 
1500
Parses an open or close cursor statement. */
1498
1501
UNIV_INTERN
1499
1502
open_node_t*
1500
1503
pars_open_statement(
1501
1504
/*================*/
1502
 
        ulint           type,   /*!< in: ROW_SEL_OPEN_CURSOR
 
1505
                                /* out: fetch statement node */
 
1506
        ulint           type,   /* in: ROW_SEL_OPEN_CURSOR
1503
1507
                                or ROW_SEL_CLOSE_CURSOR */
1504
 
        sym_node_t*     cursor) /*!< in: cursor node */
 
1508
        sym_node_t*     cursor) /* in: cursor node */
1505
1509
{
1506
1510
        sym_node_t*     cursor_decl;
1507
1511
        open_node_t*    node;
1522
1526
        return(node);
1523
1527
}
1524
1528
 
1525
 
/*********************************************************************//**
1526
 
Parses a row_printf-statement.
1527
 
@return row_printf-statement node */
 
1529
/*************************************************************************
 
1530
Parses a row_printf-statement. */
1528
1531
UNIV_INTERN
1529
1532
row_printf_node_t*
1530
1533
pars_row_printf_statement(
1531
1534
/*======================*/
1532
 
        sel_node_t*     sel_node)       /*!< in: select node */
 
1535
                                        /* out: row_printf-statement node */
 
1536
        sel_node_t*     sel_node)       /* in: select node */
1533
1537
{
1534
1538
        row_printf_node_t*      node;
1535
1539
 
1544
1548
        return(node);
1545
1549
}
1546
1550
 
1547
 
/*********************************************************************//**
1548
 
Parses a commit statement.
1549
 
@return own: commit node struct */
 
1551
/*************************************************************************
 
1552
Parses a commit statement. */
1550
1553
UNIV_INTERN
1551
1554
commit_node_t*
1552
1555
pars_commit_statement(void)
1555
1558
        return(commit_node_create(pars_sym_tab_global->heap));
1556
1559
}
1557
1560
 
1558
 
/*********************************************************************//**
1559
 
Parses a rollback statement.
1560
 
@return own: rollback node struct */
 
1561
/*************************************************************************
 
1562
Parses a rollback statement. */
1561
1563
UNIV_INTERN
1562
1564
roll_node_t*
1563
1565
pars_rollback_statement(void)
1566
1568
        return(roll_node_create(pars_sym_tab_global->heap));
1567
1569
}
1568
1570
 
1569
 
/*********************************************************************//**
1570
 
Parses a column definition at a table creation.
1571
 
@return column sym table node */
 
1571
/*************************************************************************
 
1572
Parses a column definition at a table creation. */
1572
1573
UNIV_INTERN
1573
1574
sym_node_t*
1574
1575
pars_column_def(
1575
1576
/*============*/
1576
 
        sym_node_t*             sym_node,       /*!< in: column node in the
 
1577
                                                /* out: column sym table
 
1578
                                                node */
 
1579
        sym_node_t*             sym_node,       /* in: column node in the
1577
1580
                                                symbol table */
1578
 
        pars_res_word_t*        type,           /*!< in: data type */
1579
 
        sym_node_t*             len,            /*!< in: length of column, or
 
1581
        pars_res_word_t*        type,           /* in: data type */
 
1582
        sym_node_t*             len,            /* in: length of column, or
1580
1583
                                                NULL */
1581
 
        void*                   is_unsigned,    /*!< in: if not NULL, column
 
1584
        void*                   is_unsigned,    /* in: if not NULL, column
1582
1585
                                                is of type UNSIGNED. */
1583
 
        void*                   is_not_null)    /*!< in: if not NULL, column
 
1586
        void*                   is_not_null)    /* in: if not NULL, column
1584
1587
                                                is of type NOT NULL. */
1585
1588
{
1586
1589
        ulint len2;
1597
1600
        return(sym_node);
1598
1601
}
1599
1602
 
1600
 
/*********************************************************************//**
1601
 
Parses a table creation operation.
1602
 
@return table create subgraph */
 
1603
/*************************************************************************
 
1604
Parses a table creation operation. */
1603
1605
UNIV_INTERN
1604
1606
tab_node_t*
1605
1607
pars_create_table(
1606
1608
/*==============*/
1607
 
        sym_node_t*     table_sym,      /*!< in: table name node in the symbol
 
1609
                                        /* out: table create subgraph */
 
1610
        sym_node_t*     table_sym,      /* in: table name node in the symbol
1608
1611
                                        table */
1609
 
        sym_node_t*     column_defs,    /*!< in: list of column names */
 
1612
        sym_node_t*     column_defs,    /* in: list of column names */
1610
1613
        void*           not_fit_in_memory __attribute__((unused)))
1611
 
                                        /*!< in: a non-NULL pointer means that
 
1614
                                        /* in: a non-NULL pointer means that
1612
1615
                                        this is a table which in simulations
1613
1616
                                        should be simulated as not fitting
1614
1617
                                        in memory; thread is put to sleep
1659
1662
        return(node);
1660
1663
}
1661
1664
 
1662
 
/*********************************************************************//**
1663
 
Parses an index creation operation.
1664
 
@return index create subgraph */
 
1665
/*************************************************************************
 
1666
Parses an index creation operation. */
1665
1667
UNIV_INTERN
1666
1668
ind_node_t*
1667
1669
pars_create_index(
1668
1670
/*==============*/
1669
 
        pars_res_word_t* unique_def,    /*!< in: not NULL if a unique index */
1670
 
        pars_res_word_t* clustered_def, /*!< in: not NULL if a clustered index */
1671
 
        sym_node_t*     index_sym,      /*!< in: index name node in the symbol
1672
 
                                        table */
1673
 
        sym_node_t*     table_sym,      /*!< in: table name node in the symbol
1674
 
                                        table */
1675
 
        sym_node_t*     column_list)    /*!< in: list of column names */
 
1671
                                        /* out: index create subgraph */
 
1672
        pars_res_word_t* unique_def,    /* in: not NULL if a unique index */
 
1673
        pars_res_word_t* clustered_def, /* in: not NULL if a clustered index */
 
1674
        sym_node_t*     index_sym,      /* in: index name node in the symbol
 
1675
                                        table */
 
1676
        sym_node_t*     table_sym,      /* in: table name node in the symbol
 
1677
                                        table */
 
1678
        sym_node_t*     column_list)    /* in: list of column names */
1676
1679
{
1677
1680
        dict_index_t*   index;
1678
1681
        sym_node_t*     column;
1716
1719
        return(node);
1717
1720
}
1718
1721
 
1719
 
/*********************************************************************//**
1720
 
Parses a procedure definition.
1721
 
@return query fork node */
 
1722
/*************************************************************************
 
1723
Parses a procedure definition. */
1722
1724
UNIV_INTERN
1723
1725
que_fork_t*
1724
1726
pars_procedure_definition(
1725
1727
/*======================*/
1726
 
        sym_node_t*     sym_node,       /*!< in: procedure id node in the symbol
 
1728
                                        /* out: query fork node */
 
1729
        sym_node_t*     sym_node,       /* in: procedure id node in the symbol
1727
1730
                                        table */
1728
 
        sym_node_t*     param_list,     /*!< in: parameter declaration list */
1729
 
        que_node_t*     stat_list)      /*!< in: statement list */
 
1731
        sym_node_t*     param_list,     /* in: parameter declaration list */
 
1732
        que_node_t*     stat_list)      /* in: statement list */
1730
1733
{
1731
1734
        proc_node_t*    node;
1732
1735
        que_fork_t*     fork;
1763
1766
        return(fork);
1764
1767
}
1765
1768
 
1766
 
/*************************************************************//**
 
1769
/*****************************************************************
1767
1770
Parses a stored procedure call, when this is not within another stored
1768
1771
procedure, that is, the client issues a procedure call directly.
1769
1772
In MySQL/InnoDB, stored InnoDB procedures are invoked via the
1770
 
parsed procedure tree, not via InnoDB SQL, so this function is not used.
1771
 
@return query graph */
 
1773
parsed procedure tree, not via InnoDB SQL, so this function is not used. */
1772
1774
UNIV_INTERN
1773
1775
que_fork_t*
1774
1776
pars_stored_procedure_call(
1775
1777
/*=======================*/
 
1778
                                        /* out: query graph */
1776
1779
        sym_node_t*     sym_node __attribute__((unused)))
1777
 
                                        /*!< in: stored procedure name */
 
1780
                                        /* in: stored procedure name */
1778
1781
{
1779
1782
        ut_error;
1780
1783
        return(NULL);
1781
1784
}
1782
1785
 
1783
 
/*************************************************************//**
 
1786
/*****************************************************************
1784
1787
Retrieves characters to the lexical analyzer. */
1785
1788
UNIV_INTERN
1786
1789
void
1787
1790
pars_get_lex_chars(
1788
1791
/*===============*/
1789
 
        char*   buf,            /*!< in/out: buffer where to copy */
1790
 
        int*    result,         /*!< out: number of characters copied or EOF */
1791
 
        int     max_size)       /*!< in: maximum number of characters which fit
 
1792
        char*   buf,            /* in/out: buffer where to copy */
 
1793
        int*    result,         /* out: number of characters copied or EOF */
 
1794
        int     max_size)       /* in: maximum number of characters which fit
1792
1795
                                in the buffer */
1793
1796
{
1794
1797
        int     len;
1828
1831
        pars_sym_tab_global->next_char_pos += len;
1829
1832
}
1830
1833
 
1831
 
/*************************************************************//**
 
1834
/*****************************************************************
1832
1835
Called by yyparse on error. */
1833
1836
UNIV_INTERN
1834
1837
void
1835
1838
yyerror(
1836
1839
/*====*/
1837
1840
        const char*     s __attribute__((unused)))
1838
 
                                /*!< in: error message string */
 
1841
                                /* in: error message string */
1839
1842
{
1840
1843
        ut_ad(s);
1841
1844
 
1844
1847
        ut_error;
1845
1848
}
1846
1849
 
1847
 
/*************************************************************//**
1848
 
Parses an SQL string returning the query graph.
1849
 
@return own: the query graph */
 
1850
/*****************************************************************
 
1851
Parses an SQL string returning the query graph. */
1850
1852
UNIV_INTERN
1851
1853
que_t*
1852
1854
pars_sql(
1853
1855
/*=====*/
1854
 
        pars_info_t*    info,   /*!< in: extra information, or NULL */
1855
 
        const char*     str)    /*!< in: SQL string */
 
1856
                                /* out, own: the query graph */
 
1857
        pars_info_t*    info,   /* in: extra information, or NULL */
 
1858
        const char*     str)    /* in: SQL string */
1856
1859
{
1857
1860
        sym_node_t*     sym_node;
1858
1861
        mem_heap_t*     heap;
1893
1896
        return(graph);
1894
1897
}
1895
1898
 
1896
 
/******************************************************************//**
 
1899
/**********************************************************************
1897
1900
Completes a query graph by adding query thread and fork nodes
1898
1901
above it and prepares the graph for running. The fork created is of
1899
 
type QUE_FORK_MYSQL_INTERFACE.
1900
 
@return query thread node to run */
 
1902
type QUE_FORK_MYSQL_INTERFACE. */
1901
1903
UNIV_INTERN
1902
1904
que_thr_t*
1903
1905
pars_complete_graph_for_exec(
1904
1906
/*=========================*/
1905
 
        que_node_t*     node,   /*!< in: root node for an incomplete
 
1907
                                /* out: query thread node to run */
 
1908
        que_node_t*     node,   /* in: root node for an incomplete
1906
1909
                                query graph */
1907
 
        trx_t*          trx,    /*!< in: transaction handle */
1908
 
        mem_heap_t*     heap)   /*!< in: memory heap from which allocated */
 
1910
        trx_t*          trx,    /* in: transaction handle */
 
1911
        mem_heap_t*     heap)   /* in: memory heap from which allocated */
1909
1912
{
1910
1913
        que_fork_t*     fork;
1911
1914
        que_thr_t*      thr;
1924
1927
        return(thr);
1925
1928
}
1926
1929
 
1927
 
/****************************************************************//**
1928
 
Create parser info struct.
1929
 
@return own: info struct */
 
1930
/********************************************************************
 
1931
Create parser info struct.*/
1930
1932
UNIV_INTERN
1931
1933
pars_info_t*
1932
1934
pars_info_create(void)
1933
1935
/*==================*/
 
1936
                /* out, own: info struct */
1934
1937
{
1935
1938
        pars_info_t*    info;
1936
1939
        mem_heap_t*     heap;
1948
1951
        return(info);
1949
1952
}
1950
1953
 
1951
 
/****************************************************************//**
1952
 
Free info struct and everything it contains. */
 
1954
/********************************************************************
 
1955
Free info struct and everything it contains.*/
1953
1956
UNIV_INTERN
1954
1957
void
1955
1958
pars_info_free(
1956
1959
/*===========*/
1957
 
        pars_info_t*    info)   /*!< in, own: info struct */
 
1960
        pars_info_t*    info)   /* in: info struct */
1958
1961
{
1959
1962
        mem_heap_free(info->heap);
1960
1963
}
1961
1964
 
1962
 
/****************************************************************//**
 
1965
/********************************************************************
1963
1966
Add bound literal. */
1964
1967
UNIV_INTERN
1965
1968
void
1966
1969
pars_info_add_literal(
1967
1970
/*==================*/
1968
 
        pars_info_t*    info,           /*!< in: info struct */
1969
 
        const char*     name,           /*!< in: name */
1970
 
        const void*     address,        /*!< in: address */
1971
 
        ulint           length,         /*!< in: length of data */
1972
 
        ulint           type,           /*!< in: type, e.g. DATA_FIXBINARY */
1973
 
        ulint           prtype)         /*!< in: precise type, e.g.
 
1971
        pars_info_t*    info,           /* in: info struct */
 
1972
        const char*     name,           /* in: name */
 
1973
        const void*     address,        /* in: address */
 
1974
        ulint           length,         /* in: length of data */
 
1975
        ulint           type,           /* in: type, e.g. DATA_FIXBINARY */
 
1976
        ulint           prtype)         /* in: precise type, e.g.
1974
1977
                                        DATA_UNSIGNED */
1975
1978
{
1976
1979
        pars_bound_lit_t*       pbl;
1992
1995
        ib_vector_push(info->bound_lits, pbl);
1993
1996
}
1994
1997
 
1995
 
/****************************************************************//**
 
1998
/********************************************************************
1996
1999
Equivalent to pars_info_add_literal(info, name, str, strlen(str),
1997
2000
DATA_VARCHAR, DATA_ENGLISH). */
1998
2001
UNIV_INTERN
1999
2002
void
2000
2003
pars_info_add_str_literal(
2001
2004
/*======================*/
2002
 
        pars_info_t*    info,           /*!< in: info struct */
2003
 
        const char*     name,           /*!< in: name */
2004
 
        const char*     str)            /*!< in: string */
 
2005
        pars_info_t*    info,           /* in: info struct */
 
2006
        const char*     name,           /* in: name */
 
2007
        const char*     str)            /* in: string */
2005
2008
{
2006
2009
        pars_info_add_literal(info, name, str, strlen(str),
2007
2010
                              DATA_VARCHAR, DATA_ENGLISH);
2008
2011
}
2009
2012
 
2010
 
/****************************************************************//**
 
2013
/********************************************************************
2011
2014
Equivalent to:
2012
2015
 
2013
2016
char buf[4];
2020
2023
void
2021
2024
pars_info_add_int4_literal(
2022
2025
/*=======================*/
2023
 
        pars_info_t*    info,           /*!< in: info struct */
2024
 
        const char*     name,           /*!< in: name */
2025
 
        lint            val)            /*!< in: value */
 
2026
        pars_info_t*    info,           /* in: info struct */
 
2027
        const char*     name,           /* in: name */
 
2028
        lint            val)            /* in: value */
2026
2029
{
2027
2030
        byte*   buf = mem_heap_alloc(info->heap, 4);
2028
2031
 
2030
2033
        pars_info_add_literal(info, name, buf, 4, DATA_INT, 0);
2031
2034
}
2032
2035
 
2033
 
/****************************************************************//**
 
2036
/********************************************************************
2034
2037
Equivalent to:
2035
2038
 
2036
2039
char buf[8];
2043
2046
void
2044
2047
pars_info_add_dulint_literal(
2045
2048
/*=========================*/
2046
 
        pars_info_t*    info,           /*!< in: info struct */
2047
 
        const char*     name,           /*!< in: name */
2048
 
        dulint          val)            /*!< in: value */
 
2049
        pars_info_t*    info,           /* in: info struct */
 
2050
        const char*     name,           /* in: name */
 
2051
        dulint          val)            /* in: value */
2049
2052
{
2050
2053
        byte*   buf = mem_heap_alloc(info->heap, 8);
2051
2054
 
2054
2057
        pars_info_add_literal(info, name, buf, 8, DATA_FIXBINARY, 0);
2055
2058
}
2056
2059
 
2057
 
/****************************************************************//**
 
2060
/********************************************************************
2058
2061
Add user function. */
2059
2062
UNIV_INTERN
2060
2063
void
2061
2064
pars_info_add_function(
2062
2065
/*===================*/
2063
 
        pars_info_t*            info,   /*!< in: info struct */
2064
 
        const char*             name,   /*!< in: function name */
2065
 
        pars_user_func_cb_t     func,   /*!< in: function address */
2066
 
        void*                   arg)    /*!< in: user-supplied argument */
 
2066
        pars_info_t*            info,   /* in: info struct */
 
2067
        const char*             name,   /* in: function name */
 
2068
        pars_user_func_cb_t     func,   /* in: function address */
 
2069
        void*                   arg)    /* in: user-supplied argument */
2067
2070
{
2068
2071
        pars_user_func_t*       puf;
2069
2072
 
2082
2085
        ib_vector_push(info->funcs, puf);
2083
2086
}
2084
2087
 
2085
 
/****************************************************************//**
 
2088
/********************************************************************
2086
2089
Add bound id. */
2087
2090
UNIV_INTERN
2088
2091
void
2089
2092
pars_info_add_id(
2090
2093
/*=============*/
2091
 
        pars_info_t*    info,           /*!< in: info struct */
2092
 
        const char*     name,           /*!< in: name */
2093
 
        const char*     id)             /*!< in: id */
 
2094
        pars_info_t*    info,           /* in: info struct */
 
2095
        const char*     name,           /* in: name */
 
2096
        const char*     id)             /* in: id */
2094
2097
{
2095
2098
        pars_bound_id_t*        bid;
2096
2099
 
2108
2111
        ib_vector_push(info->bound_ids, bid);
2109
2112
}
2110
2113
 
2111
 
/****************************************************************//**
2112
 
Get user function with the given name.
2113
 
@return user func, or NULL if not found */
 
2114
/********************************************************************
 
2115
Get user function with the given name.*/
2114
2116
UNIV_INTERN
2115
2117
pars_user_func_t*
2116
2118
pars_info_get_user_func(
2117
2119
/*====================*/
2118
 
        pars_info_t*            info,   /*!< in: info struct */
2119
 
        const char*             name)   /*!< in: function name to find*/
 
2120
                                        /* out: user func, or NULL if not
 
2121
                                        found */
 
2122
        pars_info_t*            info,   /* in: info struct */
 
2123
        const char*             name)   /* in: function name to find*/
2120
2124
{
2121
2125
        ulint           i;
2122
2126
        ib_vector_t*    vec;
2138
2142
        return(NULL);
2139
2143
}
2140
2144
 
2141
 
/****************************************************************//**
2142
 
Get bound literal with the given name.
2143
 
@return bound literal, or NULL if not found */
 
2145
/********************************************************************
 
2146
Get bound literal with the given name.*/
2144
2147
UNIV_INTERN
2145
2148
pars_bound_lit_t*
2146
2149
pars_info_get_bound_lit(
2147
2150
/*====================*/
2148
 
        pars_info_t*            info,   /*!< in: info struct */
2149
 
        const char*             name)   /*!< in: bound literal name to find */
 
2151
                                        /* out: bound literal, or NULL if
 
2152
                                        not found */
 
2153
        pars_info_t*            info,   /* in: info struct */
 
2154
        const char*             name)   /* in: bound literal name to find */
2150
2155
{
2151
2156
        ulint           i;
2152
2157
        ib_vector_t*    vec;
2168
2173
        return(NULL);
2169
2174
}
2170
2175
 
2171
 
/****************************************************************//**
2172
 
Get bound id with the given name.
2173
 
@return bound id, or NULL if not found */
 
2176
/********************************************************************
 
2177
Get bound id with the given name.*/
2174
2178
UNIV_INTERN
2175
2179
pars_bound_id_t*
2176
2180
pars_info_get_bound_id(
2177
2181
/*===================*/
2178
 
        pars_info_t*            info,   /*!< in: info struct */
2179
 
        const char*             name)   /*!< in: bound id name to find */
 
2182
                                        /* out: bound id, or NULL if not
 
2183
                                        found */
 
2184
        pars_info_t*            info,   /* in: info struct */
 
2185
        const char*             name)   /* in: bound id name to find */
2180
2186
{
2181
2187
        ulint           i;
2182
2188
        ib_vector_t*    vec;