~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2008-09-15 17:24:04 UTC
  • Revision ID: monty@inaugust.com-20080915172404-ygh6hiyu0q7qpa9x
Removed strndup calls.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include "dict0mem.h"
23
23
#include "dict0crea.h"
24
24
#include "que0que.h"
25
 
#ifndef PARS0GRM_H
26
 
# define PARS0GRM_H
27
 
# include "pars0grm.h"
28
 
#endif
 
25
#include "pars0grm.h"
29
26
#include "pars0opt.h"
30
27
#include "data0data.h"
31
28
#include "data0type.h"
43
40
 
44
41
/* Global variable used while parsing a single procedure or query : the code is
45
42
NOT re-entrant */
46
 
UNIV_INTERN sym_tab_t*  pars_sym_tab_global;
 
43
sym_tab_t*      pars_sym_tab_global;
47
44
 
48
45
/* Global variables used to denote certain reserved words, used in
49
46
constructing the parsing tree */
50
47
 
51
 
UNIV_INTERN pars_res_word_t     pars_to_char_token = {PARS_TO_CHAR_TOKEN};
52
 
UNIV_INTERN pars_res_word_t     pars_to_number_token = {PARS_TO_NUMBER_TOKEN};
53
 
UNIV_INTERN pars_res_word_t     pars_to_binary_token = {PARS_TO_BINARY_TOKEN};
54
 
UNIV_INTERN pars_res_word_t     pars_binary_to_number_token = {PARS_BINARY_TO_NUMBER_TOKEN};
55
 
UNIV_INTERN pars_res_word_t     pars_substr_token = {PARS_SUBSTR_TOKEN};
56
 
UNIV_INTERN pars_res_word_t     pars_replstr_token = {PARS_REPLSTR_TOKEN};
57
 
UNIV_INTERN pars_res_word_t     pars_concat_token = {PARS_CONCAT_TOKEN};
58
 
UNIV_INTERN pars_res_word_t     pars_instr_token = {PARS_INSTR_TOKEN};
59
 
UNIV_INTERN pars_res_word_t     pars_length_token = {PARS_LENGTH_TOKEN};
60
 
UNIV_INTERN pars_res_word_t     pars_sysdate_token = {PARS_SYSDATE_TOKEN};
61
 
UNIV_INTERN pars_res_word_t     pars_printf_token = {PARS_PRINTF_TOKEN};
62
 
UNIV_INTERN pars_res_word_t     pars_assert_token = {PARS_ASSERT_TOKEN};
63
 
UNIV_INTERN pars_res_word_t     pars_rnd_token = {PARS_RND_TOKEN};
64
 
UNIV_INTERN pars_res_word_t     pars_rnd_str_token = {PARS_RND_STR_TOKEN};
65
 
UNIV_INTERN pars_res_word_t     pars_count_token = {PARS_COUNT_TOKEN};
66
 
UNIV_INTERN pars_res_word_t     pars_sum_token = {PARS_SUM_TOKEN};
67
 
UNIV_INTERN pars_res_word_t     pars_distinct_token = {PARS_DISTINCT_TOKEN};
68
 
UNIV_INTERN pars_res_word_t     pars_binary_token = {PARS_BINARY_TOKEN};
69
 
UNIV_INTERN pars_res_word_t     pars_blob_token = {PARS_BLOB_TOKEN};
70
 
UNIV_INTERN pars_res_word_t     pars_int_token = {PARS_INT_TOKEN};
71
 
UNIV_INTERN pars_res_word_t     pars_char_token = {PARS_CHAR_TOKEN};
72
 
UNIV_INTERN pars_res_word_t     pars_float_token = {PARS_FLOAT_TOKEN};
73
 
UNIV_INTERN pars_res_word_t     pars_update_token = {PARS_UPDATE_TOKEN};
74
 
UNIV_INTERN pars_res_word_t     pars_asc_token = {PARS_ASC_TOKEN};
75
 
UNIV_INTERN pars_res_word_t     pars_desc_token = {PARS_DESC_TOKEN};
76
 
UNIV_INTERN pars_res_word_t     pars_open_token = {PARS_OPEN_TOKEN};
77
 
