MCPcopy Create free account
hub / github.com/MariaDB/server / insert_fields

Function insert_fields

sql/sql_base.cc:8765–8991  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8763*/
8764
8765bool
8766insert_fields(THD *thd, Name_resolution_context *context,
8767 const Lex_ident_db &db_name_arg,
8768 const Lex_ident_table &table_name,
8769 List_iterator<Item> *it,
8770 bool any_privileges, uint *hidden_bit_fields,
8771 bool returning_field)
8772{
8773 Field_iterator_table_ref field_iterator;
8774 bool found;
8775 Lex_ident_db db_name= db_name_arg;
8776 IdentBuffer<SAFE_NAME_LEN> db_name_buff;
8777 DBUG_ENTER("insert_fields");
8778 DBUG_PRINT("arena", ("stmt arena: %p",thd->stmt_arena));
8779
8780 if (db_name.str && lower_case_table_names)
8781 {
8782 /*
8783 convert database to lower case for comparison
8784 We can't do this in Item_field as this would change the
8785 'name' of the item which may be used in the select list
8786 */
8787 db_name= Lex_ident_db(db_name_buff.copy_casedn(db_name).to_lex_cstring());
8788 }
8789
8790 found= FALSE;
8791
8792 /*
8793 If table names are qualified, then loop over all tables used in the query,
8794 else treat natural joins as leaves and do not iterate over their underlying
8795 tables.
8796 */
8797 TABLE_LIST *first= context->first_name_resolution_table;
8798 TABLE_LIST *TABLE_LIST::* next= &TABLE_LIST::next_name_resolution_table;
8799 if (table_name.str && !returning_field)
8800 {
8801 first= context->table_list;
8802 next= &TABLE_LIST::next_local;
8803 }
8804 for (TABLE_LIST *tables= first; tables; tables= tables->*next)
8805 {
8806 Field *field;
8807 TABLE *table= tables->table;
8808
8809 DBUG_ASSERT(tables->is_leaf_for_name_resolution());
8810
8811 if ((table_name.str && !table_name.streq(tables->alias)) ||
8812 (db_name.str && strcmp(tables->db.str, db_name.str)))
8813 continue;
8814
8815#ifndef NO_EMBEDDED_ACCESS_CHECKS
8816 /*
8817 Ensure that we have access rights to all fields to be inserted
8818 the table 'tables'. Under some circumstances, this check may be skipped.
8819
8820 The check is skipped in the following cases:
8821
8822 - any_privileges is true

Callers 1

setup_wildFunction · 0.85

Calls 15

Lex_ident_dbClass · 0.85
check_grant_all_columnsFunction · 0.85
lex_string_setFunction · 0.85
get_column_grantFunction · 0.85
my_errorFunction · 0.85
my_snprintfFunction · 0.85
copy_casednMethod · 0.80
is_derivedMethod · 0.80
is_viewMethod · 0.80
is_with_tableMethod · 0.80
grantMethod · 0.80

Tested by

no test coverage detected