List:Internals« Previous MessageNext Message »
From:antony Date:May 17 2005 8:18am
Subject:bk commit into 5.0 tree (acurtis:1.1948)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of antony. When antony does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1948 05/05/17 09:17:51 acurtis@stripped +7 -0
  style fix for commit

  sql/sql_yacc.yy
    1.373 05/05/17 09:17:10 acurtis@stripped +4 -4
    style fix

  sql/sql_parse.cc
    1.452 05/05/17 09:17:09 acurtis@stripped +16 -9
    style fix

  sql/sql_acl.cc
    1.152 05/05/17 09:17:08 acurtis@stripped +18 -11
    style fix

  sql/sp_head.cc
    1.135 05/05/17 09:17:07 acurtis@stripped +2 -1
    style fix

  scripts/mysql_fix_privilege_tables.sql
    1.27 05/05/17 09:17:07 acurtis@stripped +2 -2
    Change enum

  scripts/mysql_create_system_tables.sh
    1.24 05/05/17 09:17:07 acurtis@stripped +1 -1
    Change enum

  mysql-test/r/system_mysql_db.result
    1.23 05/05/17 09:17:06 acurtis@stripped +1 -1
    Fix results - change to enum

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	acurtis
# Host:	ltantony.xiphis.org
# Root:	/usr/home/antony/work2/p1-bug10246

--- 1.151/sql/sql_acl.cc	2005-05-15 23:21:16 +01:00
+++ 1.152/sql/sql_acl.cc	2005-05-17 09:17:08 +01:00
@@ -2501,8 +2501,10 @@
   table->field[0]->store(combo.host.str,combo.host.length, &my_charset_latin1);
   table->field[1]->store(db,(uint) strlen(db), &my_charset_latin1);
   table->field[2]->store(combo.user.str,combo.user.length, &my_charset_latin1);
-  table->field[3]->store(routine_name,(uint) strlen(routine_name), &my_charset_latin1);
-  table->field[4]->store(is_proc ? 1LL : 2LL);
+  table->field[3]->store(routine_name,(uint) strlen(routine_name),
+                         &my_charset_latin1);
+  table->field[4]->store((longlong)(is_proc ? 
+                         TYPE_ENUM_PROCEDURE : TYPE_ENUM_FUNCTION));
   store_record(table,record[1]);			// store at pos 1
 
   if (table->file->index_read_idx(table->record[0],0,
@@ -3233,15 +3235,17 @@
 	  continue;
 	}
       }
-      switch (proc_type= p_table->field[4]->val_int())
+      if (p_table->field[4]->val_int() == TYPE_ENUM_PROCEDURE)
       {
-      case 1LL:
         hash= &proc_priv_hash;
-        break;
-      case 2LL:
+      }
+      else
+      if (p_table->field[4]->val_int() == TYPE_ENUM_FUNCTION)
+      {
         hash= &func_priv_hash;
-        break;
-      default:
+      }
+      else
+      {
         sql_print_warning("'procs_priv' entry '%s' "
                           "ignored, bad routine type",
                           mem_check->tname);
@@ -5203,7 +5207,8 @@
     < 0         Error. Error message not yet sent.
 */
 
-bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name, bool is_proc)
+bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name,
+                          bool is_proc)
 {
   uint counter, revoked;
   int result;
@@ -5232,7 +5237,8 @@
 	lex_user.host.str= grant_proc->host.hostname;
 	lex_user.host.length= strlen(grant_proc->host.hostname);
 	if (!replace_routine_table(thd,grant_proc,tables[4].table,lex_user,
-				   grant_proc->db, grant_proc->tname, is_proc, ~0, 1))
+				   grant_proc->db, grant_proc->tname,
+                                   is_proc, ~0, 1))
 	{
 	  revoked= 1;
 	  continue;
@@ -5268,7 +5274,8 @@
     < 0         Error. Error message not yet sent.
 */
 
-bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name, bool is_proc)
+bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name,
+                         bool is_proc)
 {
   LEX_USER *combo;
   TABLE_LIST tables[1];

--- 1.451/sql/sql_parse.cc	2005-05-15 23:21:16 +01:00
+++ 1.452/sql/sql_parse.cc	2005-05-17 09:17:09 +01:00
@@ -3669,15 +3669,18 @@
     }
     if (first_table)
     {
-      if (lex->type != 0)
+      if (lex->type == TYPE_ENUM_PROCEDURE ||
+          lex->type == TYPE_ENUM_FUNCTION)
       {
         uint grants= lex->all_privileges 
 		   ? (PROC_ACLS & ~GRANT_ACL) | (lex->grant & GRANT_ACL)
 		   : lex->grant;
         if (grant_option && 
-	    check_grant_routine(thd, grants | GRANT_ACL, all_tables, lex->type == 1, 0))
+	    check_grant_routine(thd, grants | GRANT_ACL, all_tables,
+                                lex->type == TYPE_ENUM_PROCEDURE, 0))
 	  goto error;
-        res= mysql_routine_grant(thd, all_tables, lex->type == 1, 
+        res= mysql_routine_grant(thd, all_tables,
+                                 lex->type == TYPE_ENUM_PROCEDURE, 
                                  lex->users_list, grants,
                                  lex->sql_command == SQLCOM_REVOKE, 0);
       }
@@ -3984,10 +3987,12 @@
       /* only add privileges if really neccessary */
       if (sp_automatic_privileges &&
           check_routine_access(thd, DEFAULT_CREATE_PROC_ACLS,
-      			       db, name, lex->sql_command == SQLCOM_CREATE_PROCEDURE, 1))
+      			       db, name,
+                               lex->sql_command == SQLCOM_CREATE_PROCEDURE, 1))
       {
         close_thread_tables(thd);
-        if (sp_grant_privileges(thd, db, name, lex->sql_command == SQLCOM_CREATE_PROCEDURE))
+        if (sp_grant_privileges(thd, db, name, 
+                                lex->sql_command == SQLCOM_CREATE_PROCEDURE))
           push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 
 	  	       ER_PROC_AUTO_GRANT_FAIL,
 		       ER(ER_PROC_AUTO_GRANT_FAIL));