UNIV_INTERN pars_res_word_t     pars_close_token = {PARS_CLOSE_TOKEN};
78
 
UNIV_INTERN pars_res_word_t     pars_share_token = {PARS_SHARE_TOKEN};
79
 
UNIV_INTERN pars_res_word_t     pars_unique_token = {PARS_UNIQUE_TOKEN};
80
 
UNIV_INTERN pars_res_word_t     pars_clustered_token = {PARS_CLUSTERED_TOKEN};
 
48
pars_res_word_t pars_to_char_token = {PARS_TO_CHAR_TOKEN};
 
49
pars_res_word_t pars_to_number_token = {PARS_TO_NUMBER_TOKEN};
 
50
pars_res_word_t pars_to_binary_token = {PARS_TO_BINARY_TOKEN};
 
51
pars_res_word_t pars_binary_to_number_token = {PARS_BINARY_TO_NUMBER_TOKEN};
 
52
pars_res_word_t pars_substr_token = {PARS_SUBSTR_TOKEN};
 
53
pars_res_word_t pars_replstr_token = {PARS_REPLSTR_TOKEN};
 
54
pars_res_word_t pars_concat_token = {PARS_CONCAT_TOKEN};
 
55
pars_res_word_t pars_instr_token = {PARS_INSTR_TOKEN};
 
56
pars_res_word_t pars_length_token = {PARS_LENGTH_TOKEN};
 
57
pars_res_word_t pars_sysdate_token = {PARS_SYSDATE_TOKEN};
 
58
pars_res_word_t pars_printf_token = {PARS_PRINTF_TOKEN};
 
59
pars_res_word_t pars_assert_token = {PARS_ASSERT_TOKEN};
 
60
pars_res_word_t pars_rnd_token = {PARS_RND_TOKEN};
 
61
pars_res_word_t pars_rnd_str_token = {PARS_RND_STR_TOKEN};
 
62
pars_res_word_t pars_count_token = {PARS_COUNT_TOKEN};
 
63
pars_res_word_t pars_sum_token = {PARS_SUM_TOKEN};
 
64
pars_res_word_t pars_distinct_token = {PARS_DISTINCT_TOKEN};
 
65
pars_res_word_t pars_binary_token = {PARS_BINARY_TOKEN};
 
66
pars_res_word_t pars_blob_token = {PARS_BLOB_TOKEN};
 
67
pars_res_word_t pars_int_token = {PARS_INT_TOKEN};
 
68
pars_res_word_t pars_char_token = {PARS_CHAR_TOKEN};
 
69
pars_res_word_t pars_float_token = {PARS_FLOAT_TOKEN};
 
70
pars_res_word_t pars_update_token = {PARS_UPDATE_TOKEN};
 
71
pars_res_word_t pars_asc_token = {PARS_ASC_TOKEN};
 
72
pars_res_word_t pars_desc_token = {PARS_DESC_TOKEN};
 
73
pars_res_word_t pars_open_token = {PARS_OPEN_TOKEN};
 
74
pars_res_word_t pars_close_token = {PARS_CLOSE_TOKEN};
 
75
pars_res_word_t pars_share_token = {PARS_SHARE_TOKEN};
 
76
pars_res_word_t pars_unique_token = {PARS_UNIQUE_TOKEN};
 
77
pars_res_word_t pars_clustered_token = {PARS_CLUSTERED_TOKEN};
81
78
 
82
79
/* Global variable used to denote the '*' in SELECT * FROM.. */
83
80
#define PARS_STAR_DENOTER       12345678
84
 
UNIV_INTERN ulint       pars_star_denoter       = PARS_STAR_DENOTER;
 
81
ulint   pars_star_denoter       = PARS_STAR_DENOTER;
85
82
 
86
83
 
87
84
/*************************************************************************
93
90
                        /* out: function class: PARS_FUNC_ARITH, ... */
94
91
        int     func)   /* in: function code: '=', PARS_GE_TOKEN, ... */
