diff options
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 197fe86957c..243a8bf8b3f 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -2282,7 +2282,8 @@ void st_select_lex::init_select() group_list.empty(); if (group_list_ptrs) group_list_ptrs->clear(); - type= db= 0; + type= 0; + db= null_clex_str; having= 0; table_join_options= 0; in_sum_expr= with_wild= 0; @@ -3288,8 +3289,7 @@ uint8 LEX::get_effective_with_check(TABLE_LIST *view) case of success */ -bool -LEX::copy_db_to(const char **p_db, size_t *p_db_length) const +bool LEX::copy_db_to(LEX_CSTRING *to) { if (sphead && sphead->m_name.str) { @@ -3298,12 +3298,10 @@ LEX::copy_db_to(const char **p_db, size_t *p_db_length) const It is safe to assign the string by-pointer, both sphead and its statements reside in the same memory root. */ - *p_db= sphead->m_db.str; - if (p_db_length) - *p_db_length= sphead->m_db.length; + *to= sphead->m_db; return FALSE; } - return thd->copy_db_to(p_db, p_db_length); + return thd->copy_db_to(to); } /** @@ -6033,7 +6031,7 @@ sp_name *LEX::make_sp_name(THD *thd, const LEX_CSTRING *name) sp_name *res; LEX_CSTRING db; if (check_routine_name(name) || - copy_db_to(&db.str, &db.length) || + copy_db_to(&db) || (!(res= new (thd->mem_root) sp_name(&db, name, false)))) return NULL; return res; @@ -7484,18 +7482,16 @@ bool SELECT_LEX::vers_push_field(THD *thd, TABLE_LIST *table, const LEX_CSTRING { DBUG_ASSERT(field_name.str); Item_field *fld= new (thd->mem_root) Item_field(thd, &context, - table->db, table->alias, &field_name); - if (!fld) + table->db.str, table->alias.str, &field_name); + if (!fld || item_list.push_back(fld)) return true; - item_list.push_back(fld); - if (thd->lex->view_list.elements) { - if (LEX_STRING *l= thd->make_lex_string(field_name.str, field_name.length)) - thd->lex->view_list.push_back(l); - else + LEX_CSTRING *l; + if (!(l= thd->make_clex_string(field_name.str, field_name.length))) return true; + thd->lex->view_list.push_back(l); } return false; |