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

Function get_schema_column_record

sql/sql_show.cc:6541–6702  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6539}
6540
6541static
6542int get_schema_column_record(THD *thd, TABLE_LIST *tables,
6543 TABLE *table, //!< @ref Show::columns_fields_info
6544 bool res,
6545 const LEX_CSTRING *db_name,
6546 const LEX_CSTRING *table_name)
6547{
6548 LEX *lex= thd->lex;
6549 const char *wild= lex->wild ? lex->wild->ptr() : NullS;
6550 CHARSET_INFO *cs= system_charset_info;
6551 TABLE *show_table;
6552 Field **ptr, *field;
6553 int count;
6554 bool quoted_defaults= lex->sql_command != SQLCOM_SHOW_FIELDS;
6555 DBUG_ENTER("get_schema_column_record");
6556
6557 show_table= tables->table;
6558 count= 0;
6559 ptr= show_table->field;
6560 show_table->use_all_columns(); // Required for default
6561 restore_record(show_table, s->default_values);
6562
6563#ifndef NO_EMBEDDED_ACCESS_CHECKS
6564 check_access(thd, SELECT_ACL, db_name->str,
6565 &tables->grant.privilege, 0, 0, MY_TEST(tables->schema_table));
6566 if (is_temporary_table(tables))
6567 {
6568 tables->grant.privilege|= TMP_TABLE_ACLS;
6569 }
6570#endif
6571
6572 for (; (field= *ptr) ; ptr++)
6573 {
6574 if(field->invisible > INVISIBLE_USER)
6575 continue;
6576 uchar *pos;
6577 char tmp[MAX_FIELD_WIDTH];
6578 String type(tmp,sizeof(tmp), system_charset_info);
6579
6580 DEBUG_SYNC(thd, "get_schema_column");
6581
6582 if (wild && wild[0] &&
6583 wild_case_compare(system_charset_info, field->field_name.str, wild))
6584 continue;
6585
6586 count++;
6587 /* Get default row, with all NULL fields set to NULL */
6588 restore_record(table, s->default_values);
6589
6590#ifndef NO_EMBEDDED_ACCESS_CHECKS
6591 ulonglong col_access=
6592 get_column_grant(thd, &tables->grant, db_name->str, table_name->str,
6593 field->field_name) & COL_ACLS;
6594
6595 if (!col_access && !tables->schema_table)
6596 continue;
6597
6598 char *end= tmp;

Callers

nothing calls this directly

Calls 15

is_temporary_tableFunction · 0.85
wild_case_compareFunction · 0.85
get_column_grantFunction · 0.85
strmovFunction · 0.85
get_field_default_valueFunction · 0.85
store_column_typeFunction · 0.85
print_on_update_clauseFunction · 0.85
append_create_optionsFunction · 0.85
use_all_columnsMethod · 0.80
set_notnullMethod · 0.80
is_storedMethod · 0.80

Tested by

no test coverage detected