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

Function create_table_for_function

sql/json_table.cc:891–931  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

889*/
890
891TABLE *create_table_for_function(THD *thd, TABLE_LIST *sql_table)
892{
893 TMP_TABLE_PARAM tp;
894 TABLE *table;
895 uint field_count= sql_table->table_function->m_columns.elements+1;
896
897 DBUG_ENTER("create_table_for_function");
898
899 tp.init();
900 tp.table_charset= system_charset_info;
901 tp.field_count= field_count;
902 {
903 Create_json_table maker;
904
905 if (!(table= maker.start(thd, &tp,
906 sql_table->table_function, &sql_table->alias)) ||
907 maker.add_json_table_fields(thd, table, sql_table->table_function) ||
908 maker.finalize(thd, table, &tp, sql_table->table_function))
909 {
910 if (table)
911 free_tmp_table(thd, table);
912 DBUG_RETURN(NULL);
913 }
914 }
915 sql_table->schema_table_name.length= 0;
916
917 my_bitmap_map* bitmaps=
918 (my_bitmap_map*) thd->alloc(bitmap_buffer_size(field_count));
919 my_bitmap_init(&table->def_read_set, (my_bitmap_map*) bitmaps, field_count);
920 table->read_set= &table->def_read_set;
921 bitmap_clear_all(table->read_set);
922 table->alias_name_used= true;
923 table->next= thd->derived_tables;
924 thd->derived_tables= table;
925 table->s->tmp_table= INTERNAL_TMP_TABLE;
926 table->grant.privilege= SELECT_ACL;
927
928 sql_table->table= table;
929
930 DBUG_RETURN(table);
931}
932
933
934int Json_table_column::set(THD *thd, enum_type ctype, const LEX_CSTRING &path,

Callers 1

open_and_process_tableFunction · 0.85

Calls 7

free_tmp_tableFunction · 0.85
my_bitmap_initFunction · 0.85
add_json_table_fieldsMethod · 0.80
initMethod · 0.45
startMethod · 0.45
finalizeMethod · 0.45
allocMethod · 0.45

Tested by

no test coverage detected