diff options
author | Jan Lindström <jan.lindstrom@mariadb.com> | 2016-08-12 11:17:45 +0300 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2016-09-02 13:22:28 +0300 |
commit | 2e814d4702d71a04388386a9f591d14a35980bfe (patch) | |
tree | f3f9b48d116a3738c5e71f3a360ca61f16cfb632 /storage/innobase/pars | |
parent | 848d211c5c4df00b819cd84d7530cf7d29bb0524 (diff) | |
download | mariadb-git-2e814d4702d71a04388386a9f591d14a35980bfe.tar.gz |
Merge InnoDB 5.7 from mysql-5.7.9.
Contains also
MDEV-10547: Test multi_update_innodb fails with InnoDB 5.7
The failure happened because 5.7 has changed the signature of
the bool handler::primary_key_is_clustered() const
virtual function ("const" was added). InnoDB was using the old
signature which caused the function not to be used.
MDEV-10550: Parallel replication lock waits/deadlock handling does not work with InnoDB 5.7
Fixed mutexing problem on lock_trx_handle_wait. Note that
rpl_parallel and rpl_optimistic_parallel tests still
fail.
MDEV-10156 : Group commit tests fail on 10.2 InnoDB (branch bb-10.2-jan)
Reason: incorrect merge
MDEV-10550: Parallel replication can't sync with master in InnoDB 5.7 (branch bb-10.2-jan)
Reason: incorrect merge
Diffstat (limited to 'storage/innobase/pars')
-rw-r--r-- | storage/innobase/pars/lexyy.cc | 152 | ||||
-rwxr-xr-x | storage/innobase/pars/make_bison.sh | 3 | ||||
-rwxr-xr-x | storage/innobase/pars/make_flex.sh | 1 | ||||
-rw-r--r-- | storage/innobase/pars/pars0grm.cc | 5 | ||||
-rw-r--r-- | storage/innobase/pars/pars0grm.y | 5 | ||||
-rw-r--r-- | storage/innobase/pars/pars0lex.l | 5 | ||||
-rw-r--r-- | storage/innobase/pars/pars0opt.cc | 59 | ||||
-rw-r--r-- | storage/innobase/pars/pars0pars.cc | 284 | ||||
-rw-r--r-- | storage/innobase/pars/pars0sym.cc | 43 |
9 files changed, 216 insertions, 341 deletions
diff --git a/storage/innobase/pars/lexyy.cc b/storage/innobase/pars/lexyy.cc index bfa8e2ea950..85fbbd33b9d 100644 --- a/storage/innobase/pars/lexyy.cc +++ b/storage/innobase/pars/lexyy.cc @@ -176,15 +176,15 @@ extern FILE *yyin, *yyout; #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - #define YY_LESS_LINENO(n) +#define YY_LESS_LINENO(n) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ @@ -232,8 +232,8 @@ struct yy_buffer_state */ int yy_at_bol; - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. @@ -321,9 +321,9 @@ void yyfree (void * ); #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (); \ + yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } @@ -331,9 +331,9 @@ void yyfree (void * ); #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } @@ -342,7 +342,7 @@ void yyfree (void * ); /* Begin user sect3 */ -#define yywrap(n) 1 +#define yywrap() 1 #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; @@ -961,7 +961,7 @@ Created 12/14/1997 Heikki Tuuri #include "mem0mem.h" #include "os0proc.h" -#define malloc(A) ut_malloc(A) +#define malloc(A) ut_malloc_nokey(A) #define free(A) ut_free(A) #define realloc(P, A) ut_realloc(P, A) #define exit(A) ut_error @@ -2380,7 +2380,7 @@ case YY_STATE_EOF(id): */ static int yy_get_next_buffer (void) { - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; @@ -2428,7 +2428,7 @@ static int yy_get_next_buffer (void) YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1); while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ + { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; @@ -2462,8 +2462,7 @@ static int yy_get_next_buffer (void) num_to_read = static_cast<int>( YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1); - - } + } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; @@ -2513,7 +2512,7 @@ static int yy_get_next_buffer (void) /* yy_get_previous_state - get the state just before the EOB char was reached */ - yy_state_type yy_get_previous_state (void) +yy_state_type yy_get_previous_state (void) { register yy_state_type yy_current_state; register char *yy_cp; @@ -2545,10 +2544,10 @@ static int yy_get_next_buffer (void) * synopsis * next_state = yy_try_NUL_trans( current_state ); */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); + register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) @@ -2647,13 +2646,13 @@ static int yy_get_next_buffer (void) * * @note This function does not reset the start condition to @c INITIAL . */ - void yyrestart (FILE * input_file ) +void yyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); + yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); + yy_create_buffer(yyin,YY_BUF_SIZE ); } yy_init_buffer(YY_CURRENT_BUFFER,input_file ); @@ -2671,7 +2670,7 @@ static int yy_get_next_buffer (void) * with * yypop_buffer_state(); * yypush_buffer_state(new_buffer); - */ + */ yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; @@ -2697,7 +2696,7 @@ static int yy_get_next_buffer (void) static void yy_load_buffer_state (void) { - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); @@ -2709,7 +2708,7 @@ static void yy_load_buffer_state (void) * * @return the allocated buffer state. */ - static YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +static YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; @@ -2737,7 +2736,7 @@ static void yy_load_buffer_state (void) * @param b a buffer created with yy_create_buffer() * */ - void yy_delete_buffer (YY_BUFFER_STATE b ) +void yy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) @@ -2756,7 +2755,7 @@ static void yy_load_buffer_state (void) * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) +static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; @@ -2766,16 +2765,16 @@ static void yy_load_buffer_state (void) b->yy_input_file = file; b->yy_fill_buffer = 1; - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } - b->yy_is_interactive = 0; + b->yy_is_interactive = 0; errno = oerrno; } @@ -2784,9 +2783,9 @@ static void yy_load_buffer_state (void) * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ - void yy_flush_buffer (YY_BUFFER_STATE b ) +void yy_flush_buffer (YY_BUFFER_STATE b ) { - if ( ! b ) + if ( ! b ) return; b->yy_n_chars = 0; @@ -2815,7 +2814,7 @@ static void yy_load_buffer_state (void) */ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { - if (new_buffer == NULL) + if (new_buffer == NULL) return; yyensure_buffer_stack(); @@ -2845,7 +2844,7 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) */ void yypop_buffer_state (void) { - if (!YY_CURRENT_BUFFER) + if (!YY_CURRENT_BUFFER) return; yy_delete_buffer(YY_CURRENT_BUFFER ); @@ -2871,7 +2870,7 @@ static void yyensure_buffer_stack (void) /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. - */ + */ num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) @@ -2912,7 +2911,7 @@ static void yyensure_buffer_stack (void) static void yy_fatal_error (yyconst char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -2923,8 +2922,8 @@ static void yy_fatal_error (yyconst char* msg ) do \ { \ /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ yytext[yyleng] = (yy_hold_char); \ (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ @@ -2941,7 +2940,7 @@ static void yy_fatal_error (yyconst char* msg ) int yyget_lineno (void) { - return yylineno; + return yylineno; } /** Get the input stream. @@ -2949,7 +2948,7 @@ int yyget_lineno (void) */ FILE *yyget_in (void) { - return yyin; + return yyin; } /** Get the output stream. @@ -2957,7 +2956,7 @@ FILE *yyget_in (void) */ FILE *yyget_out (void) { - return yyout; + return yyout; } /** Get the length of the current token. @@ -2965,7 +2964,7 @@ FILE *yyget_out (void) */ yy_size_t yyget_leng (void) { - return yyleng; + return yyleng; } /** Get the current token. @@ -2974,7 +2973,7 @@ yy_size_t yyget_leng (void) char *yyget_text (void) { - return yytext; + return yytext; } /** Set the current line number. @@ -2984,7 +2983,7 @@ char *yyget_text (void) void yyset_lineno (int line_number ) { - yylineno = line_number; + yylineno = line_number; } /** Set the input stream. This does not discard the current @@ -2995,57 +2994,57 @@ void yyset_lineno (int line_number ) */ void yyset_in (FILE * in_str ) { - yyin = in_str ; + yyin = in_str ; } void yyset_out (FILE * out_str ) { - yyout = out_str ; + yyout = out_str ; } int yyget_debug (void) { - return yy_flex_debug; + return yy_flex_debug; } void yyset_debug (int bdebug ) { - yy_flex_debug = bdebug ; + yy_flex_debug = bdebug ; } static int yy_init_globals (void) { - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ - (yy_buffer_stack) = 0; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; - (yy_init) = 0; - (yy_start) = 0; + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; + yyin = stdin; + yyout = stdout; #else - yyin = (FILE *) 0; - yyout = (FILE *) 0; + yyin = (FILE *) 0; + yyout = (FILE *) 0; #endif - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; } /* yylex_destroy is for both reentrant and non-reentrant scanners. */ MY_ATTRIBUTE((unused)) static int yylex_destroy (void) { - /* Pop the buffer stack, destroying each element. */ + /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; @@ -3056,11 +3055,11 @@ MY_ATTRIBUTE((unused)) static int yylex_destroy (void) yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ - yy_init_globals( ); + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); - return 0; + return 0; } /* @@ -3117,7 +3116,6 @@ void yyfree (void * ptr ) /********************************************************************** Release any resources used by the lexer. */ -UNIV_INTERN void pars_lexer_close(void) /*==================*/ diff --git a/storage/innobase/pars/make_bison.sh b/storage/innobase/pars/make_bison.sh index 2618be102bc..2b0c15662fc 100755 --- a/storage/innobase/pars/make_bison.sh +++ b/storage/innobase/pars/make_bison.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (c) 1994, 2011, Oracle and/or its affiliates. All Rights Reserved. +# Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved. # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free Software @@ -26,7 +26,6 @@ mv pars0grm.tab.h ../include/pars0grm.h sed -e ' s/'"$TMPFILE"'/'"$OUTFILE"'/; s/^\(\(YYSTYPE\|int\) yy\(char\|nerrs\)\)/static \1/; -s/\(\(YYSTYPE\|int\) yy\(lval\|parse\)\)/UNIV_INTERN \1/; ' < "$TMPFILE" > "$OUTFILE" rm "$TMPFILE" diff --git a/storage/innobase/pars/make_flex.sh b/storage/innobase/pars/make_flex.sh index c3db8aea298..2c493097463 100755 --- a/storage/innobase/pars/make_flex.sh +++ b/storage/innobase/pars/make_flex.sh @@ -40,7 +40,6 @@ s/\(\(int\|void\) yy[gs]et_\)/MY_ATTRIBUTE((unused)) static \1/; s/\(void \*\?yy\(\(re\)\?alloc\|free\)\)/static \1/; s/\(extern \)\?\(int yy\(leng\|lineno\|_flex_debug\)\)/static \2/; s/\(int yylex_destroy\)/MY_ATTRIBUTE((unused)) static \1/; -s/\(extern \)\?\(int yylex \)/UNIV_INTERN \2/; s/^\(\(FILE\|char\) *\* *yyget\)/MY_ATTRIBUTE((unused)) static \1/; s/^\(extern \)\?\(\(FILE\|char\) *\* *yy\)/static \2/; ' < $TMPFILE >> $OUTFILE diff --git a/storage/innobase/pars/pars0grm.cc b/storage/innobase/pars/pars0grm.cc index b360f36e597..5fbb70c4481 100644 --- a/storage/innobase/pars/pars0grm.cc +++ b/storage/innobase/pars/pars0grm.cc @@ -284,7 +284,7 @@ que_node_t */ #include "univ.i" -#include <math.h> /* Can't be before univ.i */ +#include <math.h> #include "pars0pars.h" #include "mem0mem.h" #include "que0types.h" @@ -294,7 +294,6 @@ que_node_t */ #define YYSTYPE que_node_t* /* #define __STDC__ */ - int yylex(void); @@ -426,8 +425,6 @@ YYID (i) # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca diff --git a/storage/innobase/pars/pars0grm.y b/storage/innobase/pars/pars0grm.y index 60913287cc4..2f0c83da8e3 100644 --- a/storage/innobase/pars/pars0grm.y +++ b/storage/innobase/pars/pars0grm.y @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2014, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -30,7 +30,7 @@ Created 12/14/1997 Heikki Tuuri que_node_t */ #include "univ.i" -#include <math.h> /* Can't be before univ.i */ +#include <math.h> #include "pars0pars.h" #include "mem0mem.h" #include "que0types.h" @@ -40,7 +40,6 @@ que_node_t */ #define YYSTYPE que_node_t* /* #define __STDC__ */ - int yylex(void); %} diff --git a/storage/innobase/pars/pars0lex.l b/storage/innobase/pars/pars0lex.l index 83c3af4b6c5..3efcc2c8b4d 100644 --- a/storage/innobase/pars/pars0lex.l +++ b/storage/innobase/pars/pars0lex.l @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2014, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -59,7 +59,7 @@ Created 12/14/1997 Heikki Tuuri #include "mem0mem.h" #include "os0proc.h" -#define malloc(A) ut_malloc(A) +#define malloc(A) ut_malloc_nokey(A) #define free(A) ut_free(A) #define realloc(P, A) ut_realloc(P, A) #define exit(A) ut_error @@ -692,7 +692,6 @@ In the state 'id', only two actions are possible (defined below). */ /********************************************************************** Release any resources used by the lexer. */ -UNIV_INTERN void pars_lexer_close(void) /*==================*/ diff --git a/storage/innobase/pars/pars0opt.cc b/storage/innobase/pars/pars0opt.cc index 5a7e1861d74..a01d535e595 100644 --- a/storage/innobase/pars/pars0opt.cc +++ b/storage/innobase/pars/pars0opt.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2014, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -32,6 +32,7 @@ Created 12/21/1997 Heikki Tuuri #include "row0sel.h" #include "row0ins.h" #include "row0upd.h" +#include "dict0boot.h" #include "dict0dict.h" #include "dict0mem.h" #include "que0que.h" @@ -50,7 +51,7 @@ Created 12/21/1997 Heikki Tuuri /*******************************************************************//** Inverts a comparison operator. -@return the equivalent operator when the order of the arguments is switched */ +@return the equivalent operator when the order of the arguments is switched */ static int opt_invert_cmp_op( @@ -79,7 +80,7 @@ opt_invert_cmp_op( Checks if the value of an expression can be calculated BEFORE the nth table in a join is accessed. If this is the case, it can possibly be used in an index search for the nth table. -@return TRUE if already determined */ +@return TRUE if already determined */ static ibool opt_check_exp_determined_before( @@ -138,7 +139,7 @@ opt_check_exp_determined_before( /*******************************************************************//** Looks in a comparison condition if a column value is already restricted by it BEFORE the nth table is accessed. -@return expression restricting the value of the column, or NULL if not known */ +@return expression restricting the value of the column, or NULL if not known */ static que_node_t* opt_look_for_col_in_comparison_before( @@ -244,7 +245,7 @@ Looks in a search condition if a column value is already restricted by the search condition BEFORE the nth table is accessed. Takes into account that if we will fetch in an ascending order, we cannot utilize an upper limit for a column value; in a descending order, respectively, a lower limit. -@return expression restricting the value of the column, or NULL if not known */ +@return expression restricting the value of the column, or NULL if not known */ static que_node_t* opt_look_for_col_in_cond_before( @@ -323,7 +324,7 @@ already know exactly in the query. If we have a comparison condition for an additional field, 2 point are added. If the index is unique, and we know all the unique fields for the index we add 1024 points. For a clustered index we add 1 point. -@return goodness */ +@return goodness */ static ulint opt_calc_index_goodness( @@ -411,7 +412,7 @@ opt_calc_index_goodness( /*******************************************************************//** Calculates the number of matched fields based on an index goodness. -@return number of excatly or partially matched fields */ +@return number of excatly or partially matched fields */ UNIV_INLINE ulint opt_calc_n_fields_from_goodness( @@ -424,9 +425,9 @@ opt_calc_n_fields_from_goodness( /*******************************************************************//** Converts a comparison operator to the corresponding search mode PAGE_CUR_GE, ... -@return search mode */ +@return search mode */ UNIV_INLINE -ulint +page_cur_mode_t opt_op_to_search_mode( /*==================*/ ibool asc, /*!< in: TRUE if the rows should be fetched in an @@ -460,12 +461,12 @@ opt_op_to_search_mode( ut_error; } - return(0); + return(PAGE_CUR_UNSUPP); } /*******************************************************************//** Determines if a node is an argument node of a function node. -@return TRUE if is an argument */ +@return TRUE if is an argument */ static ibool opt_is_arg( @@ -774,10 +775,10 @@ opt_find_test_conds( fclass = opt_classify_comparison(sel_node, i, cond); if (fclass == OPT_END_COND) { - UT_LIST_ADD_LAST(cond_list, plan->end_conds, cond); + UT_LIST_ADD_LAST(plan->end_conds, cond); } else if (fclass == OPT_TEST_COND) { - UT_LIST_ADD_LAST(cond_list, plan->other_conds, cond); + UT_LIST_ADD_LAST(plan->other_conds, cond); } } @@ -839,8 +840,8 @@ opt_determine_and_normalize_test_conds( plan = sel_node_get_nth_plan(sel_node, i); - UT_LIST_INIT(plan->end_conds); - UT_LIST_INIT(plan->other_conds); + UT_LIST_INIT(plan->end_conds, &func_node_t::cond_list); + UT_LIST_INIT(plan->other_conds, &func_node_t::cond_list); /* Recursively go through the conjuncts and classify them */ @@ -862,7 +863,6 @@ already exist in the list. If the column is already in the list, puts a value indirection to point to the occurrence in the column list, except if the column occurrence we are looking at is in the column list, in which case nothing is done. */ -UNIV_INTERN void opt_find_all_cols( /*==============*/ @@ -941,7 +941,7 @@ opt_find_all_cols( /* The same column did not occur in the list: add it */ - UT_LIST_ADD_LAST(col_var_list, *col_list, sym_node); + UT_LIST_ADD_LAST(*col_list, sym_node); sym_node->copy_val = copy_val; @@ -1037,7 +1037,7 @@ opt_classify_cols( plan->must_get_clust = FALSE; - UT_LIST_INIT(plan->columns); + UT_LIST_INIT(plan->columns, &sym_node_t::col_var_list); /* All select list columns should be copied: therefore TRUE as the first argument */ @@ -1119,13 +1119,13 @@ opt_clust_access( /* We optimize here only queries to InnoDB's internal system tables, and they should not contain column prefix indexes. */ - if (dict_index_get_nth_field(index, pos)->prefix_len != 0 + if (dict_is_sys_table(index->table->id) + && (dict_index_get_nth_field(index, pos)->prefix_len != 0 || dict_index_get_nth_field(clust_index, i) - ->prefix_len != 0) { - fprintf(stderr, - "InnoDB: Error in pars0opt.cc:" - " table %s has prefix_len != 0\n", - index->table_name); + ->prefix_len != 0)) { + ib::error() << "Error in pars0opt.cc: table " + << index->table->name + << " has prefix_len != 0"; } *(plan->clust_map + i) = pos; @@ -1138,7 +1138,6 @@ opt_clust_access( Optimizes a select. Decides which indexes to tables to use. The tables are accessed in the order that they were written to the FROM part in the select statement. */ -UNIV_INTERN void opt_search_plan( /*============*/ @@ -1213,9 +1212,9 @@ opt_search_plan( #endif } +#if 1//def UNIV_SQL_DEBUG /********************************************************************//** Prints info of a query plan. */ -UNIV_INTERN void opt_print_query_plan( /*=================*/ @@ -1251,11 +1250,13 @@ opt_print_query_plan( n_fields = 0; } - fputs("Table ", stderr); - dict_index_name_print(stderr, NULL, plan->index); - fprintf(stderr,"; exact m. %lu, match %lu, end conds %lu\n", + fprintf(stderr, + "Index %s of table %s" + "; exact m. %lu, match %lu, end conds %lu\n", + plan->index->name(), plan->index->table_name, (unsigned long) plan->n_exact_match, (unsigned long) n_fields, (unsigned long) UT_LIST_GET_LEN(plan->end_conds)); } } +#endif /* UNIV_SQL_DEBUG */ diff --git a/storage/innobase/pars/pars0pars.cc b/storage/innobase/pars/pars0pars.cc index e6af3d25e86..ebee3d3eeea 100644 --- a/storage/innobase/pars/pars0pars.cc +++ b/storage/innobase/pars/pars0pars.cc @@ -26,6 +26,8 @@ Created 11/19/1996 Heikki Tuuri /* Historical note: Innobase executed its first SQL string (CREATE TABLE) on 1/27/1998 */ +#include "ha_prototypes.h" + #include "pars0pars.h" #ifdef UNIV_NONINL @@ -48,53 +50,47 @@ on 1/27/1998 */ #include "lock0lock.h" #include "eval0eval.h" -#ifdef UNIV_SQL_DEBUG -/** If the following is set TRUE, the lexer will print the SQL string -as it tokenizes it */ -UNIV_INTERN ibool pars_print_lexed = FALSE; -#endif /* UNIV_SQL_DEBUG */ - /* Global variable used while parsing a single procedure or query : the code is NOT re-entrant */ -UNIV_INTERN sym_tab_t* pars_sym_tab_global; +sym_tab_t* pars_sym_tab_global; /* Global variables used to denote certain reserved words, used in constructing the parsing tree */ -UNIV_INTERN pars_res_word_t pars_to_char_token = {PARS_TO_CHAR_TOKEN}; -UNIV_INTERN pars_res_word_t pars_to_number_token = {PARS_TO_NUMBER_TOKEN}; -UNIV_INTERN pars_res_word_t pars_to_binary_token = {PARS_TO_BINARY_TOKEN}; -UNIV_INTERN pars_res_word_t pars_binary_to_number_token = {PARS_BINARY_TO_NUMBER_TOKEN}; -UNIV_INTERN pars_res_word_t pars_substr_token = {PARS_SUBSTR_TOKEN}; -UNIV_INTERN pars_res_word_t pars_replstr_token = {PARS_REPLSTR_TOKEN}; -UNIV_INTERN pars_res_word_t pars_concat_token = {PARS_CONCAT_TOKEN}; -UNIV_INTERN pars_res_word_t pars_instr_token = {PARS_INSTR_TOKEN}; -UNIV_INTERN pars_res_word_t pars_length_token = {PARS_LENGTH_TOKEN}; -UNIV_INTERN pars_res_word_t pars_sysdate_token = {PARS_SYSDATE_TOKEN}; -UNIV_INTERN pars_res_word_t pars_printf_token = {PARS_PRINTF_TOKEN}; -UNIV_INTERN pars_res_word_t pars_assert_token = {PARS_ASSERT_TOKEN}; -UNIV_INTERN pars_res_word_t pars_rnd_token = {PARS_RND_TOKEN}; -UNIV_INTERN pars_res_word_t pars_rnd_str_token = {PARS_RND_STR_TOKEN}; -UNIV_INTERN pars_res_word_t pars_count_token = {PARS_COUNT_TOKEN}; -UNIV_INTERN pars_res_word_t pars_sum_token = {PARS_SUM_TOKEN}; -UNIV_INTERN pars_res_word_t pars_distinct_token = {PARS_DISTINCT_TOKEN}; -UNIV_INTERN pars_res_word_t pars_binary_token = {PARS_BINARY_TOKEN}; -UNIV_INTERN pars_res_word_t pars_blob_token = {PARS_BLOB_TOKEN}; -UNIV_INTERN pars_res_word_t pars_int_token = {PARS_INT_TOKEN}; -UNIV_INTERN pars_res_word_t pars_bigint_token = {PARS_BIGINT_TOKEN}; -UNIV_INTERN pars_res_word_t pars_char_token = {PARS_CHAR_TOKEN}; -UNIV_INTERN pars_res_word_t pars_float_token = {PARS_FLOAT_TOKEN}; -UNIV_INTERN pars_res_word_t pars_update_token = {PARS_UPDATE_TOKEN}; -UNIV_INTERN pars_res_word_t pars_asc_token = {PARS_ASC_TOKEN}; -UNIV_INTERN pars_res_word_t pars_desc_token = {PARS_DESC_TOKEN}; -UNIV_INTERN pars_res_word_t pars_open_token = {PARS_OPEN_TOKEN}; -UNIV_INTERN pars_res_word_t pars_close_token = {PARS_CLOSE_TOKEN}; -UNIV_INTERN pars_res_word_t pars_share_token = {PARS_SHARE_TOKEN}; -UNIV_INTERN pars_res_word_t pars_unique_token = {PARS_UNIQUE_TOKEN}; -UNIV_INTERN pars_res_word_t pars_clustered_token = {PARS_CLUSTERED_TOKEN}; +pars_res_word_t pars_to_char_token = {PARS_TO_CHAR_TOKEN}; +pars_res_word_t pars_to_number_token = {PARS_TO_NUMBER_TOKEN}; +pars_res_word_t pars_to_binary_token = {PARS_TO_BINARY_TOKEN}; +pars_res_word_t pars_binary_to_number_token = {PARS_BINARY_TO_NUMBER_TOKEN}; +pars_res_word_t pars_substr_token = {PARS_SUBSTR_TOKEN}; +pars_res_word_t pars_replstr_token = {PARS_REPLSTR_TOKEN}; +pars_res_word_t pars_concat_token = {PARS_CONCAT_TOKEN}; +pars_res_word_t pars_instr_token = {PARS_INSTR_TOKEN}; +pars_res_word_t pars_length_token = {PARS_LENGTH_TOKEN}; +pars_res_word_t pars_sysdate_token = {PARS_SYSDATE_TOKEN}; +pars_res_word_t pars_printf_token = {PARS_PRINTF_TOKEN}; +pars_res_word_t pars_assert_token = {PARS_ASSERT_TOKEN}; +pars_res_word_t pars_rnd_token = {PARS_RND_TOKEN}; +pars_res_word_t pars_rnd_str_token = {PARS_RND_STR_TOKEN}; +pars_res_word_t pars_count_token = {PARS_COUNT_TOKEN}; +pars_res_word_t pars_sum_token = {PARS_SUM_TOKEN}; +pars_res_word_t pars_distinct_token = {PARS_DISTINCT_TOKEN}; +pars_res_word_t pars_binary_token = {PARS_BINARY_TOKEN}; +pars_res_word_t pars_blob_token = {PARS_BLOB_TOKEN}; +pars_res_word_t pars_int_token = {PARS_INT_TOKEN}; +pars_res_word_t pars_bigint_token = {PARS_BIGINT_TOKEN}; +pars_res_word_t pars_char_token = {PARS_CHAR_TOKEN}; +pars_res_word_t pars_float_token = {PARS_FLOAT_TOKEN}; +pars_res_word_t pars_update_token = {PARS_UPDATE_TOKEN}; +pars_res_word_t pars_asc_token = {PARS_ASC_TOKEN}; +pars_res_word_t pars_desc_token = {PARS_DESC_TOKEN}; +pars_res_word_t pars_open_token = {PARS_OPEN_TOKEN}; +pars_res_word_t pars_close_token = {PARS_CLOSE_TOKEN}; +pars_res_word_t pars_share_token = {PARS_SHARE_TOKEN}; +pars_res_word_t pars_unique_token = {PARS_UNIQUE_TOKEN}; +pars_res_word_t pars_clustered_token = {PARS_CLUSTERED_TOKEN}; /** Global variable used to denote the '*' in SELECT * FROM.. */ -UNIV_INTERN ulint pars_star_denoter = 12345678; +ulint pars_star_denoter = 12345678; /******************************************************************** Get user function with the given name.*/ @@ -188,7 +184,7 @@ pars_info_lookup_bound_lit( /*********************************************************************//** Determines the class of a function code. -@return function class: PARS_FUNC_ARITH, ... */ +@return function class: PARS_FUNC_ARITH, ... */ static ulint pars_func_get_class( @@ -233,7 +229,7 @@ pars_func_get_class( /*********************************************************************//** Parses an operator or predefined function expression. -@return own: function node in a query tree */ +@return own: function node in a query tree */ static func_node_t* pars_func_low( @@ -256,15 +252,14 @@ pars_func_low( node->args = arg; - UT_LIST_ADD_LAST(func_node_list, pars_sym_tab_global->func_node_list, - node); + UT_LIST_ADD_LAST(pars_sym_tab_global->func_node_list, node); + return(node); } /*********************************************************************//** Parses a function expression. -@return own: function node in a query tree */ -UNIV_INTERN +@return own: function node in a query tree */ func_node_t* pars_func( /*======*/ @@ -277,7 +272,6 @@ pars_func( /************************************************************************* Rebind a LIKE search string. NOTE: We ignore any '%' characters embedded within the search string.*/ - int pars_like_rebind( /*=============*/ @@ -300,9 +294,7 @@ pars_like_rebind( } /* Is this a '%STRING' or %STRING% ?*/ - if (*ptr == '%') { - op = (op == IB_LIKE_PREFIX) ? IB_LIKE_SUBSTR : IB_LIKE_SUFFIX; - } + ut_ad(*ptr != '%'); if (node->like_node == NULL) { /* Add the LIKE operator info node to the node list. @@ -338,10 +330,8 @@ pars_like_rebind( mach_read_from_4(static_cast<byte*>(dfield_get_data(dfield)))); switch (op_check) { - case IB_LIKE_PREFIX: - case IB_LIKE_SUFFIX: - case IB_LIKE_SUBSTR: - case IB_LIKE_EXACT: + case IB_LIKE_PREFIX: + case IB_LIKE_EXACT: break; default: @@ -382,36 +372,6 @@ pars_like_rebind( dfield_set_data(dfield, ptr, ptr_len - 1); break; - case IB_LIKE_SUFFIX: - func = PARS_LIKE_TOKEN_SUFFIX; - - /* Modify the original node */ - /* Make it an '' empty string */ - dfield_set_len(dfield, 0); - - dfield = que_node_get_val(str_node); - dtype = dfield_get_type(dfield); - - ut_a(dtype_get_mtype(dtype) == DATA_VARCHAR); - - dfield_set_data(dfield, ptr + 1, ptr_len - 1); - break; - - case IB_LIKE_SUBSTR: - func = PARS_LIKE_TOKEN_SUBSTR; - - /* Modify the original node */ - /* Make it an '' empty string */ - dfield_set_len(dfield, 0); - - dfield = que_node_get_val(str_node); - dtype = dfield_get_type(dfield); - - ut_a(dtype_get_mtype(dtype) == DATA_VARCHAR); - - dfield_set_data(dfield, ptr + 1, ptr_len - 2); - break; - default: ut_error; } @@ -450,8 +410,7 @@ pars_like_op( } /*********************************************************************//** Parses an operator expression. -@return own: function node in a query tree */ -UNIV_INTERN +@return own: function node in a query tree */ func_node_t* pars_op( /*====*/ @@ -485,8 +444,7 @@ pars_op( /*********************************************************************//** Parses an ORDER BY clause. Order by a single column only is supported. -@return own: order-by node in a query tree */ -UNIV_INTERN +@return own: order-by node in a query tree */ order_node_t* pars_order_by( /*==========*/ @@ -516,7 +474,7 @@ pars_order_by( /*********************************************************************//** Determine if a data type is a built-in string data type of the InnoDB SQL parser. -@return TRUE if string data type */ +@return TRUE if string data type */ static ibool pars_is_string_type( @@ -715,8 +673,7 @@ pars_resolve_exp_variables_and_types( sym_node->indirection = node; if (select_node) { - UT_LIST_ADD_LAST(col_var_list, select_node->copy_variables, - sym_node); + UT_LIST_ADD_LAST(select_node->copy_variables, sym_node); } dfield_set_type(que_node_get_val(sym_node), @@ -868,7 +825,7 @@ pars_retrieve_table_def( /*********************************************************************//** Retrieves the table definitions for a list of table name ids. -@return number of tables */ +@return number of tables */ static ulint pars_retrieve_table_list_defs( @@ -935,8 +892,7 @@ pars_select_all_columns( /*********************************************************************//** Parses a select list; creates a query graph node for the whole SELECT statement. -@return own: select node in a query tree */ -UNIV_INTERN +@return own: select node in a query tree */ sel_node_t* pars_select_list( /*=============*/ @@ -1000,8 +956,7 @@ pars_check_aggregate( /*********************************************************************//** Parses a select statement. -@return own: select node in a query tree */ -UNIV_INTERN +@return own: select node in a query tree */ sel_node_t* pars_select_statement( /*==================*/ @@ -1029,7 +984,7 @@ pars_select_statement( == que_node_list_get_len(select_node->select_list)); } - UT_LIST_INIT(select_node->copy_variables); + UT_LIST_INIT(select_node->copy_variables, &sym_node_t::col_var_list); pars_resolve_exp_list_columns(table_list, select_node->select_list); pars_resolve_exp_list_variables_and_types(select_node, @@ -1083,8 +1038,7 @@ pars_select_statement( /*********************************************************************//** Parses a cursor declaration. -@return sym_node */ -UNIV_INTERN +@return sym_node */ que_node_t* pars_cursor_declaration( /*====================*/ @@ -1104,8 +1058,7 @@ pars_cursor_declaration( /*********************************************************************//** Parses a function declaration. -@return sym_node */ -UNIV_INTERN +@return sym_node */ que_node_t* pars_function_declaration( /*======================*/ @@ -1124,8 +1077,7 @@ pars_function_declaration( /*********************************************************************//** Parses a delete or update statement start. -@return own: update node in a query tree */ -UNIV_INTERN +@return own: update node in a query tree */ upd_node_t* pars_update_statement_start( /*========================*/ @@ -1148,8 +1100,7 @@ pars_update_statement_start( /*********************************************************************//** Parses a column assignment in an update. -@return column assignment node */ -UNIV_INTERN +@return column assignment node */ col_assign_node_t* pars_column_assignment( /*===================*/ @@ -1262,8 +1213,7 @@ pars_process_assign_list( /*********************************************************************//** Parses an update or delete statement. -@return own: update node in a query tree */ -UNIV_INTERN +@return own: update node in a query tree */ upd_node_t* pars_update_statement( /*==================*/ @@ -1281,7 +1231,7 @@ pars_update_statement( pars_retrieve_table_def(table_sym); node->table = table_sym->table; - UT_LIST_INIT(node->columns); + UT_LIST_INIT(node->columns, &sym_node_t::col_var_list); /* Make the single table node into a list of table nodes of length 1 */ @@ -1348,8 +1298,7 @@ pars_update_statement( /*********************************************************************//** Parses an insert statement. -@return own: update node in a query tree */ -UNIV_INTERN +@return own: update node in a query tree */ ins_node_t* pars_insert_statement( /*==================*/ @@ -1459,8 +1408,7 @@ pars_set_dfield_type( /*********************************************************************//** Parses a variable declaration. -@return own: symbol table node of type SYM_VAR */ -UNIV_INTERN +@return own: symbol table node of type SYM_VAR */ sym_node_t* pars_variable_declaration( /*======================*/ @@ -1480,8 +1428,7 @@ pars_variable_declaration( /*********************************************************************//** Parses a procedure parameter declaration. -@return own: symbol table node of type SYM_VAR */ -UNIV_INTERN +@return own: symbol table node of type SYM_VAR */ sym_node_t* pars_parameter_declaration( /*=======================*/ @@ -1523,8 +1470,7 @@ pars_set_parent_in_list( /*********************************************************************//** Parses an elsif element. -@return elsif node */ -UNIV_INTERN +@return elsif node */ elsif_node_t* pars_elsif_element( /*===============*/ @@ -1550,8 +1496,7 @@ pars_elsif_element( /*********************************************************************//** Parses an if-statement. -@return if-statement node */ -UNIV_INTERN +@return if-statement node */ if_node_t* pars_if_statement( /*==============*/ @@ -1604,8 +1549,7 @@ pars_if_statement( /*********************************************************************//** Parses a while-statement. -@return while-statement node */ -UNIV_INTERN +@return while-statement node */ while_node_t* pars_while_statement( /*=================*/ @@ -1633,8 +1577,7 @@ pars_while_statement( /*********************************************************************//** Parses a for-loop-statement. -@return for-statement node */ -UNIV_INTERN +@return for-statement node */ for_node_t* pars_for_statement( /*===============*/ @@ -1670,8 +1613,7 @@ pars_for_statement( /*********************************************************************//** Parses an exit statement. -@return exit statement node */ -UNIV_INTERN +@return exit statement node */ exit_node_t* pars_exit_statement(void) /*=====================*/ @@ -1687,8 +1629,7 @@ pars_exit_statement(void) /*********************************************************************//** Parses a return-statement. -@return return-statement node */ -UNIV_INTERN +@return return-statement node */ return_node_t* pars_return_statement(void) /*=======================*/ @@ -1705,8 +1646,7 @@ pars_return_statement(void) /*********************************************************************//** Parses an assignment statement. -@return assignment statement node */ -UNIV_INTERN +@return assignment statement node */ assign_node_t* pars_assignment_statement( /*======================*/ @@ -1734,8 +1674,7 @@ pars_assignment_statement( /*********************************************************************//** Parses a procedure call. -@return function node */ -UNIV_INTERN +@return function node */ func_node_t* pars_procedure_call( /*================*/ @@ -1754,8 +1693,7 @@ pars_procedure_call( /*********************************************************************//** Parses a fetch statement. into_list or user_func (but not both) must be non-NULL. -@return fetch statement node */ -UNIV_INTERN +@return fetch statement node */ fetch_node_t* pars_fetch_statement( /*=================*/ @@ -1808,8 +1746,7 @@ pars_fetch_statement( /*********************************************************************//** Parses an open or close cursor statement. -@return fetch statement node */ -UNIV_INTERN +@return fetch statement node */ open_node_t* pars_open_statement( /*================*/ @@ -1840,8 +1777,7 @@ pars_open_statement( /*********************************************************************//** Parses a row_printf-statement. -@return row_printf-statement node */ -UNIV_INTERN +@return row_printf-statement node */ row_printf_node_t* pars_row_printf_statement( /*======================*/ @@ -1863,8 +1799,7 @@ pars_row_printf_statement( /*********************************************************************//** Parses a commit statement. -@return own: commit node struct */ -UNIV_INTERN +@return own: commit node struct */ commit_node_t* pars_commit_statement(void) /*=======================*/ @@ -1874,8 +1809,7 @@ pars_commit_statement(void) /*********************************************************************//** Parses a rollback statement. -@return own: rollback node struct */ -UNIV_INTERN +@return own: rollback node struct */ roll_node_t* pars_rollback_statement(void) /*=========================*/ @@ -1885,8 +1819,7 @@ pars_rollback_statement(void) /*********************************************************************//** Parses a column definition at a table creation. -@return column sym table node */ -UNIV_INTERN +@return column sym table node */ sym_node_t* pars_column_def( /*============*/ @@ -1916,8 +1849,7 @@ pars_column_def( /*********************************************************************//** Parses a table creation operation. -@return table create subgraph */ -UNIV_INTERN +@return table create subgraph */ tab_node_t* pars_create_table( /*==============*/ @@ -1959,7 +1891,7 @@ pars_create_table( on global variables. There is an inherent race here but that has always existed around this variable. */ if (srv_file_per_table) { - flags2 |= DICT_TF2_USE_TABLESPACE; + flags2 |= DICT_TF2_USE_FILE_PER_TABLE; } } @@ -1998,7 +1930,7 @@ pars_create_table( n_cols = que_node_list_get_len(column_defs); table = dict_mem_table_create( - table_sym->name, 0, n_cols, flags, flags2); + table_sym->name, 0, n_cols, 0, flags, flags2); #ifdef UNIV_DEBUG if (not_fit_in_memory != NULL) { @@ -2019,7 +1951,7 @@ pars_create_table( column = static_cast<sym_node_t*>(que_node_get_next(column)); } - node = tab_create_graph_create(table, pars_sym_tab_global->heap, true, + node = tab_create_graph_create(table, pars_sym_tab_global->heap, FIL_SPACE_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY); table_sym->resolved = TRUE; @@ -2030,8 +1962,7 @@ pars_create_table( /*********************************************************************//** Parses an index creation operation. -@return index create subgraph */ -UNIV_INTERN +@return index create subgraph */ ind_node_t* pars_create_index( /*==============*/ @@ -2074,7 +2005,7 @@ pars_create_index( column = static_cast<sym_node_t*>(que_node_get_next(column)); } - node = ind_create_graph_create(index, pars_sym_tab_global->heap, true); + node = ind_create_graph_create(index, pars_sym_tab_global->heap, NULL); table_sym->resolved = TRUE; table_sym->token_type = SYM_TABLE; @@ -2087,8 +2018,7 @@ pars_create_index( /*********************************************************************//** Parses a procedure definition. -@return query fork node */ -UNIV_INTERN +@return query fork node */ que_fork_t* pars_procedure_definition( /*======================*/ @@ -2138,8 +2068,7 @@ Parses a stored procedure call, when this is not within another stored procedure, that is, the client issues a procedure call directly. In MySQL/InnoDB, stored InnoDB procedures are invoked via the parsed procedure tree, not via InnoDB SQL, so this function is not used. -@return query graph */ -UNIV_INTERN +@return query graph */ que_fork_t* pars_stored_procedure_call( /*=======================*/ @@ -2152,7 +2081,6 @@ pars_stored_procedure_call( /*************************************************************//** Retrieves characters to the lexical analyzer. */ -UNIV_INTERN int pars_get_lex_chars( /*===============*/ @@ -2166,9 +2094,6 @@ pars_get_lex_chars( pars_sym_tab_global->string_len - pars_sym_tab_global->next_char_pos); if (len == 0) { -#ifdef YYDEBUG - /* fputs("SQL string ends\n", stderr); */ -#endif return(0); } @@ -2176,19 +2101,6 @@ pars_get_lex_chars( len = max_size; } -#ifdef UNIV_SQL_DEBUG - if (pars_print_lexed) { - - if (len >= 5) { - len = 5; - } - - fwrite(pars_sym_tab_global->sql_string - + pars_sym_tab_global->next_char_pos, - 1, len, stderr); - } -#endif /* UNIV_SQL_DEBUG */ - ut_memcpy(buf, pars_sym_tab_global->sql_string + pars_sym_tab_global->next_char_pos, len); @@ -2199,7 +2111,6 @@ pars_get_lex_chars( /*************************************************************//** Called by yyparse on error. */ -UNIV_INTERN void yyerror( /*====*/ @@ -2208,15 +2119,12 @@ yyerror( { ut_ad(s); - fputs("PARSER ERROR: Syntax error in SQL string\n", stderr); - - ut_error; + ib::fatal() << "PARSER: Syntax error in SQL string"; } /*************************************************************//** Parses an SQL string returning the query graph. -@return own: the query graph */ -UNIV_INTERN +@return own: the query graph */ que_t* pars_sql( /*=====*/ @@ -2232,7 +2140,7 @@ pars_sql( heap = mem_heap_create(16000); /* Currently, the parser is not reentrant: */ - ut_ad(mutex_own(&(dict_sys->mutex))); + ut_ad(mutex_own(&dict_sys->mutex)); pars_sym_tab_global = sym_tab_create(heap); @@ -2268,8 +2176,7 @@ pars_sql( Completes a query graph by adding query thread and fork nodes above it and prepares the graph for running. The fork created is of type QUE_FORK_MYSQL_INTERFACE. -@return query thread node to run */ -UNIV_INTERN +@return query thread node to run */ que_thr_t* pars_complete_graph_for_exec( /*=========================*/ @@ -2299,8 +2206,7 @@ pars_complete_graph_for_exec( /****************************************************************//** Create parser info struct. -@return own: info struct */ -UNIV_INTERN +@return own: info struct */ pars_info_t* pars_info_create(void) /*==================*/ @@ -2323,7 +2229,6 @@ pars_info_create(void) /****************************************************************//** Free info struct and everything it contains. */ -UNIV_INTERN void pars_info_free( /*===========*/ @@ -2334,7 +2239,6 @@ pars_info_free( /****************************************************************//** Add bound literal. */ -UNIV_INTERN void pars_info_add_literal( /*==================*/ @@ -2374,7 +2278,6 @@ pars_info_add_literal( /****************************************************************//** Equivalent to pars_info_add_literal(info, name, str, strlen(str), DATA_VARCHAR, DATA_ENGLISH). */ -UNIV_INTERN void pars_info_add_str_literal( /*======================*/ @@ -2389,7 +2292,6 @@ pars_info_add_str_literal( /******************************************************************** If the literal value already exists then it rebinds otherwise it creates a new entry.*/ -UNIV_INTERN void pars_info_bind_literal( /*===================*/ @@ -2418,7 +2320,6 @@ pars_info_bind_literal( /******************************************************************** If the literal value already exists then it rebinds otherwise it creates a new entry.*/ -UNIV_INTERN void pars_info_bind_varchar_literal( /*===========================*/ @@ -2452,7 +2353,6 @@ pars_info_add_literal(info, name, buf, 4, DATA_INT, 0); except that the buffer is dynamically allocated from the info struct's heap. */ -UNIV_INTERN void pars_info_add_int4_literal( /*=======================*/ @@ -2469,7 +2369,6 @@ pars_info_add_int4_literal( /******************************************************************** If the literal value already exists then it rebinds otherwise it creates a new entry. */ -UNIV_INTERN void pars_info_bind_int4_literal( /*========================*/ @@ -2495,7 +2394,6 @@ pars_info_bind_int4_literal( /******************************************************************** If the literal value already exists then it rebinds otherwise it creates a new entry. */ -UNIV_INTERN void pars_info_bind_int8_literal( /*========================*/ @@ -2528,7 +2426,6 @@ pars_info_add_literal(info, name, buf, 8, DATA_FIXBINARY, 0); except that the buffer is dynamically allocated from the info struct's heap. */ -UNIV_INTERN void pars_info_add_ull_literal( /*======================*/ @@ -2546,7 +2443,6 @@ pars_info_add_ull_literal( /****************************************************************//** If the literal value already exists then it rebinds otherwise it creates a new entry. */ -UNIV_INTERN void pars_info_bind_ull_literal( /*=======================*/ @@ -2572,7 +2468,6 @@ pars_info_bind_ull_literal( /****************************************************************//** Add user function. */ -UNIV_INTERN void pars_info_bind_function( /*====================*/ @@ -2607,7 +2502,6 @@ pars_info_bind_function( /******************************************************************** Add bound id. */ -UNIV_INTERN void pars_info_bind_id( /*==============*/ @@ -2644,7 +2538,6 @@ pars_info_bind_id( /******************************************************************** Get bound identifier with the given name.*/ - pars_bound_id_t* pars_info_get_bound_id( /*===================*/ @@ -2658,8 +2551,7 @@ pars_info_get_bound_id( /****************************************************************//** Get bound literal with the given name. -@return bound literal, or NULL if not found */ -UNIV_INTERN +@return bound literal, or NULL if not found */ pars_bound_lit_t* pars_info_get_bound_lit( /*====================*/ diff --git a/storage/innobase/pars/pars0sym.cc b/storage/innobase/pars/pars0sym.cc index b01a69cb33a..b6305368362 100644 --- a/storage/innobase/pars/pars0sym.cc +++ b/storage/innobase/pars/pars0sym.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2014, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -40,8 +40,7 @@ Created 12/15/1997 Heikki Tuuri /******************************************************************//** Creates a symbol table for a single stored procedure or query. -@return own: symbol table */ -UNIV_INTERN +@return own: symbol table */ sym_tab_t* sym_tab_create( /*===========*/ @@ -52,8 +51,8 @@ sym_tab_create( sym_tab = static_cast<sym_tab_t*>( mem_heap_alloc(heap, sizeof(sym_tab_t))); - UT_LIST_INIT(sym_tab->sym_list); - UT_LIST_INIT(sym_tab->func_node_list); + UT_LIST_INIT(sym_tab->sym_list, &sym_node_t::sym_list); + UT_LIST_INIT(sym_tab->func_node_list, &func_node_t::func_node_list); sym_tab->heap = heap; @@ -65,7 +64,6 @@ sym_tab_create( Frees the memory allocated dynamically AFTER parsing phase for variables etc. in the symbol table. Does not free the mem heap where the table was originally created. Frees also SQL explicit cursor definitions. */ -UNIV_INTERN void sym_tab_free_private( /*=================*/ @@ -112,8 +110,7 @@ sym_tab_free_private( /******************************************************************//** Adds an integer literal to a symbol table. -@return symbol table node */ -UNIV_INTERN +@return symbol table node */ sym_node_t* sym_tab_add_int_lit( /*================*/ @@ -145,7 +142,7 @@ sym_tab_add_int_lit( node->prefetch_buf = NULL; node->cursor_def = NULL; - UT_LIST_ADD_LAST(sym_list, sym_tab->sym_list, node); + UT_LIST_ADD_LAST(sym_tab->sym_list, node); node->like_node = NULL; @@ -156,8 +153,7 @@ sym_tab_add_int_lit( /******************************************************************//** Adds a string literal to a symbol table. -@return symbol table node */ -UNIV_INTERN +@return symbol table node */ sym_node_t* sym_tab_add_str_lit( /*================*/ @@ -184,7 +180,7 @@ sym_tab_add_str_lit( DATA_VARCHAR, DATA_ENGLISH, 0); data = (len) ? static_cast<byte*>(mem_heap_dup(sym_tab->heap, str, len)) - : NULL; + : NULL; dfield_set_data(&(node->common.val), data, len); @@ -192,7 +188,7 @@ sym_tab_add_str_lit( node->prefetch_buf = NULL; node->cursor_def = NULL; - UT_LIST_ADD_LAST(sym_list, sym_tab->sym_list, node); + UT_LIST_ADD_LAST(sym_tab->sym_list, node); node->like_node = NULL; @@ -203,8 +199,7 @@ sym_tab_add_str_lit( /******************************************************************//** Add a bound literal to a symbol table. -@return symbol table node */ -UNIV_INTERN +@return symbol table node */ sym_node_t* sym_tab_add_bound_lit( /*==================*/ @@ -273,7 +268,7 @@ sym_tab_add_bound_lit( node->prefetch_buf = NULL; node->cursor_def = NULL; - UT_LIST_ADD_LAST(sym_list, sym_tab->sym_list, node); + UT_LIST_ADD_LAST(sym_tab->sym_list, node); blit->node = node; node->like_node = NULL; @@ -284,7 +279,6 @@ sym_tab_add_bound_lit( /********************************************************************** Rebind literal to a node in the symbol table. */ - sym_node_t* sym_tab_rebind_lit( /*===============*/ @@ -328,8 +322,7 @@ sym_tab_rebind_lit( /******************************************************************//** Adds an SQL null literal to a symbol table. -@return symbol table node */ -UNIV_INTERN +@return symbol table node */ sym_node_t* sym_tab_add_null_lit( /*=================*/ @@ -356,7 +349,7 @@ sym_tab_add_null_lit( node->prefetch_buf = NULL; node->cursor_def = NULL; - UT_LIST_ADD_LAST(sym_list, sym_tab->sym_list, node); + UT_LIST_ADD_LAST(sym_tab->sym_list, node); node->like_node = NULL; @@ -367,8 +360,7 @@ sym_tab_add_null_lit( /******************************************************************//** Adds an identifier to a symbol table. -@return symbol table node */ -UNIV_INTERN +@return symbol table node */ sym_node_t* sym_tab_add_id( /*===========*/ @@ -386,7 +378,7 @@ sym_tab_add_id( node->name = mem_heap_strdupl(sym_tab->heap, (char*) name, len); node->name_len = len; - UT_LIST_ADD_LAST(sym_list, sym_tab->sym_list, node); + UT_LIST_ADD_LAST(sym_tab->sym_list, node); dfield_set_null(&node->common.val); @@ -397,8 +389,7 @@ sym_tab_add_id( /******************************************************************//** Add a bound identifier to a symbol table. -@return symbol table node */ -UNIV_INTERN +@return symbol table node */ sym_node_t* sym_tab_add_bound_id( /*=================*/ @@ -424,7 +415,7 @@ sym_tab_add_bound_id( node->name = mem_heap_strdup(sym_tab->heap, bid->id); node->name_len = strlen(node->name); - UT_LIST_ADD_LAST(sym_list, sym_tab->sym_list, node); + UT_LIST_ADD_LAST(sym_tab->sym_list, node); dfield_set_null(&node->common.val); |