List:Commits« Previous MessageNext Message »
From:msvensson Date:January 16 2006 10:50am
Subject:bk commit into 5.0 tree (msvensson:1.2022)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of msvensson. When msvensson 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.2022 06/01/16 11:50:07 msvensson@stripped +1 -0
  Merge msvensson@stripped:/home/msvensson/mysql/bug15020/my50-bug15020
  into  devsrv-b.mysql.com:/space/magnus/my50-bug15020

  sql/table.cc
    1.213 06/01/16 11:50:02 msvensson@stripped +0 -0
    Auto merged

# 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:	msvensson
# Host:	devsrv-b.mysql.com
# Root:	/space/magnus/my50-bug15020/RESYNC

--- 1.212/sql/table.cc	2005-12-02 10:01:10 +01:00
+++ 1.213/sql/table.cc	2006-01-16 11:50:02 +01:00
@@ -1411,13 +1411,12 @@
   if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
     create_flags|= O_EXCL | O_NOFOLLOW;
 
-#if SIZEOF_OFF_T > 4
   /* Fix this when we have new .frm files;  Current limit is 4G rows (QQ) */
   if (create_info->max_rows > UINT_MAX32)
     create_info->max_rows= UINT_MAX32;
   if (create_info->min_rows > UINT_MAX32)
     create_info->min_rows= UINT_MAX32;
-#endif
+
   /*
     Ensure that raid_chunks can't be larger than 255, as this would cause
     problems with drop database
@@ -2614,60 +2613,6 @@
 }
 
 
-
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
-
-/*
-  Check the access rights for the current join column.
-  columns.
-
-  SYNOPSIS
-    Natural_join_column::check_grants()
-
-  DESCRIPTION
-    Check the access rights to a column from a natural join in a generic
-    way that hides the heterogeneity of the column representation - whether
-    it is a view or a stored table colum.
-
-  RETURN
-    FALSE  The column can be accessed
-    TRUE   There are no access rights to all equivalent columns
-*/
-
-bool
-Natural_join_column::check_grants(THD *thd, const char *name, uint length)
-{
-  GRANT_INFO *grant;
-  const char *db_name;
-  const char *table_name;
-  Security_context *save_security_ctx= thd->security_ctx;
-  Security_context *new_sctx= table_ref->security_ctx;
-  bool res;
-
-  if (view_field)
-  {
-    DBUG_ASSERT(table_field == NULL);
-    grant= &(table_ref->grant);
-    db_name= table_ref->view_db.str;
-    table_name= table_ref->view_name.str;
-  }
-  else
-  {
-    DBUG_ASSERT(table_field && view_field == NULL);
-    grant= &(table_ref->table->grant);
-    db_name= table_ref->table->s->db;
-    table_name= table_ref->table->s->table_name;
-  }
-
-  if (new_sctx)
-    thd->security_ctx= new_sctx;
-  res= check_grant_column(thd, grant, db_name, table_name, name, length);
-  thd->security_ctx= save_security_ctx;
-  return res;
-}
-#endif
-
-
 void Field_iterator_view::set(TABLE_LIST *table)
 {
   DBUG_ASSERT(table->field_translation);
@@ -2710,8 +2655,9 @@
   if (view->schema_table_reformed)
   {
     /*
-      In case of SHOW command (schema_table_reformed set) all items are
-      fixed
+      Translation table items are always Item_fields and already fixed
+      ('mysql_schema_table' function). So we can return directly the
+      field. This case happens only for 'show & where' commands.
     */
     DBUG_ASSERT(field && field->fixed);
     DBUG_RETURN(field);
@@ -2743,21 +2689,14 @@
 void Field_iterator_natural_join::set(TABLE_LIST *table_ref)
 {
   DBUG_ASSERT(table_ref->join_columns);
-  delete column_ref_it;
-
-  /*
-    TODO: try not to allocate new iterator every time. If we have to,
-    then check for out of memory condition.
-  */
-  column_ref_it= new List_iterator_fast<Natural_join_column>
-                     (*(table_ref->join_columns));
-  cur_column_ref= (*column_ref_it)++;
+  column_ref_it.init(*(table_ref->join_columns));
+  cur_column_ref= column_ref_it++;
 }
 
 
 void Field_iterator_natural_join::next()
 {
-  cur_column_ref= (*column_ref_it)++;
+  cur_column_ref= column_ref_it++;
   DBUG_ASSERT(!cur_column_ref || ! cur_column_ref->table_field ||
               cur_column_ref->table_ref->table ==
               cur_column_ref->table_field->table);
@@ -2884,7 +2823,6 @@
 
   SYNOPSIS
     Field_iterator_table_ref::get_or_create_column_ref()
-    thd         [in]  pointer to current thread
     is_created  [out] set to TRUE if the column was created,
                       FALSE if we return an already created colum
 
@@ -2897,7 +2835,7 @@
 */
 
 Natural_join_column *
-Field_iterator_table_ref::get_or_create_column_ref(THD *thd, bool *is_created)
+Field_iterator_table_ref::get_or_create_column_ref(bool *is_created)
 {
   Natural_join_column *nj_col;
 
@@ -2927,6 +2865,41 @@
   }
   DBUG_ASSERT(!nj_col->table_field ||
               nj_col->table_ref->table == nj_col->table_field->table);
+  return nj_col;
+}
+
+
+/*
+  Return an existing reference to a column of a natural/using join.
+
+  SYNOPSIS
+    Field_iterator_table_ref::get_natural_column_ref()
+
+  DESCRIPTION
+    The method should be called in contexts where it is expected that
+    all natural join columns are already created, and that the column
+    being retrieved is a Natural_join_column.
+
+  RETURN
+    #     Pointer to a column of a natural join (or its operand)
+    NULL  No memory to allocate the column
+*/
+
+Natural_join_column *
+Field_iterator_table_ref::get_natural_column_ref()
+{
+  Natural_join_column *nj_col;
+
+  DBUG_ASSERT(field_it == &natural_join_it);
+  /*
+    The field belongs to a NATURAL join, therefore the column reference was
+    already created via one of the two constructor calls above. In this case
+    we just return the already created column reference.
+  */
+  nj_col= natural_join_it.column_ref();
+  DBUG_ASSERT(nj_col &&
+              (!nj_col->table_field ||
+               nj_col->table_ref->table == nj_col->table_field->table));
   return nj_col;
 }
 
Thread
bk commit into 5.0 tree (msvensson:1.2022)msvensson16 Jan