@@ -4073,7 +4078,7 @@
 
 #ifndef NO_EMBEDDED_ACCESS_CHECKS
 	if (check_routine_access(thd, EXECUTE_ACL, 
-				 sp->m_db.str, sp->m_name.str, 1, 0))
+				 sp->m_db.str, sp->m_name.str, TRUE, 0))
 	{
 #ifndef EMBEDDED_LIBRARY
 	  thd->net.no_send_ok= nsok;
@@ -4083,7 +4088,7 @@
 	sp_change_security_context(thd, sp, &save_ctx);
 	if (save_ctx.changed && 
 	    check_routine_access(thd, EXECUTE_ACL, 
-				   sp->m_db.str, sp->m_name.str, 1, 0))
+				   sp->m_db.str, sp->m_name.str, TRUE, 0))
 	{
 #ifndef EMBEDDED_LIBRARY
 	  thd->net.no_send_ok= nsok;
@@ -4250,7 +4255,8 @@
           goto error;
 #ifndef NO_EMBEDDED_ACCESS_CHECKS
 	if (sp_automatic_privileges &&
-	    sp_revoke_privileges(thd, db, name, lex->sql_command == SQLCOM_DROP_PROCEDURE))
+	    sp_revoke_privileges(thd, db, name, 
+                                 lex->sql_command == SQLCOM_DROP_PROCEDURE))
 	{
 	  push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 
 		       ER_PROC_AUTO_REVOKE_FAIL,
@@ -4872,7 +4878,8 @@
     1            error
 */
 
-bool check_some_routine_access(THD *thd, const char *db, const char *name, bool is_proc)
+bool check_some_routine_access(THD *thd, const char *db, const char *name,
+                               bool is_proc)
 {
   ulong save_priv;
   if (thd->master_access & SHOW_PROC_ACLS)

--- 1.372/sql/sql_yacc.yy	2005-05-15 23:21:16 +01:00
+++ 1.373/sql/sql_yacc.yy	2005-05-17 09:17:10 +01:00
@@ -7931,7 +7931,7 @@
 	    YYABORT;
           }
 	  lex->sql_command= SQLCOM_REVOKE;
-          lex->type= 2;
+          lex->type= TYPE_ENUM_FUNCTION;
           
         }
 	|
@@ -7944,7 +7944,7 @@
 	    YYABORT;
           }
 	  lex->sql_command= SQLCOM_REVOKE;
-          lex->type= 1;
+          lex->type= TYPE_ENUM_PROCEDURE;
         }
 	|
 	ALL opt_privileges ',' GRANT OPTION FROM grant_list
@@ -7977,7 +7977,7 @@
 	    YYABORT;
           }
           lex->sql_command= SQLCOM_GRANT;
