summaryrefslogtreecommitdiffstats
path: root/sql/sql_lex.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sql/sql_lex.h72
1 files changed, 67 insertions, 5 deletions
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index f548fbe5..3151f237 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -146,6 +146,11 @@ public:
struct Lex_ident_sys_st: public LEX_CSTRING
{
public:
+ static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
+ { return alloc_root(mem_root, size); }
+ static void operator delete(void *ptr,size_t size) { TRASH_FREE(ptr, size); }
+ static void operator delete(void *ptr, MEM_ROOT *mem_root) {}
+
bool copy_ident_cli(THD *thd, const Lex_ident_cli_st *str);
bool copy_keyword(THD *thd, const Lex_ident_cli_st *str);
bool copy_sys(THD *thd, const LEX_CSTRING *str);
@@ -179,6 +184,10 @@ public:
LEX_CSTRING tmp= {name, length};
set_valid_utf8(&tmp);
}
+ Lex_ident_sys(THD *thd, const LEX_CSTRING *str)
+ {
+ set_valid_utf8(str);
+ }
Lex_ident_sys & operator=(const Lex_ident_sys_st &name)
{
Lex_ident_sys_st::operator=(name);
@@ -1221,6 +1230,11 @@ public:
List<Field_pair> grouping_tmp_fields;
List<udf_func> udf_list; /* udf function calls stack */
List<Index_hint> *index_hints; /* list of USE/FORCE/IGNORE INDEX */
+ /*
+ This list is used to restore the names of items
+ from item_list after each execution of the statement.
+ */
+ List<Lex_ident_sys> *orig_names_of_item_list_elems;
List<List_item> save_many_values;
List<Item> *save_insert_list;
@@ -1438,6 +1452,9 @@ public:
bool straight_fl);
TABLE_LIST *convert_right_join();
List<Item>* get_item_list();
+ bool save_item_list_names(THD *thd);
+ void restore_item_list_names();
+
ulong get_table_join_options();
void set_lock_for_tables(thr_lock_type lock_type, bool for_update,
bool skip_locks);
@@ -1577,7 +1594,8 @@ public:
master_unit()->cloned_from->with_element :
master_unit()->with_element;
}
- With_element *find_table_def_in_with_clauses(TABLE_LIST *table);
+ With_element *find_table_def_in_with_clauses(TABLE_LIST *table,
+ st_select_lex_unit * excl_spec);
bool check_unrestricted_recursive(bool only_standard_compliant);
bool check_subqueries_with_recursive_references();
void collect_grouping_fields_for_derived(THD *thd, ORDER *grouping_list);
@@ -2461,6 +2479,15 @@ public:
void reduce_digest_token(uint token_left, uint token_right);
private:
+
+ enum Ident_mode
+ {
+ GENERAL_KEYWORD_OR_FUNC_LPAREN,
+ QUALIFIED_SPECIAL_FUNC_LPAREN
+ };
+
+ int scan_ident_common(THD *thd, Lex_ident_cli_st *str, Ident_mode mode);
+
/**
Set the echo mode.
@@ -2781,8 +2808,8 @@ private:
bool consume_comment(int remaining_recursions_permitted);
int lex_one_token(union YYSTYPE *yylval, THD *thd);
int find_keyword(Lex_ident_cli_st *str, uint len, bool function) const;
+ int find_keyword_qualified_special_func(Lex_ident_cli_st *str, uint len) const;
LEX_CSTRING get_token(uint skip, uint length);
- int scan_ident_sysvar(THD *thd, Lex_ident_cli_st *str);
int scan_ident_start(THD *thd, Lex_ident_cli_st *str);
int scan_ident_middle(THD *thd, Lex_ident_cli_st *str,
CHARSET_INFO **cs, my_lex_states *);
@@ -4128,8 +4155,42 @@ public:
Item *create_item_query_expression(THD *thd, st_select_lex_unit *unit);
Item *make_item_func_sysdate(THD *thd, uint fsp);
- Item *make_item_func_call_generic(THD *thd, Lex_ident_cli_st *db,
- Lex_ident_cli_st *name, List<Item> *args);
+
+ static const Schema *
+ find_func_schema_by_name_or_error(const Lex_ident_sys &schema_name,
+ const Lex_ident_sys &func_name);
+ Item *make_item_func_replace(THD *thd,
+ const Lex_ident_cli_st &schema_name,
+ const Lex_ident_cli_st &func_name,
+ Item *org, Item *find, Item *replace);
+ Item *make_item_func_replace(THD *thd,
+ const Lex_ident_cli_st &schema_name,
+ const Lex_ident_cli_st &func_name,
+ List<Item> *args);
+ Item *make_item_func_substr(THD *thd,
+ const Lex_ident_cli_st &schema_name,
+ const Lex_ident_cli_st &func_name,
+ const Lex_substring_spec_st &spec);
+ Item *make_item_func_substr(THD *thd,
+ const Lex_ident_cli_st &schema_name,
+ const Lex_ident_cli_st &func_name,
+ List<Item> *args);
+ Item *make_item_func_trim(THD *thd,
+ const Lex_ident_cli_st &schema_name,
+ const Lex_ident_cli_st &func_name,
+ const Lex_trim_st &spec);
+ Item *make_item_func_trim(THD *thd,
+ const Lex_ident_cli_st &schema_name,
+ const Lex_ident_cli_st &func_name,
+ List<Item> *args);
+ Item *make_item_func_call_generic(THD *thd,
+ const Lex_ident_cli_st *db,
+ const Lex_ident_cli_st *name,
+ List<Item> *args);
+ Item *make_item_func_call_generic(THD *thd,
+ const Lex_ident_sys &db,
+ const Lex_ident_sys &name,
+ List<Item> *args);
Item *make_item_func_call_generic(THD *thd,
Lex_ident_cli_st *db,
Lex_ident_cli_st *pkg,
@@ -4830,7 +4891,8 @@ public:
bool check_dependencies_in_with_clauses();
bool check_cte_dependencies_and_resolve_references();
bool resolve_references_to_cte(TABLE_LIST *tables,
- TABLE_LIST **tables_last);
+ TABLE_LIST **tables_last,
+ st_select_lex_unit *excl_spec);
/**
Turn on the SELECT_DESCRIBE flag for every SELECT_LEX involved into