diff options
Diffstat (limited to 'sql/sql_lex.h')
-rw-r--r-- | sql/sql_lex.h | 71 |
1 files changed, 44 insertions, 27 deletions
diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 47f66faf048..9daf28653b1 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -17,6 +17,9 @@ @defgroup Semantic_Analysis Semantic Analysis */ +#ifndef SQL_LEX_INCLUDED +#define SQL_LEX_INCLUDED + /* YACC and LEX Definitions */ /* These may not be declared yet */ @@ -94,7 +97,7 @@ enum enum_sql_command { SQLCOM_SHOW_SLAVE_HOSTS, SQLCOM_DELETE_MULTI, SQLCOM_UPDATE_MULTI, SQLCOM_SHOW_BINLOG_EVENTS, SQLCOM_SHOW_NEW_MASTER, SQLCOM_DO, SQLCOM_SHOW_WARNS, SQLCOM_EMPTY_QUERY, SQLCOM_SHOW_ERRORS, - SQLCOM_SHOW_COLUMN_TYPES, SQLCOM_SHOW_STORAGE_ENGINES, SQLCOM_SHOW_PRIVILEGES, + SQLCOM_SHOW_STORAGE_ENGINES, SQLCOM_SHOW_PRIVILEGES, SQLCOM_HELP, SQLCOM_CREATE_USER, SQLCOM_DROP_USER, SQLCOM_RENAME_USER, SQLCOM_REVOKE_ALL, SQLCOM_CHECKSUM, SQLCOM_CREATE_PROCEDURE, SQLCOM_CREATE_SPFUNCTION, SQLCOM_CALL, @@ -119,7 +122,7 @@ enum enum_sql_command { SQLCOM_ALTER_DB_UPGRADE, SQLCOM_SHOW_PROFILE, SQLCOM_SHOW_PROFILES, SQLCOM_SIGNAL, SQLCOM_RESIGNAL, - + SQLCOM_SHOW_RELAYLOG_EVENTS, /* When a command is added here, be sure it's also added in mysqld.cc in "struct show_var_st status_vars[]= {" ... @@ -204,17 +207,19 @@ typedef struct st_lex_master_info { char *host, *user, *password, *log_file_name; uint port, connect_retry; + float heartbeat_period; ulonglong pos; ulong server_id; /* Enum is used for making it possible to detect if the user changed variable or if it should be left at old value */ - enum {SSL_UNCHANGED, SSL_DISABLE, SSL_ENABLE} - ssl, ssl_verify_server_cert; + enum {LEX_MI_UNCHANGED, LEX_MI_DISABLE, LEX_MI_ENABLE} + ssl, ssl_verify_server_cert, heartbeat_opt, repl_ignore_server_ids_opt; char *ssl_key, *ssl_cert, *ssl_ca, *ssl_capath, *ssl_cipher; char *relay_log_name; ulong relay_log_pos; + DYNAMIC_ARRAY repl_ignore_server_ids; } LEX_MASTER_INFO; @@ -395,7 +400,7 @@ public: Base class for st_select_lex (SELECT_LEX) & st_select_lex_unit (SELECT_LEX_UNIT) */ -struct st_lex; +struct LEX; class st_select_lex; class st_select_lex_unit; class st_select_lex_node { @@ -465,7 +470,7 @@ public: virtual void set_lock_for_tables(thr_lock_type lock_type) {} friend class st_select_lex_unit; - friend bool mysql_new_select(struct st_lex *lex, bool move_down); + friend bool mysql_new_select(LEX *lex, bool move_down); friend bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table, uint flags); private: @@ -585,7 +590,7 @@ public: /* Saved values of the WHERE and HAVING clauses*/ Item::cond_result cond_value, having_value; /* point on lex in which it was created, used in view subquery detection */ - st_lex *parent_lex; + LEX *parent_lex; enum olap_type olap; /* FROM clause - points to the beginning of the TABLE_LIST::next_local list. */ SQL_LIST table_list; @@ -894,7 +899,7 @@ public: enum enum_enable_or_disable keys_onoff; enum tablespace_op_type tablespace_op; List<char> partition_names; - uint no_parts; + uint num_parts; enum_alter_table_change_level change_level; Create_field *datetime_field; bool error_if_not_empty; @@ -904,7 +909,7 @@ public: flags(0), keys_onoff(LEAVE_AS_IS), tablespace_op(NO_TABLESPACE_OP), - no_parts(0), + num_parts(0), change_level(ALTER_TABLE_METADATA_ONLY), datetime_field(NULL), error_if_not_empty(FALSE) @@ -919,7 +924,7 @@ public: flags= 0; keys_onoff= LEAVE_AS_IS; tablespace_op= NO_TABLESPACE_OP; - no_parts= 0; + num_parts= 0; partition_names.empty(); change_level= ALTER_TABLE_METADATA_ONLY; datetime_field= 0; @@ -951,6 +956,9 @@ extern sys_var *trg_new_row_fake_var; enum xa_option_words {XA_NONE, XA_JOIN, XA_RESUME, XA_ONE_PHASE, XA_SUSPEND, XA_FOR_MIGRATE}; +extern const LEX_STRING null_lex_str; +extern const LEX_STRING empty_lex_str; + /* Class representing list of all tables used by statement. @@ -959,7 +967,7 @@ enum xa_option_words {XA_NONE, XA_JOIN, XA_RESUME, XA_ONE_PHASE, stored functions/triggers to this list in order to pre-open and lock them. - Also used by st_lex::reset_n_backup/restore_backup_query_tables_list() + Also used by LEX::reset_n_backup/restore_backup_query_tables_list() methods to save and restore this information. */ @@ -1406,6 +1414,17 @@ public: /** Interface with bison, value of the last token parsed. */ LEX_YYSTYPE yylval; + /** + LALR(2) resolution, look ahead token. + Value of the next token to return, if any, + or -1, if no token was parsed in advance. + Note: 0 is a legal token, and represents YYEOF. + */ + int lookahead_token; + + /** LALR(2) resolution, value of the look ahead token.*/ + LEX_YYSTYPE lookahead_yylval; + private: /** Pointer to the current position in the raw input stream. */ const char *m_ptr; @@ -1487,9 +1506,13 @@ public: /** TRUE if we're parsing a prepared statement: in this mode - we should allow placeholders and disallow multi-statements. + we should allow placeholders. */ bool stmt_prepare_mode; + /** + TRUE if we should allow multi-statements. + */ + bool multi_statements; /** State of the lexical analyser for comments. */ enum_comment_state in_comment; @@ -1548,7 +1571,7 @@ protected: Constructor. @param lex the LEX structure that represents parts of this statement. */ - Sql_statement(struct st_lex *lex) + Sql_statement(LEX *lex) : m_lex(lex) {} @@ -1573,12 +1596,12 @@ protected: with the minimum set of attributes, instead of a LEX structure that contains the collection of every possible attribute. */ - struct st_lex *m_lex; + LEX *m_lex; }; /* The state of the lex parsing. This is saved in the THD struct */ -typedef struct st_lex : public Query_tables_list +struct LEX: public Query_tables_list { SELECT_LEX_UNIT unit; /* most upper unit */ SELECT_LEX select_lex; /* first SELECT_LEX */ @@ -1795,13 +1818,6 @@ typedef struct st_lex : public Query_tables_list const char *stmt_definition_end; - /* - Pointers to part of LOAD DATA statement that should be rewritten - during replication ("LOCAL 'filename' REPLACE INTO" part). - */ - const char *fname_start; - const char *fname_end; - /** During name resolution search only in the table list given by Name_resolution_context::first_name_resolution_table and @@ -1835,9 +1851,9 @@ typedef struct st_lex : public Query_tables_list */ bool protect_against_global_read_lock; - st_lex(); + LEX(); - virtual ~st_lex() + virtual ~LEX() { destroy_query_tables_list(); plugin_unlock_list(NULL, (plugin_ref *)plugins.buffer, plugins.elements); @@ -1879,7 +1895,7 @@ typedef struct st_lex : public Query_tables_list Is this update command where 'WHITH CHECK OPTION' clause is important SYNOPSIS - st_lex::which_check_option_applicable() + LEX::which_check_option_applicable() RETURN TRUE have to take 'WHITH CHECK OPTION' clause into account @@ -1951,7 +1967,7 @@ typedef struct st_lex : public Query_tables_list } return FALSE; } -} LEX; +}; /** @@ -2042,7 +2058,7 @@ public: }; -struct st_lex_local: public st_lex +struct st_lex_local: public LEX { static void *operator new(size_t size) throw() { @@ -2075,3 +2091,4 @@ extern bool is_lex_native_function(const LEX_STRING *name); void my_missing_function_error(const LEX_STRING &token, const char *name); #endif /* MYSQL_SERVER */ +#endif /* SQL_LEX_INCLUDED */ |