95
92
{
96
 
        switch (func) {
97
 
        case '+': case '-': case '*': case '/':
 
93
        if ((func == '+') || (func == '-') || (func == '*') || (func == '/')) {
 
94
 
98
95
                return(PARS_FUNC_ARITH);
99
96
 
100
 
        case '=': case '<': case '>':
101
 
        case PARS_GE_TOKEN: case PARS_LE_TOKEN: case PARS_NE_TOKEN:
 
97
        } else if ((func == '=') || (func == '<') || (func == '>')
 
98
                   || (func == PARS_GE_TOKEN) || (func == PARS_LE_TOKEN)
 
99
                   || (func == PARS_NE_TOKEN)) {
 
100
 
102
101
                return(PARS_FUNC_CMP);
103
102
 
104
 
        case PARS_AND_TOKEN: case PARS_OR_TOKEN: case PARS_NOT_TOKEN:
 
103
        } else if ((func == PARS_AND_TOKEN) || (func == PARS_OR_TOKEN)
 
104
                   || (func == PARS_NOT_TOKEN)) {
 
105
 
105
106
                return(PARS_FUNC_LOGICAL);
106
107
 
107
 
        case PARS_COUNT_TOKEN: case PARS_SUM_TOKEN:
 
108
        } else if ((func == PARS_COUNT_TOKEN) || (func == PARS_SUM_TOKEN)) {
 
109
 
108
110
                return(PARS_FUNC_AGGREGATE);
109
111
 
110
 
        case PARS_TO_CHAR_TOKEN:
111
 
        case PARS_TO_NUMBER_TOKEN:
112
 
        case PARS_TO_BINARY_TOKEN:
113
 
        case PARS_BINARY_TO_NUMBER_TOKEN:
114
 
        case PARS_SUBSTR_TOKEN:
115
 
        case PARS_CONCAT_TOKEN:
116
 
        case PARS_LENGTH_TOKEN:
117
 
        case PARS_INSTR_TOKEN:
118
 
        case PARS_SYSDATE_TOKEN:
119
 
        case PARS_NOTFOUND_TOKEN:
120
 
        case PARS_PRINTF_TOKEN:
121
 
        case PARS_ASSERT_TOKEN:
122
 
        case PARS_RND_TOKEN:
123
 
        case PARS_RND_STR_TOKEN:
124
 
        case PARS_REPLSTR_TOKEN:
 
112
        } else if ((func == PARS_TO_CHAR_TOKEN)
 
113
                   || (func == PARS_TO_NUMBER_TOKEN)
 
114
                   || (func == PARS_TO_BINARY_TOKEN)
 
115
                   || (func == PARS_BINARY_TO_NUMBER_TOKEN)
 
116
                   || (func == PARS_SUBSTR_TOKEN)
 
117
                   || (func == PARS_CONCAT_TOKEN)
 
118
                   || (func == PARS_LENGTH_TOKEN)
 
119
                   || (func == PARS_INSTR_TOKEN)
 
120
                   || (func == PARS_SYSDATE_TOKEN)
 
121
                   || (func == PARS_NOTFOUND_TOKEN)
 
122
                   || (func == PARS_PRINTF_TOKEN)
 
123
                   || (func == PARS_ASSERT_TOKEN)
 
124
                   || (func == PARS_RND_TOKEN)
 
125
                   || (func == PARS_RND_STR_TOKEN)
 
126
                   || (func == PARS_REPLSTR_TOKEN)) {
 
127
 
125
128
                return(PARS_FUNC_PREDEFINED);
126
 
 
127
 
        default:
 
129
        } else {
128
130
                return(PARS_FUNC_OTHER);
129
131
        }
130
132
}
149
151
 
150
152
        node->func = func;
151
153
 
152
 
        node->class = pars_func_get_class(func);
 
154
        node->klass = pars_func_get_class(func);
153
155
 
154
156
        node->args = arg;
155
157
 
160
162
 
161
163
/*************************************************************************
162
164
Parses a function expression. */
163
 
UNIV_INTERN
 
165
 
164
166
func_node_t*
165
167
pars_func(
166
168
/*======*/
173
175
 
174
176
/*************************************************************************
175
177
Parses an operator expression. */
176
 
UNIV_INTERN
 
178
 
177
179
func_node_t*
178
180
pars_op(
179
181
/*====*/
194
196
 
195
197
/*************************************************************************
196
198
Parses an ORDER BY clause. Order by a single column only is supported. */
197
 
UNIV_INTERN
 
199
 
198
200
order_node_t*
199
201
pars_order_by(
200
202
/*==========*/
221
223
}
222
224
 
223
225
/*************************************************************************
224
 
Determine if a data type is a built-in string data type of the InnoDB
225
 
SQL parser. */
226
 
static
227
 
ibool
228
 
pars_is_string_type(
229
 
/*================*/
230
 
                        /* out: TRUE if string data type */
231
 
        ulint   mtype)  /* in: main data type */
232
 
{
233
 
        switch (mtype) {
234
 
        case DATA_VARCHAR: case DATA_CHAR:
235
 
        case DATA_FIXBINARY: case DATA_BINARY:
236
 
                return(TRUE);
237
 
        }
238
 
 
239
 
        return(FALSE);
240
 
}
241
 
 
242
 
/*************************************************************************
243
226
Resolves the data type of a function in an expression. The argument data
244
227
types must already be resolved. */
245
228
static
249
232
        func_node_t*    node)   /* in: function node */
250
233
{
251
234
        que_node_t*     arg;
 
235
        ulint           func;
252
236
 
253
237
        ut_a(que_node_get_type(node) == QUE_NODE_FUNC);
254
238
 
255
239
        arg = node->args;
256
240
 
257
 
        switch (node->func) {
258
 
        case PARS_SUM_TOKEN:
259
 
        case '+': case '-': case '*': case '/':
 
241
        func = node->func;
 
242
 
 
243
        if ((func == PARS_SUM_TOKEN)
 
244
            || (func == '+') || (func == '-') || (func == '*')
 
245
            || (func == '/') || (func == '+')) {
 
246
 
260
247
                /* Inherit the data type from the first argument (which must
261
248
                not be the SQL null literal whose type is DATA_ERROR) */
262
249
 
265
252
 
266
253
                ut_a(dtype_get_mtype(que_node_get_data_type(node))
267
254
                     == DATA_INT);
268
 
                break;
269
 
 
270
 
        case PARS_COUNT_TOKEN:
 
255
        } else if (func == PARS_COUNT_TOKEN) {
271
256
                ut_a(arg);
272
257
                dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
273
 
                break;
274
258
 
275
 
        case PARS_TO_CHAR_TOKEN:
276
 
        case PARS_RND_STR_TOKEN:
 
259
        } else if (func == PARS_TO_CHAR_TOKEN) {
277
260
                ut_a(dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT);
278
261
                dtype_set(que_node_get_data_type(node), DATA_VARCHAR,
279
262
                          DATA_ENGLISH, 0);
280
 
                break;
281
 
 
282
 
        case PARS_TO_BINARY_TOKEN:
 
263
        } else if (func == PARS_TO_BINARY_TOKEN) {
283
264
                if (dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT) {
284
265
                        dtype_set(que_node_get_data_type(node), DATA_VARCHAR,
285
266
                                  DATA_ENGLISH, 0);
287
268
                        dtype_set(que_node_get_data_type(node), DATA_BINARY,
288
269
                                  0, 0);
289
270
                }
290
 
                break;
291
 
 
292
 
        case PARS_TO_NUMBER_TOKEN:
293
 
        case PARS_BINARY_TO_NUMBER_TOKEN:
294
 
        case PARS_LENGTH_TOKEN:
295
 
        case PARS_INSTR_TOKEN:
296
 
                ut_a(pars_is_string_type(que_node_get_data_type(arg)->mtype));
297
 
                dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
298
 
                break;
299
 
 
300
 
        case PARS_SYSDATE_TOKEN:
 
271
        } else if (func == PARS_TO_NUMBER_TOKEN) {
 
272
                ut_a(dtype_get_mtype(que_node_get_data_type(arg))
 
273
                     == DATA_VARCHAR);
 
274
                dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
 
275
 
 
276
        } else if (func == PARS_BINARY_TO_NUMBER_TOKEN) {
 
277
                ut_a(dtype_get_mtype(que_node_get_data_type(arg))
 
278
                     == DATA_VARCHAR);
 
279
                dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
 
280
 
 
281
        } else if (func == PARS_LENGTH_TOKEN) {
 
282
                ut_a(dtype_get_mtype(que_node_get_data_type(arg))
 
283
                     == DATA_VARCHAR);
 
284
                dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
 
285
 
 
286
        } else if (func == PARS_INSTR_TOKEN) {
 
287
                ut_a(dtype_get_mtype(que_node_get_data_type(arg))
 
288
                     == DATA_VARCHAR);
 
289
                dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
 
290
 
 
291
        } else if (func == PARS_SYSDATE_TOKEN) {
301
292
                ut_a(arg == NULL);
302
293
                dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
303
 
                break;
304
 
 
305
 
        case PARS_SUBSTR_TOKEN:
306
 
        case PARS_CONCAT_TOKEN:
307
 
                ut_a(pars_is_string_type(que_node_get_data_type(arg)->mtype));
 
294
 
 
295
        } else if ((func == PARS_SUBSTR_TOKEN)
 
296
                   || (func == PARS_CONCAT_TOKEN)) {
 
297
 
 
298
                ut_a(dtype_get_mtype(que_node_get_data_type(arg))
 
299
                     == DATA_VARCHAR);
308
300
                dtype_set(que_node_get_data_type(node), DATA_VARCHAR,
309
301
                          DATA_ENGLISH, 0);
310
 
                break;
311
302
 
312
 
        case '>': case '<': case '=':
313
 
        case PARS_GE_TOKEN:
314
 
        case PARS_LE_TOKEN:
315
 
        case PARS_NE_TOKEN:
316
 
        case PARS_AND_TOKEN:
317
 
        case PARS_OR_TOKEN:
318
 
        case PARS_NOT_TOKEN:
319
 
        case PARS_NOTFOUND_TOKEN:
 
303
        } else if ((func == '>') || (func == '<') || (func == '=')
 
304
                   || (func == PARS_GE_TOKEN)
 
305
                   || (func == PARS_LE_TOKEN)
 
306
                   || (func == PARS_NE_TOKEN)
 
307
                   || (func == PARS_AND_TOKEN)
 
308
                   || (func == PARS_OR_TOKEN)
 
309
                   || (func == PARS_NOT_TOKEN)
 
310
                   || (func == PARS_NOTFOUND_TOKEN)) {
320
311
 
321
312
                /* We currently have no iboolean type: use integer type */
322
313
                dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
323
 
                break;
324
314
 
325
 
        case PARS_RND_TOKEN:
 
315
        } else if (func == PARS_RND_TOKEN) {
326
316
                ut_a(dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT);
 
317
 
327
318
                dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
328
 
                break;
329
 
 
330
 
        default:
 
319
 
 
320
        } else if (func == PARS_RND_STR_TOKEN) {
 
321
                ut_a(dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT);
 
322
 
 
323
                dtype_set(que_node_get_data_type(node), DATA_VARCHAR,
 
324
                          DATA_ENGLISH, 0);
 
325
        } else {
331
326
                ut_error;
332
327
        }
333
328
}
629
624
/*************************************************************************
630
625
Parses a select list; creates a query graph node for the whole SELECT
631
626
statement. */
632
 
UNIV_INTERN
 
627
 
633
628
sel_node_t*
634
629
pars_select_list(
635
630
/*=============*/
675
670
 
676
671
                        func_node = exp_node;
677
672
 
678
 
                        if (func_node->class == PARS_FUNC_AGGREGATE) {
 
673
                        if (func_node->klass == PARS_FUNC_AGGREGATE) {
679
674
 
680
675
                                n_aggregate_nodes++;
681
676
                        }
695
690
 
696
691
/*************************************************************************
697
692
Parses a select statement. */
698
 
UNIV_INTERN
 
693
 
699
694
sel_node_t*
700
695
pars_select_statement(
701
696
/*==================*/
779
774
 
780
775
/*************************************************************************
781
776
Parses a cursor declaration. */
782
 
UNIV_INTERN
 
777
 
783
778
que_node_t*
784
779
pars_cursor_declaration(
785
780
/*====================*/
800
795
 
801
796
/*************************************************************************
802
797
Parses a function declaration. */
803
 
UNIV_INTERN
 
798
 
804
799
que_node_t*
805
800
pars_function_declaration(
806
801
/*======================*/
820
815
 
821
816
/*************************************************************************
822
817
Parses a delete or update statement start. */
823
 
UNIV_INTERN
 
818
 
824
819
upd_node_t*
825
820
pars_update_statement_start(
826
821
/*========================*/
845
840
 
846
841
/*************************************************************************
847
842
Parses a column assignment in an update. */
848
 
UNIV_INTERN
 
843
 
849
844
col_assign_node_t*
850
845
pars_column_assignment(
851
846
/*===================*/
953
948
 
954
949
/*************************************************************************
955
950
Parses an update or delete statement. */
956
 
UNIV_INTERN
 
951
 
957
952
upd_node_t*
958
953
pars_update_statement(
959
954
/*==================*/
1026
1021
 
1027
1022
        plan->no_prefetch = TRUE;
1028
1023
 
1029
 
        if (!dict_index_is_clust(plan->index)) {
 
1024
        if (!((plan->index)->type & DICT_CLUSTERED)) {
1030
1025
 
1031
1026
                plan->must_get_clust = TRUE;
1032
1027
 
1053
1048
 
1054
1049
/*************************************************************************
1055
1050
Parses an insert statement. */
1056
 
UNIV_INTERN
 
1051
 
1057
1052
ins_node_t*
1058
1053
pars_insert_statement(
1059
1054
/*==================*/
1161
1156
 
1162
1157
/*************************************************************************
1163
1158
Parses a variable declaration. */
1164
 
UNIV_INTERN
 
1159
 
1165
1160
sym_node_t*
1166
1161
pars_variable_declaration(
1167
1162
/*======================*/
1183
1178
 
1184
1179
/*************************************************************************
1185
1180
Parses a procedure parameter declaration. */
1186
 
UNIV_INTERN
 
1181
 
1187
1182
sym_node_t*
1188
1183
pars_parameter_declaration(
1189
1184
/*=======================*/
1227
1222
 
1228
1223
/*************************************************************************
1229
1224
Parses an elsif element. */
1230
 
UNIV_INTERN
 
1225
 
1231
1226
elsif_node_t*
1232
1227
pars_elsif_element(
1233
1228
/*===============*/
1252
1247
 
1253
1248
/*************************************************************************
1254
1249
Parses an if-statement. */
1255
 
UNIV_INTERN
 
1250
 
1256
1251
if_node_t*
1257
1252
pars_if_statement(
1258
1253
/*==============*/
1303
1298
 
1304
1299
/*************************************************************************
1305
1300
Parses a while-statement. */
1306
 
UNIV_INTERN
 
1301
 
1307
1302
while_node_t*
1308
1303
pars_while_statement(
1309
1304
/*=================*/
1330
1325
 
1331
1326
/*************************************************************************
1332
1327
Parses a for-loop-statement. */
1333
 
UNIV_INTERN
 
1328
 
1334
1329
for_node_t*
1335
1330
pars_for_statement(
1336
1331
/*===============*/
1366
1361
 
1367
1362
/*************************************************************************
1368
1363
Parses an exit statement. */
1369
 
UNIV_INTERN
 
1364
 
1370
1365
exit_node_t*
1371
1366
pars_exit_statement(void)
1372
1367
/*=====================*/
1382
1377
 
1383
1378
/*************************************************************************
1384
1379
Parses a return-statement. */
1385
 
UNIV_INTERN
 
1380
 
1386
1381
return_node_t*
1387
1382
pars_return_statement(void)
1388
1383
/*=======================*/
1399
1394
 
1400
1395
/*************************************************************************
1401
1396
Parses an assignment statement. */
1402
 
UNIV_INTERN
 
1397
 
1403
1398
assign_node_t*
1404
1399
pars_assignment_statement(
1405
1400
/*======================*/
1427
1422
 
1428
1423
/*************************************************************************
1429
1424
Parses a procedure call. */
1430
 
UNIV_INTERN
 
1425
 
1431
1426
func_node_t*
1432
1427
pars_procedure_call(
1433
1428
/*================*/
1447
1442
/*************************************************************************
1448
1443
Parses a fetch statement. into_list or user_func (but not both) must be
1449
1444
non-NULL. */
1450
 
UNIV_INTERN
 
1445
 
1451
1446
fetch_node_t*
1452
1447
pars_fetch_statement(
1453
1448
/*=================*/
1498
1493
 
1499
1494
/*************************************************************************
1500
1495
Parses an open or close cursor statement. */
1501
 
UNIV_INTERN
 
1496
 
1502
1497
open_node_t*
1503
1498
pars_open_statement(
1504
1499
/*================*/
1528
1523
 
1529
1524
/*************************************************************************
1530
1525
Parses a row_printf-statement. */
1531
 
UNIV_INTERN
 
1526
 
1532
1527
row_printf_node_t*
1533
1528
pars_row_printf_statement(
1534
1529
/*======================*/
1550
1545
 
1551
1546
/*************************************************************************
1552
1547
Parses a commit statement. */
1553
 
UNIV_INTERN
 
1548
 
1554
1549
commit_node_t*
1555
1550
pars_commit_statement(void)
1556
1551
/*=======================*/
1560
1555
 
1561
1556
/*************************************************************************
1562
1557
Parses a rollback statement. */
1563
 
UNIV_INTERN
 
1558
 
1564
1559
roll_node_t*
1565
1560
pars_rollback_statement(void)
1566
1561
/*=========================*/
1570
1565
 
1571
1566
/*************************************************************************
1572
1567
Parses a column definition at a table creation. */
1573
 
UNIV_INTERN
 
1568
 
1574
1569
sym_node_t*
1575
1570
pars_column_def(
1576
1571
/*============*/
1602
1597
 
1603
1598
/*************************************************************************
1604
1599
Parses a table creation operation. */
1605
 
UNIV_INTERN
 
1600
 
1606
1601
tab_node_t*
1607
1602
pars_create_table(
1608
1603
/*==============*/
1625
1620
        dict_table_t*   table;
1626
1621
        sym_node_t*     column;
1627
1622
        tab_node_t*     node;
1628
 
        const dtype_t*  dtype;
 
1623
        dtype_t*        dtype;
1629
1624
        ulint           n_cols;
1630
1625
 
1631
1626
        n_cols = que_node_list_get_len(column_defs);
1664
1659
 
1665
1660
/*************************************************************************
1666
1661
Parses an index creation operation. */
1667
 
UNIV_INTERN
 
1662
 
1668
1663
ind_node_t*
1669
1664
pars_create_index(
1670
1665
/*==============*/
1721
1716
 
1722
1717
/*************************************************************************
1723
1718
Parses a procedure definition. */
1724
 
UNIV_INTERN
 
1719
 
1725
1720
que_fork_t*
1726
1721
pars_procedure_definition(
1727
1722
/*======================*/
1771
1766
procedure, that is, the client issues a procedure call directly.
1772
1767
In MySQL/InnoDB, stored InnoDB procedures are invoked via the
1773
1768
parsed procedure tree, not via InnoDB SQL, so this function is not used. */
1774
 
UNIV_INTERN
 
1769
 
1775
1770
que_fork_t*
1776
1771
pars_stored_procedure_call(
1777
1772
/*=======================*/
1785
1780
 
1786
1781
/*****************************************************************
1787
1782
Retrieves characters to the lexical analyzer. */
1788
 
UNIV_INTERN
 
1783
 
1789
1784
void
1790
1785
pars_get_lex_chars(
1791
1786
/*===============*/
1833
1828
 
1834
1829
/*****************************************************************
1835
1830
Called by yyparse on error. */
1836
 
UNIV_INTERN
 
1831
 
1837
1832
void
1838
1833
yyerror(
1839
1834
/*====*/
1849
1844
 
1850
1845
/*****************************************************************
1851
1846
Parses an SQL string returning the query graph. */
1852
 
UNIV_INTERN
 
1847
 
1853
1848
que_t*
1854
1849
pars_sql(
1855
1850
/*=====*/
1899
1894
/**********************************************************************
1900
1895
Completes a query graph by adding query thread and fork nodes
1901
1896
above it and prepares the graph for running. The fork created is of
1902
 
type QUE_FORK_MYSQL_INTERFACE. */
1903
 
UNIV_INTERN
 
1897
type QUE_FORK_DRIZZLE_INTERFACE. */
 
1898
 
1904
1899
que_thr_t*
1905
1900
pars_complete_graph_for_exec(
1906
1901
/*=========================*/
1913
1908
        que_fork_t*     fork;
1914
1909
        que_thr_t*      thr;
1915
1910
 
1916
 
        fork = que_fork_create(NULL, NULL, QUE_FORK_MYSQL_INTERFACE, heap);
 
1911
        fork = que_fork_create(NULL, NULL, QUE_FORK_DRIZZLE_INTERFACE, heap);
1917
1912
        fork->trx = trx;
1918
1913
 
1919
1914
        thr = que_thr_create(fork, heap);
1929
1924
 
1930
1925
/********************************************************************
1931
1926
Create parser info struct.*/
1932
 
UNIV_INTERN
 
1927
 
1933
1928
pars_info_t*
1934
1929
pars_info_create(void)
1935
1930
/*==================*/
1953
1948
 
1954
1949
/********************************************************************
1955
1950
Free info struct and everything it contains.*/
1956
 
UNIV_INTERN
 
1951
 
1957
1952
void
1958
1953
pars_info_free(
1959
1954
/*===========*/
1964
1959
 
1965
1960
/********************************************************************
1966
1961
Add bound literal. */
1967
 
UNIV_INTERN
 
1962
 
1968
1963
void
1969
1964
pars_info_add_literal(
1970
1965
/*==================*/
1998
1993
/********************************************************************
1999
1994
Equivalent to pars_info_add_literal(info, name, str, strlen(str),
2000
1995
DATA_VARCHAR, DATA_ENGLISH). */
2001
 
UNIV_INTERN
 
1996
 
2002
1997
void
2003
1998
pars_info_add_str_literal(
2004
1999
/*======================*/
2019
2014
 
2020
2015
except that the buffer is dynamically allocated from the info struct's
2021
2016
heap. */
2022
 
UNIV_INTERN
 
2017
 
2023
2018
void
2024
2019
pars_info_add_int4_literal(
2025
2020
/*=======================*/
2042
2037
 
2043
2038
except that the buffer is dynamically allocated from the info struct's
2044
2039
heap. */
2045
 
UNIV_INTERN
 
2040
 
2046
2041
void
2047
2042
pars_info_add_dulint_literal(
2048
2043
/*=========================*/
2059
2054
 
2060
2055
/********************************************************************
2061
2056
Add user function. */
2062
 
UNIV_INTERN
 
2057
 
2063
2058
void
2064
2059
pars_info_add_function(
2065
2060
/*===================*/
2087
2082
 
2088
2083
/********************************************************************
2089
2084
Add bound id. */
2090
 
UNIV_INTERN
 
2085
 
2091
2086
void
2092
2087
pars_info_add_id(
2093
2088
/*=============*/
2113
2108
 
2114
2109
/********************************************************************
2115
2110
Get user function with the given name.*/
2116
 
UNIV_INTERN
 
2111
 
2117
2112
pars_user_func_t*
2118
2113
pars_info_get_user_func(
2119
2114
/*====================*/
2144
2139
 
2145
2140
/********************************************************************
2146
2141
Get bound literal with the given name.*/
2147
 
UNIV_INTERN
 
2142
 
2148
2143
pars_bound_lit_t*
2149
2144
pars_info_get_bound_lit(
2150
2145
/*====================*/
2175
2170
 
2176
2171
/********************************************************************
2177
2172
Get bound id with the given name.*/
2178
 
UNIV_INTERN
 
2173
 
2179
2174
pars_bound_id_t*
2180
2175
pars_info_get_bound_id(
2181
2176
/*===================*/