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

Function get_schema_views_record

sql/sql_show.cc:7574–7615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7572
7573
7574static int get_schema_views_record(THD *thd, TABLE_LIST *tables,
7575 TABLE *table, bool res,
7576 const LEX_CSTRING *db_name,
7577 const LEX_CSTRING *table_name)
7578{
7579 CHARSET_INFO *cs= system_charset_info;
7580 char definer[USER_HOST_BUFF_SIZE];
7581 uint definer_len;
7582 bool updatable_view;
7583 DBUG_ENTER("get_schema_views_record");
7584
7585 if (tables->view)
7586 {
7587 Security_context *sctx= thd->security_ctx;
7588 if (!tables->allowed_show)
7589 {
7590 if (my_charset_bin.streq(tables->definer.user,
7591 Lex_cstring_strlen(sctx->priv_user)) &&
7592 Lex_ident_host(tables->definer.host).
7593 streq(Lex_cstring_strlen(sctx->priv_host)))
7594 tables->allowed_show= TRUE;
7595#ifndef NO_EMBEDDED_ACCESS_CHECKS
7596 else
7597 {
7598 if ((thd->col_access & (SHOW_VIEW_ACL|SELECT_ACL)) ==
7599 (SHOW_VIEW_ACL|SELECT_ACL))
7600 tables->allowed_show= TRUE;
7601 else
7602 {
7603 TABLE_LIST table_list;
7604 table_list.reset();
7605 table_list.db= tables->db;
7606 table_list.table_name= tables->table_name;
7607 table_list.grant.privilege= thd->col_access;
7608 privilege_t view_access(get_table_grant(thd, &table_list));
7609 if ((view_access & (SHOW_VIEW_ACL|SELECT_ACL)) ==
7610 (SHOW_VIEW_ACL|SELECT_ACL))
7611 tables->allowed_show= TRUE;
7612 }
7613 }
7614#endif
7615 }
7616 restore_record(table, s->default_values);
7617 table->field[0]->store(STRING_WITH_LEN("def"), cs);
7618 table->field[1]->store(db_name->str, db_name->length, cs);

Callers

nothing calls this directly

Calls 6

Lex_cstring_strlenClass · 0.85
Lex_ident_hostClass · 0.85
get_table_grantFunction · 0.85
ifFunction · 0.70
streqMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected