bool

mysqld_show_create(THD *thd, TABLE_LIST *table_list)

{

  Protocol *protocol= thd->protocol;

  char buff[2048];

  String buffer(buff, sizeof(buff), system_charset_info);

  DBUG_ENTER("mysqld_show_create");

  DBUG_PRINT("enter",("db: %s  table: %s",table_list->db,

                      table_list->table_name));


  /* We want to preserve the tree for views. */

  thd->lex->view_prepare_mode= TRUE;


  {

    Show_create_error_handler view_error_suppressor(thd, table_list);

    thd->push_internal_handler(&view_error_suppressor);

    bool error= open_normal_and_derived_tables(thd, table_list, 0);

    thd->pop_internal_handler();

    if (error && (thd->killed || thd->is_error()))

      DBUG_RETURN(TRUE);

  }


  /* TODO: add environment variables show when it become possible */

  if (thd->lex->only_view && !table_list->view)

  {

    my_error(ER_WRONG_OBJECT, MYF(0),

             table_list->db, table_list->table_name, "VIEW");

    DBUG_RETURN(TRUE);

  }

视图和表展示的区别