summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <brian@grrr.local>2005-11-10 19:43:17 +0200
committerunknown <brian@grrr.local>2005-11-10 19:43:17 +0200
commitc15954467e12eed5355f0dd628e59885040557e4 (patch)
tree781d2961359b06170c7bb7f8b43fc3749a1bcb1e
parentbffefbf8b4a95b209bc069ffdbfc84d41b0acede (diff)
downloadmariadb-git-c15954467e12eed5355f0dd628e59885040557e4.tar.gz
Added "SHOW AUTHORS" code
mysql-test/r/show_check.result: Update to results mysql-test/t/show_check.test: Added SHOW AUTHORS test sql/field.h: Fixed portability issue sql/lex.h: Added new keyword "AUTHORS" sql/mysql_priv.h: Added reference to new show command. sql/sql_cache.h: Fixed compile bug (more of these need to be fixed) sql/sql_lex.h: Added to com bit. sql/sql_parse.cc: Parsing for show authors sql/sql_show.cc: Added new show command for "SHOW AUTHORS" sql/sql_yacc.yy: Added new parse code for show authors.
-rw-r--r--mysql-test/r/show_check.result4
-rw-r--r--mysql-test/t/show_check.test4
-rw-r--r--sql/authors.h18
-rw-r--r--sql/field.h4
-rw-r--r--sql/lex.h1
-rw-r--r--sql/mysql_priv.h1
-rw-r--r--sql/sql_cache.h2
-rw-r--r--sql/sql_lex.h1
-rw-r--r--sql/sql_parse.cc3
-rw-r--r--sql/sql_show.cc33
-rw-r--r--sql/sql_yacc.yy7
11 files changed, 76 insertions, 2 deletions
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 98be82fbf38..572465072e5 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -564,3 +564,7 @@ DROP TABLE tyt2;
DROP TABLE urkunde;
SHOW TABLES FROM non_existing_database;
ERROR 42000: Unknown database 'non_existing_database'
+SHOW AUTHORS;
+Name Location Comment
+Brian "Krow" Aker Seattle, WA. USA Architecture, archive, federated, buncha of little stuff :)
+David Axmark Uppsala, Sweden Small stuff long time ago, Monty ripped it out!
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index 1b6a1158dac..f06dc60af9e 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -424,3 +424,7 @@ DROP TABLE urkunde;
#
--error 1049
SHOW TABLES FROM non_existing_database;
+
+# End of 4.1 tests
+#
+SHOW AUTHORS;
diff --git a/sql/authors.h b/sql/authors.h
new file mode 100644
index 00000000000..20cfeabfd80
--- /dev/null
+++ b/sql/authors.h
@@ -0,0 +1,18 @@
+/***************************************************************************
+** Output from "SHOW AUTHORS"
+** If you can update it, you get to be in it :)
+** Dont be offended if your name is not in here, just add it!
+***************************************************************************/
+
+struct show_table_authors_st {
+ const char *name;
+ const char *location;
+ const char *comment;
+};
+
+struct show_table_authors_st show_table_authors[]= {
+ { "Brian \"Krow\" Aker", "Seattle, WA. USA",
+ "Architecture, archive, federated, buncha of little stuff :)" },
+ { "David Axmark", "Uppsala, Sweden", "Small stuff long time ago, Monty ripped it out!"},
+ {NULL, NULL, NULL}
+};
diff --git a/sql/field.h b/sql/field.h
index 77d00b671f6..7446875d864 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1081,7 +1081,7 @@ public:
int cmp_max(const char *, const char *, uint max_length);
int cmp(const char *a,const char*b)
{
- return cmp_max(a, b, ~0);
+ return cmp_max(a, b, ~0L);
}
void sort_string(char *buff,uint length);
void get_key_image(char *buff,uint length, imagetype type);
@@ -1141,7 +1141,7 @@ public:
my_decimal *val_decimal(my_decimal *);
int cmp_max(const char *, const char *, uint max_length);
int cmp(const char *a,const char*b)
- { return cmp_max(a, b, ~0); }
+ { return cmp_max(a, b, ~0L); }
int cmp(const char *a, uint32 a_length, const char *b, uint32 b_length);
int cmp_binary(const char *a,const char *b, uint32 max_length=~0L);
int key_cmp(const byte *,const byte*);
diff --git a/sql/lex.h b/sql/lex.h
index cfafd98fe20..ba290e9b646 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -74,6 +74,7 @@ static SYMBOL symbols[] = {
{ "ASC", SYM(ASC)},
{ "ASCII", SYM(ASCII_SYM)},
{ "ASENSITIVE", SYM(ASENSITIVE_SYM)},
+ { "AUTHORS", SYM(AUTHORS_SYM)},
{ "AUTO_INCREMENT", SYM(AUTO_INC)},
{ "AVG", SYM(AVG_SYM)},
{ "AVG_ROW_LENGTH", SYM(AVG_ROW_LENGTH)},
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 90c4f52e51d..d9af379fa97 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -857,6 +857,7 @@ int mysqld_show_variables(THD *thd,const char *wild);
int mysql_find_files(THD *thd,List<char> *files, const char *db,
const char *path, const char *wild, bool dir);
bool mysqld_show_storage_engines(THD *thd);
+bool mysqld_show_authors(THD *thd);
bool mysqld_show_privileges(THD *thd);
bool mysqld_show_column_types(THD *thd);
bool mysqld_help (THD *thd, const char *text);
diff --git a/sql/sql_cache.h b/sql/sql_cache.h
index 123d16b606d..880bf74e67f 100644
--- a/sql/sql_cache.h
+++ b/sql/sql_cache.h
@@ -215,6 +215,8 @@ struct Query_cache_memory_bin
struct Query_cache_memory_bin_step
{
+public:
+ Query_cache_memory_bin_step() {}
ulong size;
ulong increment;
uint idx;
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index b82ac754e26..feb3f2a30c9 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -92,6 +92,7 @@ enum enum_sql_command {
SQLCOM_XA_START, SQLCOM_XA_END, SQLCOM_XA_PREPARE,
SQLCOM_XA_COMMIT, SQLCOM_XA_ROLLBACK, SQLCOM_XA_RECOVER,
SQLCOM_INSTALL_PLUGIN, SQLCOM_UNINSTALL_PLUGIN,
+ SQLCOM_SHOW_AUTHORS,
/* This should be the last !!! */
SQLCOM_END
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 9b3b7ffad69..f401d30d9c4 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -3409,6 +3409,9 @@ end_with_restore_list:
case SQLCOM_SHOW_STORAGE_ENGINES:
res= mysqld_show_storage_engines(thd);
break;
+ case SQLCOM_SHOW_AUTHORS:
+ res= mysqld_show_authors(thd);
+ break;
case SQLCOM_SHOW_PRIVILEGES:
res= mysqld_show_privileges(thd);
break;
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 2548e77449b..d936778eaa4 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -23,6 +23,7 @@
#include "sp.h"
#include "sp_head.h"
#include "sql_trigger.h"
+#include "authors.h"
#include <my_dir.h>
@@ -83,6 +84,38 @@ bool mysqld_show_storage_engines(THD *thd)
DBUG_RETURN(FALSE);
}
+/***************************************************************************
+** List all Authors.
+** If you can update it, you get to be in it :)
+***************************************************************************/
+
+bool mysqld_show_authors(THD *thd)
+{
+ List<Item> field_list;
+ Protocol *protocol= thd->protocol;
+ DBUG_ENTER("mysqld_show_authors");
+
+ field_list.push_back(new Item_empty_string("Name",40));
+ field_list.push_back(new Item_empty_string("Location",40));
+ field_list.push_back(new Item_empty_string("Comment",80));
+
+ if (protocol->send_fields(&field_list,
+ Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
+ DBUG_RETURN(TRUE);
+
+ show_table_authors_st *authors;
+ for (authors= show_table_authors; authors->name; authors++)
+ {
+ protocol->prepare_for_resend();
+ protocol->store(authors->name, system_charset_info);
+ protocol->store(authors->location, system_charset_info);
+ protocol->store(authors->comment, system_charset_info);
+ if (protocol->write())
+ DBUG_RETURN(TRUE);
+ }
+ send_eof(thd);
+ DBUG_RETURN(FALSE);
+}
/***************************************************************************
List all privileges supported
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 7d670d8988c..953e479560e 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -137,6 +137,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token ASCII_SYM
%token ASENSITIVE_SYM
%token ATAN
+%token AUTHORS_SYM
%token AUTO_INC
%token AVG_ROW_LENGTH
%token AVG_SYM
@@ -7174,6 +7175,11 @@ show_param:
LEX *lex=Lex;
lex->sql_command= SQLCOM_SHOW_STORAGE_ENGINES;
}
+ | AUTHORS_SYM
+ {
+ LEX *lex=Lex;
+ lex->sql_command= SQLCOM_SHOW_AUTHORS;
+ }
| PRIVILEGES
{
LEX *lex=Lex;
@@ -8171,6 +8177,7 @@ user:
keyword:
keyword_sp {}
| ASCII_SYM {}
+ | AUTHORS_SYM {}
| BACKUP_SYM {}
| BEGIN_SYM {}
| BYTE_SYM {}