mysql 客户端status状态

wKiom1ORgyaylMkrAAEDSDxdrKI100.jpg


对应的源码程序再/client/mysql.cc中

static int

com_status(String *buffer __attribute__((unused)),

  char *line __attribute__((unused)))

{

  const char *status_str;

  char buff[40];

  ulonglong id;

  MYSQL_RES *result;

  LINT_INIT(result);


  if (mysql_real_query_for_lazy(

        C_STRING_WITH_LEN("select DATABASE(), USER() limit 1")))

    return 0;


  tee_puts("--------------", stdout);

  usage(1); /* Print version */

  tee_fprintf(stdout, "\nConnection id:\t\t%lu\n",mysql_thread_id(&mysql));

  /*

    Don't remove "limit 1",

    it is protection againts SQL_SELECT_LIMIT=0

  */

  if (!mysql_store_result_for_lazy(&result))

  {

    MYSQL_ROW cur=mysql_fetch_row(result);

    if (cur)

    {

      tee_fprintf(stdout, "Current database:\t%s\n", cur[0] ? cur[0] : "");

      tee_fprintf(stdout, "Current user:\t\t%s\n", cur[1]);

    }

    mysql_free_result(result);

  }


主要就是显示为红的地方

你可能感兴趣的:(mysql,status,客户端)