From Slide 9
diff mysql-5.1.11-beta/sql/lex.h mysql-5.1.11-beta-usergroup/sql/lex.h
79a80
> { "USERGROUPS", SYM(USERGROUPS_SYM)},
diff mysql-5.1.11-beta/sql/sql_yacc.yy mysql-5.1.11-beta-usergroup/sql/sql_yacc.yy
676a677
> %token USERGROUPS_SYM
8196a8198,8202
> | USERGROUPS_SYM
> {
> LEX *lex=Lex;
> lex->sql_command= SQLCOM_SHOW_USERGROUPS;
> }
9327a9334
> | USERGROUPS_SYM {}
diff mysql-5.1.11-beta/sql/sql_lex.h mysql-5.1.11-beta-usergroup/sql/sql_lex.h
112a113
> SQLCOM_SHOW_USERGROUPS,
diff mysql-5.1.11-beta/sql/sql_parse.cc mysql-5.1.11-beta-usergroup/sql/sql_parse.cc
3533a3535,3537
> case SQLCOM_SHOW_USERGROUPS:
> res= mysqld_show_usergroups(thd);
> break;
diff mysql-5.1.11-beta/sql/mysql_priv.h mysql-5.1.11-beta-usergroup/sql/mysql_priv.h
1001a1002
> bool mysqld_show_usergroups(THD *thd);
diff mysql-5.1.11-beta/sql/sql_show.cc mysql-5.1.11-beta-usergroup/sql/sql_show.cc
27a28
> #include "usergroups.h"
231a233,260
> bool mysqld_show_usergroups(THD *thd)
> {
> List- field_list;
> Protocol *protocol= thd->protocol;
> DBUG_ENTER("mysqld_show_usergroups");
>
> 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("Website",80));
>
> if (protocol->send_fields(&field_list,
> Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
> DBUG_RETURN(TRUE);
>
> show_table_usergroups_st *usergroups;
> for (usergroups= show_table_usergroups; usergroups->name; usergroups++)
> {
> protocol->prepare_for_resend();
> protocol->store(usergroups->name, system_charset_info);
> protocol->store(usergroups->location, system_charset_info);
> protocol->store(usergroups->website, system_charset_info);
> if (protocol->write())
> DBUG_RETURN(TRUE);
> }
> send_eof(thd);
> DBUG_RETURN(FALSE);
> }
>
diff mysql-5.1.11-beta/sql/authors.h mysql-5.1.11-beta-usergroup/sql/authors.h
146a147,148
> { "Brisbane Users Group", "Brisbane, QLD Australia",
> "New Command SHOW USERGROUPS" },
mysql-5.1.11-beta-usergroup/sql/usergroups.h
/* Copyright (C) 2005 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Structure of the name list */
struct show_table_usergroups_st {
const char *name;
const char *location;
const char *website;
};
struct show_table_usergroups_st show_table_usergroups[]= {
{ "Brisbane Users Group", "Brisbane, QLD Australia", "http://mysql.meetup.com/84/" },
{ "Boston Users Group", "Boston, USA", "" },
{NULL, NULL, NULL}
};