summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/mysql_priv.h3
-rw-r--r--sql/sql_parse.cc3
-rw-r--r--sql/sql_show.cc33
-rw-r--r--sql/sql_yacc.yy19
4 files changed, 34 insertions, 24 deletions
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 6b4cfbed59d..d3f208aa6de 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -362,7 +362,8 @@ int mysqld_show_dbs(THD *thd,const char *wild);
int mysqld_show_open_tables(THD *thd,const char *db,const char *wild);
int mysqld_show_tables(THD *thd,const char *db,const char *wild);
int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild);
-int mysqld_show_fields(THD *thd,TABLE_LIST *table, const char *wild);
+int mysqld_show_fields(THD *thd,TABLE_LIST *table, const char *wild,
+ bool verbose);
int mysqld_show_keys(THD *thd, TABLE_LIST *table);
int mysqld_show_logs(THD *thd);
void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild);
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 1b46cc51bfc..a43b10e9ad0 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1545,7 +1545,8 @@ mysql_execute_command(void)
if (grant_option && check_grant(thd,SELECT_ACL,tables,2))
goto error;
res= mysqld_show_fields(thd,tables,
- (lex->wild ? lex->wild->ptr() : NullS));
+ (lex->wild ? lex->wild->ptr() : NullS),
+ lex->verbose);
break;
}
#endif
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 52563196a77..ecc31c4c57e 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -412,7 +412,8 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
***************************************************************************/
int
-mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild)
+mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
+ bool verbose)
{
TABLE *table;
handler *file;
@@ -437,7 +438,8 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild)
field_list.push_back(new Item_empty_string("Key",3));
field_list.push_back(new Item_empty_string("Default",NAME_LEN));
field_list.push_back(new Item_empty_string("Extra",20));
- field_list.push_back(new Item_empty_string("Privileges",80));
+ if (verbose)
+ field_list.push_back(new Item_empty_string("Privileges",80));
// Send first number of fields and records
{
@@ -502,18 +504,21 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild)
end=strmov(tmp,"auto_increment");
net_store_data(packet,tmp,(uint) (end-tmp));
- /* Add grant options */
- col_access= get_column_grant(thd,table_list,field) & COL_ACLS;
- end=tmp;
- for (uint bitnr=0; col_access ; col_access>>=1,bitnr++)
- {
- if (col_access & 1)
- {
- *end++=',';
- end=strmov(end,grant_types.type_names[bitnr]);
- }
- }
- net_store_data(packet,tmp+1,end == tmp ? 0 : (uint) (end-tmp-1));
+ if (verbose)
+ {
+ /* Add grant options */
+ col_access= get_column_grant(thd,table_list,field) & COL_ACLS;
+ end=tmp;
+ for (uint bitnr=0; col_access ; col_access>>=1,bitnr++)
+ {
+ if (col_access & 1)
+ {
+ *end++=',';
+ end=strmov(end,grant_types.type_names[bitnr]);
+ }
+ }
+ net_store_data(packet,tmp+1,end == tmp ? 0 : (uint) (end-tmp-1));
+ }
if (my_net_write(&thd->net,(char*) packet->ptr(),packet->length()))
DBUG_RETURN(1);
}
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 4c50f50b001..dd1fb916bad 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -2159,12 +2159,12 @@ show_param:
Lex->db= $3;
Lex->options=0;
}
- | COLUMNS FROM table_ident opt_db wild
+ | opt_full COLUMNS FROM table_ident opt_db wild
{
Lex->sql_command= SQLCOM_SHOW_FIELDS;
- if ($4)
- $3->change_db($4);
- if (!add_table_to_list($3,NULL,0))
+ if ($5)
+ $4->change_db($5);
+ if (!add_table_to_list($4,NULL,0))
YYABORT;
}
| MASTER_SYM LOGS_SYM
@@ -2181,10 +2181,8 @@ show_param:
}
| STATUS_SYM wild
{ Lex->sql_command= SQLCOM_SHOW_STATUS; }
- | PROCESSLIST_SYM
- { Lex->sql_command= SQLCOM_SHOW_PROCESSLIST; Lex->verbose=0; }
- | FULL PROCESSLIST_SYM
- { Lex->sql_command= SQLCOM_SHOW_PROCESSLIST; Lex->verbose=1; }
+ | opt_full PROCESSLIST_SYM
+ { Lex->sql_command= SQLCOM_SHOW_PROCESSLIST;}
| VARIABLES wild
{ Lex->sql_command= SQLCOM_SHOW_VARIABLES; }
| LOGS_SYM
@@ -2215,11 +2213,16 @@ wild:
/* empty */
| LIKE text_string { Lex->wild= $2; }
+opt_full:
+ /* empty */ { Lex->verbose=0; }
+ | FULL { Lex->verbose=1; }
+
/* A Oracle compatible synonym for show */
describe:
describe_command table_ident
{
Lex->wild=0;
+ Lex->verbose=0;
Lex->sql_command=SQLCOM_SHOW_FIELDS;
if (!add_table_to_list($2, NULL,0))
YYABORT;