List:Commits« Previous MessageNext Message »
From:Alexander Nozdrin Date:August 20 2010 9:04am
Subject:bzr commit into mysql-5.5-bugfixing branch (alik:3118)
View as plain text  
#At file:///mnt/raid/alik/MySQL/bzr/00/bug27480/mysql-5.5-runtime-bug27480.2/ based on revid:alik@stripped

 3118 Alexander Nozdrin	2010-08-20
      Polish check_merge_table_access().

    modified:
      sql/sql_parse.cc
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2010-08-18 11:55:37 +0000
+++ b/sql/sql_parse.cc	2010-08-20 09:04:33 +0000
@@ -644,41 +644,39 @@ end:
 
 
 /**
-  @brief Check access privs for a MERGE table and fix children lock types.
+  @brief Check access privileges for a MERGE table.
 
-  @param[in]        thd         thread handle
-  @param[in]        db          database name
-  @param[in,out]    table_list  list of child tables (merge_list)
-                                lock_type and optionally db set per table
-
-  @return           status
-    @retval         0           OK
-    @retval         != 0        Error
+  @param[in]        thd             thread handle
+  @param[in]        db              database name
+  @param[in,out]    merge_children  list of child tables (merge_list)
+
+  @return Error status
+    @retval FALSE OK
+    @retval TRUE  Error
 
   @detail
-    This function is used for write access to MERGE tables only
-    (CREATE TABLE, ALTER TABLE ... UNION=(...)). Set TL_WRITE for
-    every child. Set 'db' for every child if not present.
+    This function is used to check access to MERGE tables only
+    (CREATE TABLE, ALTER TABLE ... UNION=(...)). Set TABLE_LIST::db
+    attribute for every child if not present.
 */
 #ifndef NO_EMBEDDED_ACCESS_CHECKS
-bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *table_list)
+bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *merge_children)
 {
-  int error= 0;
+  if (!merge_children)
+    return FALSE;
 
-  if (table_list)
-  {
-    /* Check that all tables use the current database */
-    TABLE_LIST *tlist;
+  /* Check that all children use parent's database. */
 
-    for (tlist= table_list; tlist; tlist= tlist->next_local)
-    {
-      if (!tlist->db || !tlist->db[0])
-        tlist->db= db; /* purecov: inspected */
-    }
-    error= check_table_access(thd, SELECT_ACL | UPDATE_ACL | DELETE_ACL,
-                              table_list, FALSE, UINT_MAX, FALSE);
+  for (TABLE_LIST *tl= merge_children; tl; tl= tl->next_local)
+  {
+    if (!tl->db || !tl->db[0])
+      tl->db= db; /* purecov: inspected */
   }
-  return error;
+
+  /* Check privileges. */
+
+  return check_table_access(thd, SELECT_ACL | UPDATE_ACL | DELETE_ACL,
+                            merge_children, FALSE, UINT_MAX, FALSE);
 }
 #endif
 


Attachment: [text/bzr-bundle] bzr/alik@sun.com-20100820090433-m70zakbl8j0k72ki.bundle
Thread
bzr commit into mysql-5.5-bugfixing branch (alik:3118)Alexander Nozdrin20 Aug