-          lex->type= 2;
+          lex->type= TYPE_ENUM_FUNCTION;
         }
         |
 	grant_privileges ON PROCEDURE grant_ident TO_SYM grant_list
@@ -7990,7 +7990,7 @@
 	    YYABORT;
           }
           lex->sql_command= SQLCOM_GRANT;
-          lex->type= 1;
+          lex->type= TYPE_ENUM_PROCEDURE;
         }
         ;
 

--- 1.26/scripts/mysql_fix_privilege_tables.sql	2005-05-15 23:21:15 +01:00
+++ 1.27/scripts/mysql_fix_privilege_tables.sql	2005-05-17 09:17:07 +01:00
@@ -68,7 +68,7 @@
 ALTER TABLE procs_priv
   modify Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
 ALTER TABLE procs_priv
-  add Routine_type enum('PROCEDURE','FUNCTION') COLLATE utf8_general_ci NOT NULL AFTER Routine_name;
+  add Routine_type enum('FUNCTION','PROCEDURE') COLLATE utf8_general_ci NOT NULL AFTER Routine_name;
 ALTER TABLE procs_priv
   modify Timestamp timestamp(14) AFTER Proc_priv;
 
@@ -320,7 +320,7 @@
 Db char(64) binary DEFAULT '' NOT NULL,
 User char(16) binary DEFAULT '' NOT NULL,
 Routine_name char(64) binary DEFAULT '' NOT NULL,
-Routine_type enum("PROCEDURE","FUNCTION") NOT NULL,
+Routine_type enum('FUNCTION','PROCEDURE') NOT NULL,
 Grantor char(77) DEFAULT '' NOT NULL,
 Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
 Timestamp timestamp(14),

--- 1.134/sql/sp_head.cc	2005-05-15 23:21:15 +01:00
+++ 1.135/sql/sp_head.cc	2005-05-17 09:17:07 +01:00
@@ -1111,7 +1111,8 @@
                  (!strcmp(sp->m_definer_user.str, thd->priv_user) &&
                   !strcmp(sp->m_definer_host.str, thd->priv_host)));
   if (!*full_access)
-    return check_some_routine_access(thd, sp->m_db.str, sp->m_name.str, sp->m_type == TYPE_ENUM_PROCEDURE);
+    return check_some_routine_access(thd, sp->m_db.str, sp->m_name.str,
+                                     sp->m_type == TYPE_ENUM_PROCEDURE);
   return 0;
 }
 

--- 1.22/mysql-test/r/system_mysql_db.result	2005-05-15 23:21:15 +01:00
+++ 1.23/mysql-test/r/system_mysql_db.result	2005-05-17 09:17:06 +01:00
@@ -152,7 +152,7 @@
   `Db` char(64) collate utf8_bin NOT NULL default '',
   `User` char(16) collate utf8_bin NOT NULL default '',
   `Routine_name` char(64) collate utf8_bin NOT NULL default '',
-  `Routine_type` enum('PROCEDURE','FUNCTION') collate utf8_bin NOT NULL default 'PROCEDURE',
+  `Routine_type` enum('FUNCTION','PROCEDURE') collate utf8_bin NOT NULL default 'FUNCTION',
   `Grantor` char(77) collate utf8_bin NOT NULL default '',
   `Proc_priv` set('Execute','Alter Routine','Grant') character set utf8 NOT NULL default '',
   `Timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,

--- 1.23/scripts/mysql_create_system_tables.sh	2005-05-15 23:21:15 +01:00
+++ 1.24/scripts/mysql_create_system_tables.sh	2005-05-17 09:17:07 +01:00
@@ -255,7 +255,7 @@
   c_pp="$c_pp   Db char(64) binary DEFAULT '' NOT NULL,"
   c_pp="$c_pp   User char(16) binary DEFAULT '' NOT NULL,"
   c_pp="$c_pp   Routine_name char(64) binary DEFAULT '' NOT NULL,"
-  c_pp="$c_pp   Routine_type enum('PROCEDURE','FUNCTION') NOT NULL,"
+  c_pp="$c_pp   Routine_type enum('FUNCTION','PROCEDURE') NOT NULL,"
   c_pp="$c_pp   Grantor char(77) DEFAULT '' NOT NULL,"
   c_pp="$c_pp   Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL,"
   c_pp="$c_pp   Timestamp timestamp(14),"
Thread
bk commit into 5.0 tree (acurtis:1.1948)antony17 May