Commit 9adf688b authored by vva@genie.(none)'s avatar vva@genie.(none)

add help command on server side

parent 7777d2b8
...@@ -205,8 +205,8 @@ typedef struct { ...@@ -205,8 +205,8 @@ typedef struct {
} COMMANDS; } COMMANDS;
static COMMANDS commands[] = { static COMMANDS commands[] = {
{ "help", 'h', com_help, 0, "Display this help." }, { "help", 'h', com_help, 1, "Display this help." },
{ "?", '?', com_help, 0, "Synonym for `help'." }, { "?", '?', com_help, 1, "Synonym for `help'." },
{ "clear", 'c', com_clear, 0, "Clear command."}, { "clear", 'c', com_clear, 0, "Clear command."},
{ "connect",'r', com_connect,1, { "connect",'r', com_connect,1,
"Reconnect to the server. Optional arguments are db and host." }, "Reconnect to the server. Optional arguments are db and host." },
...@@ -382,8 +382,9 @@ int main(int argc,char *argv[]) ...@@ -382,8 +382,9 @@ int main(int argc,char *argv[])
} }
} }
#endif #endif
sprintf(buff, sprintf(buff, "%s%s",
"Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n"); "Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n",
"Type 'help [[%]function name[%]]' to get help on usage of function.\n");
put_info(buff,INFO_INFO); put_info(buff,INFO_INFO);
status.exit_status=read_lines(1); // read lines and execute them status.exit_status=read_lines(1); // read lines and execute them
if (opt_outfile) if (opt_outfile)
...@@ -1322,19 +1323,141 @@ static int reconnect(void) ...@@ -1322,19 +1323,141 @@ static int reconnect(void)
The different commands The different commands
***************************************************************************/ ***************************************************************************/
int mysql_real_query_for_lazy(const char *buf, int length)
{
for (uint retry=0;; retry++)
{
if (!mysql_real_query(&mysql,buf,length))
return 0;
uint error=put_info(mysql_error(&mysql),INFO_ERROR, mysql_errno(&mysql));
if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR || retry > 1
|| status.batch)
return error;
if (reconnect())
return error;
}
}
int mysql_store_result_for_lazy(MYSQL_RES **result)
{
if ((*result=mysql_store_result(&mysql)))
return 0;
if (mysql_error(&mysql)[0])
return put_info(mysql_error(&mysql),INFO_ERROR,mysql_errno(&mysql));
return 0;
}
static int com_server_help(String *buffer __attribute__((unused)),
char *line __attribute__((unused)), char *help_arg)
{
MYSQL_ROW cur;
const char *server_cmd= buffer->ptr();
char cmd_buf[100];
if (help_arg[0]!='\'')
{
(void*)sprintf(cmd_buf,"help \'%s\';",help_arg);
server_cmd= cmd_buf;
}
char buff[16], time_buf[32];
MYSQL_RES *result;
ulong timer;
uint error= 0;
if (!status.batch)
{
old_buffer= *buffer;
old_buffer.copy();
}
if (!connected && reconnect())
return 1;
timer= start_timer();
error= mysql_real_query_for_lazy(server_cmd,strlen(server_cmd));
if (error)
return error;
error= mysql_store_result_for_lazy(&result);
if (error)
return error;
if (result)
{
int num_rows= mysql_num_rows(result);
if (num_rows==1)
{
if (!(cur= mysql_fetch_row(result)))
return -1;
init_pager();
if (cur[1][0]=='Y')
{
tee_fprintf(PAGER, "\nHelp topic \'%s\'\n", cur[0]);
tee_fprintf(PAGER, "%s\n", cur[2]);
tee_fprintf(PAGER, "For help on specific function please type 'help <function>' where function is one of next :\n%s\n", cur[3]);
}
else
{
tee_fprintf(PAGER, "\nName : \'%s\'\n\n", cur[0]);
tee_fprintf(PAGER, "Description : \n%s\n\n", cur[2]);
tee_fprintf(PAGER, "Examples : \n%s\n", cur[3]);
}
end_pager();
}
else if (num_rows>1)
{
put_info("\nMany help items for your request exist", INFO_INFO);
put_info("For more specific request please type 'help <item>' where item is one of next :", INFO_INFO);
init_pager();
char last_char= '_';
while ((cur= mysql_fetch_row(result))){
if (cur[1][0]!=last_char){
put_info("-------------------------------------------", INFO_INFO);
put_info(cur[1][0]=='Y' ?
"categories:" : "functions:", INFO_INFO);
put_info("-------------------------------------------", INFO_INFO);
}
last_char= cur[1][0];
tee_fprintf(PAGER, "%s\n", cur[0]);
}
tee_fprintf(PAGER, "\n");
end_pager();
}
else
{
put_info("\nNothing found\n", INFO_INFO);
}
}
mysql_free_result(result);
return error;
}
static int static int
com_help (String *buffer __attribute__((unused)), com_help (String *buffer __attribute__((unused)),
char *line __attribute__((unused))) char *line __attribute__((unused)))
{ {
reg1 int i; reg1 int i;
char * help_arg= strchr(line,' ');
if (help_arg)
{
return com_server_help(buffer,line,help_arg+1);
}
else
{
put_info("\nFor the complete MySQL Manual online visit:\n http://www.mysql.com/documentation\n", INFO_INFO); put_info("\nFor the complete MySQL Manual online visit:\n http://www.mysql.com/documentation\n", INFO_INFO);
put_info("For info on technical support from MySQL developers visit:\n http://www.mysql.com/support\n", INFO_INFO); put_info("For info on technical support from MySQL developers visit:\n http://www.mysql.com/support\n", INFO_INFO);
put_info("For info on MySQL books, utilities, consultants, etc. visit:\n http://www.mysql.com/portal\n", INFO_INFO); put_info("For info on MySQL books, utilities, consultants, etc. visit:\n http://www.mysql.com/portal\n", INFO_INFO);
put_info("List of all MySQL commands:", INFO_INFO); put_info("List of all MySQL commands:", INFO_INFO);
if (!named_cmds) if (!named_cmds)
put_info(" (Commands must appear first on line and end with ';')\n", put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);
INFO_INFO);
for (i = 0; commands[i].name; i++) for (i = 0; commands[i].name; i++)
{ {
if (commands[i].func) if (commands[i].func)
...@@ -1347,6 +1470,7 @@ com_help (String *buffer __attribute__((unused)), ...@@ -1347,6 +1470,7 @@ com_help (String *buffer __attribute__((unused)),
mysql_thread_id(&mysql)); mysql_thread_id(&mysql));
else else
tee_fprintf(stdout, "Not connected! Reconnect with 'connect'!\n\n"); tee_fprintf(stdout, "Not connected! Reconnect with 'connect'!\n\n");
}
return 0; return 0;
} }
...@@ -1411,23 +1535,14 @@ com_go(String *buffer,char *line __attribute__((unused))) ...@@ -1411,23 +1535,14 @@ com_go(String *buffer,char *line __attribute__((unused)))
} }
timer=start_timer(); timer=start_timer();
for (uint retry=0;; retry++)
{ error= mysql_real_query_for_lazy(buffer->ptr(),buffer->length());
if (!mysql_real_query(&mysql,buffer->ptr(),buffer->length())) if (error)
break;
error=put_info(mysql_error(&mysql),INFO_ERROR, mysql_errno(&mysql));
if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR || retry > 1
|| status.batch)
{
buffer->length(0); // Remove query on error
return error;
}
if (reconnect())
{ {
buffer->length(0); // Remove query on error buffer->length(0); // Remove query on error
return error; return error;
} }
}
error=0; error=0;
buffer->length(0); buffer->length(0);
...@@ -1440,13 +1555,9 @@ com_go(String *buffer,char *line __attribute__((unused))) ...@@ -1440,13 +1555,9 @@ com_go(String *buffer,char *line __attribute__((unused)))
} }
else else
{ {
if (!(result=mysql_store_result(&mysql))) error= mysql_store_result_for_lazy(&result);
{ if (error)
if (mysql_error(&mysql)[0]) return error;
{
return put_info(mysql_error(&mysql),INFO_ERROR,mysql_errno(&mysql));
}
}
} }
if (verbose >= 3 || !opt_silent) if (verbose >= 3 || !opt_silent)
...@@ -2772,3 +2883,5 @@ void sql_element_free(void *ptr) ...@@ -2772,3 +2883,5 @@ void sql_element_free(void *ptr)
my_free((gptr) ptr,MYF(0)); my_free((gptr) ptr,MYF(0));
} }
#endif /* EMBEDDED_LIBRARY */ #endif /* EMBEDDED_LIBRARY */
...@@ -258,4 +258,5 @@ ...@@ -258,4 +258,5 @@
#define ER_SUBSELECT_NO_1_COL 1239 #define ER_SUBSELECT_NO_1_COL 1239
#define ER_SUBSELECT_NO_1_ROW 1240 #define ER_SUBSELECT_NO_1_ROW 1240
#define ER_UNKNOWN_STMT_HANDLER 1241 #define ER_UNKNOWN_STMT_HANDLER 1241
#define ER_CORRUPT_HELP_DB 1242
#define ER_ERROR_MESSAGES 242 #define ER_ERROR_MESSAGES 242
...@@ -52,11 +52,13 @@ EXTRA_SCRIPTS = make_binary_distribution.sh \ ...@@ -52,11 +52,13 @@ EXTRA_SCRIPTS = make_binary_distribution.sh \
mysql_explain_log.sh \ mysql_explain_log.sh \
mysqld_multi.sh \ mysqld_multi.sh \
mysql_tableinfo.sh \ mysql_tableinfo.sh \
mysqld_safe.sh mysqld_safe.sh \
fill_func_tables.sh
EXTRA_DIST = $(EXTRA_SCRIPTS) \ EXTRA_DIST = $(EXTRA_SCRIPTS) \
mysqlaccess.conf \ mysqlaccess.conf \
mysqlbug mysqlbug \
fill_func_tables.sql
pkgdata_DATA = make_binary_distribution pkgdata_DATA = make_binary_distribution
...@@ -76,7 +78,8 @@ CLEANFILES = @server_scripts@ \ ...@@ -76,7 +78,8 @@ CLEANFILES = @server_scripts@ \
mysql_find_rows \ mysql_find_rows \
mysqlhotcopy \ mysqlhotcopy \
mysqldumpslow \ mysqldumpslow \
mysqld_multi mysqld_multi \
fill_func_tables.sql
SUPERCLEANFILES = mysqlbug SUPERCLEANFILES = mysqlbug
...@@ -127,3 +130,8 @@ SUFFIXES = .sh ...@@ -127,3 +130,8 @@ SUFFIXES = .sh
# Don't update the files from bitkeeper # Don't update the files from bitkeeper
%::SCCS/s.% %::SCCS/s.%
all: fill_func_tables.sql
fill_func_tables.sql: fill_func_tables ../Docs/manual.texi
./fill_func_tables < ../Docs/manual.texi > fill_func_tables.sql
\ No newline at end of file
#!@PERL@
# fill_func_tables - parse ../Docs/manual.texi
# Original version by vva
my $cat_name= "";
my $func_name= "";
my $text= "";
my $example= "";
local $mode= "";
sub prepare_name
{
my ($a)= @_;
$a =~ s/(\@itemize \@bullet)/ /g;
$a =~ s/(\@end itemize)/ /g;
$a =~ s/(\@end multitable)/ /g;
$a =~ s/(\@end table)/ /g;
$a =~ s/(\@cindex(.*?)\n)/ /g;
$a =~ s/(\@multitable \@columnfractions(.*?)\n)/ /g;
$a =~ s/(\@node(.*?)\n)/ /g;
$a =~ s/(\@tab)/\t/g;
$a =~ s/\@item/ /g;
$a =~ s/\@code\{((.|\n)+?)\}/$1/go;
$a =~ s/\@strong\{(.+?)\}/$1/go;
$a =~ s/\@samp\{(.+?)\}/$1/go;
$a =~ s/\@emph\{((.|\n)+?)\}/\/$1\//go;
$a =~ s/\@xref\{((.|\n)+?)\}/See also : [$1]/go;
$a =~ s/\@ref\{((.|\n)+?)\}/[$1]/go;
$a =~ s/\'/\'\'/g;
$a =~ s/\\/\\\\/g;
$a =~ s/\`/\`\`/g;
$a =~ s/\@table \@code/ /g;
$a =~ s/\(\)//g;
$a =~ s/((\w|\s)+)\(([\+-=><\/%*!<>\s]+)\)/$3/gxs; #$a =~ s/((\w|\s)+)\(([\+-=><\/%*!<>\s]+)\)/$3 $1/gxs;
$a =~ s/([\+-=><\/%*!<>\s]+)\(((\w|\s)+)\)/$1/gxs;#$a =~ s/([\+-=><\/%*!<>\s]+)\(((\w|\s)+)\)/$1 $2/gxs;
$a =~ s/((\w|\s)+)\((.+)\)/$1/gxs;
return $a;
}
sub prepare_text
{
my ($a)= @_;
$a =~ s/(\@itemize \@bullet)/ /g;
$a =~ s/(\@end itemize)/ /g;
$a =~ s/(\@end multitable)/ /g;
$a =~ s/(\@end table)/ /g;
$a =~ s/(\@cindex(.*?)\n)/ /g;
$a =~ s/(\@multitable \@columnfractions(.*?)\n)/ /g;
$a =~ s/(\@node(.*?)\n)/ /g;
$a =~ s/(\@tab)/\t/g;
$a =~ s/\@itemx/ /g;
$a =~ s/\@item/ /g;
$a =~ s/\@code\{((.|\n)+?)\}/$1/go;
$a =~ s/\@strong\{(.+?)\}/$1/go;
$a =~ s/\@samp\{(.+?)\}/$1/go;
$a =~ s/\@emph\{((.|\n)+?)\}/\/$1\//go;
$a =~ s/\@xref\{((.|\n)+?)\}/See also : [$1]/go;
$a =~ s/\@ref\{((.|\n)+?)\}/[$1]/go;
$a =~ s/\'/\'\'/g;
$a =~ s/\\/\\\\/g;
$a =~ s/\`/\`\`/g;
$a =~ s/(\n*?)$//g;
$a =~ s/\n/\\n/g;
$a =~ s/\@table \@code/ /g;
return $a;
}
sub prepare_example
{
my ($a)= @_;
$a =~ s/\'/\'\'/g;
$a =~ s/\\/\\\\/g;
$a =~ s/\`/\`\`/g;
$a =~ s/(\n*?)$//g;
$a =~ s/\n/\\n/g;
return $a;
}
sub flush_all
{
my ($mode) = @_;
if ($mode eq ""){return;}
$func_name= prepare_name($func_name);
$text= prepare_text($text);
$example= prepare_example($example);
if ($func_name ne "" && $text ne "" && !($func_name =~ /[abcdefghikjlmnopqrstuvwxyz]/)){
print "INSERT INTO function (name,description,example) VALUES (";
print "'$func_name',";
print "'$text',";
print "'$example'";
print ");\n";
print "INSERT INTO function_category (cat_id,func_id) VALUES (\@cur_category,LAST_INSERT_ID());\n";
}
$func_name= "";
$text= "";
$example= "";
$mode= "";
}
sub new_category
{
my ($category)= @_;
$category= prepare_text($category);
print "INSERT INTO function_category_name (name) VALUES (\'$category\');\n";
print "SELECT \@cur_category:=LAST_INSERT_ID();\n";
}
print "INSERT INTO db (Host,DB,User,Select_priv) VALUES ('%','mysql_help','','Y');\n";
print "CREATE DATABASE mysql_help;\n";
print "USE mysql_help;\n";
print "DROP TABLE IF EXISTS function;\n";
print "CREATE TABLE function (";
print " func_id int unsigned not null auto_increment,";
print " name varchar(64) not null,";
print " url varchar(128) not null,";
print " description text not null,";
print " example text not null,";
print " min_args tinyint not null,";
print " max_args tinyint,";
print " date_created datetime not null,";
print " last_modified timestamp not null,";
print " primary key (func_id)";
print ") type=myisam;\n\n";
print "DROP TABLE IF EXISTS function_category_name;\n";
print "CREATE TABLE function_category_name (";
print " cat_id smallint unsigned not null auto_increment,";
print " name varchar(64) not null,";
print " url varchar(128) not null,";
print " date_created datetime not null,";
print " last_modified timestamp not null,";
print " primary key (cat_id)";
print ") type=myisam;\n\n";
print "DROP TABLE IF EXISTS function_category;\n";
print "CREATE TABLE function_category (";
print " cat_id smallint unsigned not null references function_category_name,";
print " func_id int unsigned not null references function,";
print " primary key (cat_id, func_id)";
print ") type=myisam;\n\n";
print "DELETE FROM function_category_name;\n";
print "DELETE FROM function_category;\n";
print "DELETE FROM function;\n";
print "SELECT \@cur_category:=null;\n\n";
my $in_section_6_3= 0;
for(<>)
{
if ($_=~/\@section Functions for Use in \@code{SELECT} and \@code{WHERE} Clauses/ &&
!$in_section_6_3){
$in_section_6_3= 1;
next;
}
if ($_=~/\@section/ && $in_section_6_3){
$in_section_6_3= 0;
next;
}
if (!$in_section_6_3) { next; }
my $c_name= "";
($c_name)=m|\@c for_mysql_help,(.+?)$|;
if (!($c_name eq "") && ! ($c_name =~ m/$cat_name/i)){
($cat_name)= $c_name;
new_category($cat_name);
next;
}
($c_name)=m|\@subsubsection (.+?)$|;
if (!($c_name eq "") && ! ($c_name =~ m/$cat_name/i)){
($cat_name)= $c_name;
new_category($cat_name);
next;
}
($c_name)=m|\@subsection (.+?)$|;
if (!($c_name eq "") && ! ($c_name =~ m/$cat_name/i)){
($cat_name)= $c_name;
new_category($cat_name);
next;
}
($f_name)=m|\@findex (.+?)$|;
if (!($f_name eq "")){
flush_all($mode);
($func_name)= ($f_name);
$mode= "text";
next;
}
if ($_=~/\@example/ && ($mode eq "text")){
$mode= "example";
next;
}
if ($_=~/\@end example/ && ($mode eq "example")){
flush_all($mode);
next;
}
if ($mode eq "text") { $text .= $_; }
if ($mode eq "example") { $example .= $_; }
}
print "DELETE function_category_name ";
print "FROM function_category_name ";
print "LEFT JOIN function_category ON function_category.cat_id=function_category_name.cat_id ";
print "WHERE function_category.cat_id is null;"
...@@ -307,8 +307,8 @@ then ...@@ -307,8 +307,8 @@ then
fi fi
echo "Installing all prepared tables" echo "Installing all prepared tables"
if eval "$execdir/mysqld $defaults --bootstrap --skip-grant-tables \ if (
--basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb $args" << END_OF_DATA cat << END_OF_DATA
use mysql; use mysql;
$c_d $c_d
$i_d $i_d
...@@ -325,6 +325,9 @@ $i_f ...@@ -325,6 +325,9 @@ $i_f
$c_t $c_t
$c_c $c_c
END_OF_DATA END_OF_DATA
cat fill_func_tables.sql
) | eval "$execdir/mysqld $defaults --bootstrap --skip-grant-tables \
--basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb $args"
then then
echo "" echo ""
if test "$IN_RPM" -eq 0 if test "$IN_RPM" -eq 0
......
...@@ -84,7 +84,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \ ...@@ -84,7 +84,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
slave.cc sql_repl.cc sql_union.cc sql_derived.cc \ slave.cc sql_repl.cc sql_union.cc sql_derived.cc \
mini_client.cc mini_client_errors.c \ mini_client.cc mini_client_errors.c \
stacktrace.c repl_failsafe.h repl_failsafe.cc sql_olap.cc\ stacktrace.c repl_failsafe.h repl_failsafe.cc sql_olap.cc\
gstream.cc spatial.cc gstream.cc spatial.cc sql_help.cc
gen_lex_hash_SOURCES = gen_lex_hash.cc gen_lex_hash_SOURCES = gen_lex_hash.cc
gen_lex_hash_LDADD = $(LDADD) $(CXXLDFLAGS) gen_lex_hash_LDADD = $(LDADD) $(CXXLDFLAGS)
......
...@@ -172,6 +172,7 @@ static SYMBOL symbols[] = { ...@@ -172,6 +172,7 @@ static SYMBOL symbols[] = {
{ "HANDLER", SYM(HANDLER_SYM),0,0}, { "HANDLER", SYM(HANDLER_SYM),0,0},
{ "HASH", SYM(HASH_SYM),0,0}, { "HASH", SYM(HASH_SYM),0,0},
{ "HEAP", SYM(HEAP_SYM),0,0}, { "HEAP", SYM(HEAP_SYM),0,0},
{ "HELP", SYM(HELP),0,0},
{ "HIGH_PRIORITY", SYM(HIGH_PRIORITY),0,0}, { "HIGH_PRIORITY", SYM(HIGH_PRIORITY),0,0},
{ "HOUR", SYM(HOUR_SYM),0,0}, { "HOUR", SYM(HOUR_SYM),0,0},
{ "HOUR_MINUTE", SYM(HOUR_MINUTE_SYM),0,0}, { "HOUR_MINUTE", SYM(HOUR_MINUTE_SYM),0,0},
......
...@@ -505,6 +505,7 @@ int mysqld_show_charsets(THD *thd,const char *wild); ...@@ -505,6 +505,7 @@ int mysqld_show_charsets(THD *thd,const char *wild);
int mysqld_show_table_types(THD *thd); int mysqld_show_table_types(THD *thd);
int mysqld_show_privileges(THD *thd); int mysqld_show_privileges(THD *thd);
int mysqld_show_column_types(THD *thd); int mysqld_show_column_types(THD *thd);
int mysqld_help (THD *thd, const char *text);
/* sql_prepare.cc */ /* sql_prepare.cc */
int compare_prep_stmt(PREP_STMT *a, PREP_STMT *b, void *not_used); int compare_prep_stmt(PREP_STMT *a, PREP_STMT *b, void *not_used);
......
...@@ -252,3 +252,4 @@ ...@@ -252,3 +252,4 @@
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Corrupt or doesn\'t exist help database",
...@@ -246,3 +246,4 @@ ...@@ -246,3 +246,4 @@
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Corrupt or doesn\'t exist help database",
...@@ -254,3 +254,4 @@ ...@@ -254,3 +254,4 @@
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Corrupt or doesn\'t exist help database",
...@@ -243,3 +243,4 @@ ...@@ -243,3 +243,4 @@
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Corrupt or doesn\'t exist help database",
...@@ -248,3 +248,4 @@ ...@@ -248,3 +248,4 @@
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Corrupt or doesn\'t exist help database",
...@@ -243,3 +243,4 @@ ...@@ -243,3 +243,4 @@
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Corrupt or doesn\'t exist help database",
...@@ -246,3 +246,4 @@ ...@@ -246,3 +246,4 @@
"Subselect return more than 1 field", "Subselect return more than 1 field",
"Subselect return more than 1 record", "Subselect return more than 1 record",
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Corrupt or doesn\'t exist help database",
...@@ -243,3 +243,4 @@ ...@@ -243,3 +243,4 @@
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Corrupt or doesn\'t exist help database",
...@@ -245,3 +245,4 @@ ...@@ -245,3 +245,4 @@
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Corrupt or doesn\'t exist help database",
...@@ -243,3 +243,4 @@ ...@@ -243,3 +243,4 @@
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Corrupt or doesn\'t exist help database",
...@@ -245,3 +245,4 @@ ...@@ -245,3 +245,4 @@
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Corrupt or doesn\'t exist help database",
...@@ -243,3 +243,4 @@ ...@@ -243,3 +243,4 @@
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Corrupt or doesn\'t exist help database",
...@@ -245,3 +245,4 @@ ...@@ -245,3 +245,4 @@
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Corrupt or doesn\'t exist help database",
...@@ -245,3 +245,4 @@ ...@@ -245,3 +245,4 @@
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Corrupt or doesn\'t exist help database",
...@@ -247,3 +247,4 @@ ...@@ -247,3 +247,4 @@
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Corrupt or doesn\'t exist help database",
...@@ -243,3 +243,4 @@ ...@@ -243,3 +243,4 @@
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Corrupt or doesn\'t exist help database",
...@@ -247,3 +247,4 @@ ...@@ -247,3 +247,4 @@
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Corrupt or doesn\'t exist help database",
...@@ -246,3 +246,4 @@ ...@@ -246,3 +246,4 @@
" ", " ",
" ", " ",
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Corrupt or doesn\'t exist help database",
...@@ -239,3 +239,4 @@ ...@@ -239,3 +239,4 @@
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Corrupt or doesn\'t exist help database",
...@@ -251,3 +251,4 @@ ...@@ -251,3 +251,4 @@
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Corrupt or doesn\'t exist help database",
...@@ -244,3 +244,4 @@ ...@@ -244,3 +244,4 @@
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Corrupt or doesn\'t exist help database",
...@@ -243,3 +243,4 @@ ...@@ -243,3 +243,4 @@
"Subselect returns more than 1 field", "Subselect returns more than 1 field",
"Subselect returns more than 1 record", "Subselect returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Corrupt or doesn\'t exist help database",
...@@ -248,3 +248,4 @@ ...@@ -248,3 +248,4 @@
"i i i 1 ", "i i i 1 ",
"i i i 1 ", "i i i 1 ",
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Corrupt or doesn\'t exist help database",
This diff is collapsed.
...@@ -66,7 +66,7 @@ enum enum_sql_command { ...@@ -66,7 +66,7 @@ enum enum_sql_command {
SQLCOM_SHOW_BINLOG_EVENTS, SQLCOM_SHOW_NEW_MASTER, SQLCOM_DO, SQLCOM_SHOW_BINLOG_EVENTS, SQLCOM_SHOW_NEW_MASTER, SQLCOM_DO,
SQLCOM_SHOW_WARNS, SQLCOM_EMPTY_QUERY, SQLCOM_SHOW_ERRORS, SQLCOM_SHOW_WARNS, SQLCOM_EMPTY_QUERY, SQLCOM_SHOW_ERRORS,
SQLCOM_SHOW_COLUMN_TYPES, SQLCOM_SHOW_TABLE_TYPES, SQLCOM_SHOW_PRIVILEGES, SQLCOM_SHOW_COLUMN_TYPES, SQLCOM_SHOW_TABLE_TYPES, SQLCOM_SHOW_PRIVILEGES,
SQLCOM_END SQLCOM_END, SQLCOM_HELP,
}; };
enum lex_states enum lex_states
...@@ -383,6 +383,7 @@ typedef struct st_lex ...@@ -383,6 +383,7 @@ typedef struct st_lex
bool derived_tables, describe; bool derived_tables, describe;
uint slave_thd_opt; uint slave_thd_opt;
CHARSET_INFO *charset; CHARSET_INFO *charset;
char *help_arg;
} LEX; } LEX;
......
...@@ -1486,6 +1486,10 @@ mysql_execute_command(THD *thd) ...@@ -1486,6 +1486,10 @@ mysql_execute_command(THD *thd)
send_ok(thd); send_ok(thd);
break; break;
case SQLCOM_HELP:
res= mysqld_help(thd,lex->help_arg);
break;
case SQLCOM_PURGE: case SQLCOM_PURGE:
{ {
if (check_global_access(thd, SUPER_ACL)) if (check_global_access(thd, SUPER_ACL))
......
...@@ -505,6 +505,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -505,6 +505,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token SUBJECT_SYM %token SUBJECT_SYM
%token CIPHER_SYM %token CIPHER_SYM
%token HELP
%left SET_VAR %left SET_VAR
%left OR_OR_CONCAT OR %left OR_OR_CONCAT OR
%left AND %left AND
...@@ -637,7 +639,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -637,7 +639,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
handler_rkey_function handler_read_or_scan handler_rkey_function handler_read_or_scan
single_multi table_wild_list table_wild_one opt_wild union union_list single_multi table_wild_list table_wild_one opt_wild union union_list
precision union_option opt_on_delete_item subselect_start opt_and precision union_option opt_on_delete_item subselect_start opt_and
subselect_end select_var_list select_var_list_init subselect_end select_var_list select_var_list_init help
END_OF_INPUT END_OF_INPUT
%type <NONE> %type <NONE>
...@@ -699,7 +701,18 @@ verb_clause: ...@@ -699,7 +701,18 @@ verb_clause:
| handler | handler
| unlock | unlock
| update | update
| use; | use
| help;
/* help */
help:
HELP TEXT_STRING
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_HELP;
lex->help_arg= $2.str;
}
/* change master */ /* change master */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment