Below is the list of changes that have just been committed into a local
5.0 repository of cmiller. When cmiller 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.2093 06/04/25 00:30:18 cmiller@zippy.(none) +2 -0
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into zippy.(none):/home/cmiller/work/mysql/mysql-5.0__bug18930
sql/sql_parse.cc
1.538 06/04/25 00:30:12 cmiller@zippy.(none) +0 -0
Auto merged
mysys/Makefile.am
1.69 06/04/25 00:30:12 cmiller@zippy.(none) +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: cmiller
# Host: zippy.(none)
# Root: /home/cmiller/work/mysql/mysql-5.0__bug18930/RESYNC
--- 1.68/mysys/Makefile.am 2006-04-05 16:49:12 -04:00
+++ 1.69/mysys/Makefile.am 2006-04-25 00:30:12 -04:00
@@ -71,6 +71,7 @@
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
-DDEFAULT_HOME_ENV=MYSQL_HOME \
-DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX \
+ -DDEFAULT_SYSCONFDIR="\"$(sysconfdir)\"" \
@DEFS@
libmysys_a_DEPENDENCIES= @THREAD_LOBJECTS@
--- 1.537/sql/sql_parse.cc 2006-04-05 16:49:12 -04:00
+++ 1.538/sql/sql_parse.cc 2006-04-25 00:30:12 -04:00
@@ -74,7 +74,6 @@
static bool check_db_used(THD *thd,TABLE_LIST *tables);
static bool check_multi_update_lock(THD *thd);
static void remove_escape(char *name);
-static void refresh_status(THD *thd);
static bool append_file_to_dir(THD *thd, const char **filename_ptr,
const char *table_name);
@@ -3350,7 +3349,7 @@
Don't allow this within a transaction because we want to use
re-generate table
*/
- if ((thd->locked_tables && !lex->sphead) ||
thd->active_transaction())
+ if (thd->locked_tables || thd->active_transaction())
{
my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
@@ -5545,48 +5544,17 @@
}
else
{
- Name_resolution_context *outer_context;
if (lex->current_select->order_list.first &&
!lex->current_select->braces)
{
my_error(ER_WRONG_USAGE, MYF(0), "UNION", "ORDER BY");
DBUG_RETURN(1);
}
select_lex->include_neighbour(lex->current_select);
- /*
- we are not sure that we have one level of SELECTs above, so we take
- outer_context address from first select of unit
- */
- outer_context=
- select_lex->master_unit()->first_select()->context.outer_context;
- SELECT_LEX_UNIT *unit= select_lex->master_unit();
- SELECT_LEX *fake= unit->fake_select_lex;
- if (!fake)
- {
- /*
- as far as we included SELECT_LEX for UNION unit should have
- fake SELECT_LEX for UNION processing
- */
- if (!(fake= unit->fake_select_lex= new (thd->mem_root) SELECT_LEX()))
- DBUG_RETURN(1);
- fake->include_standalone(unit,
- (SELECT_LEX_NODE**)&unit->fake_select_lex);
- fake->select_number= INT_MAX;
- fake->parent_lex= lex; /* Used in init_query. */
- fake->make_empty_select();
- fake->linkage= GLOBAL_OPTIONS_TYPE;
- fake->select_limit= 0;
-
- fake->context.outer_context= outer_context;
- /* allow item list resolving in fake select for ORDER BY */
- fake->context.resolve_in_select_list= TRUE;
- fake->context.select_lex= fake;
- /*
- Remove the name resolution context of the fake select from the
- context stack.
- */
- lex->pop_context();
- }
- select_lex->context.outer_context= outer_context;
+ SELECT_LEX_UNIT *unit= select_lex->master_unit();
+ if (!unit->fake_select_lex && unit->add_fake_select_lex(lex->thd))
+ DBUG_RETURN(1);
+ select_lex->context.outer_context=
+ unit->first_select()->context.outer_context;
}
select_lex->master_unit()->global_parameters= select_lex;
@@ -6359,6 +6327,68 @@
/*
+ Create a fake SELECT_LEX for a unit
+
+ SYNOPSIS:
+ add_fake_select_lex()
+ thd thread handle
+
+ DESCRIPTION
+ The method create a fake SELECT_LEX object for a unit.
+ This object is created for any union construct containing a union
+ operation and also for any single select union construct of the form
+ (SELECT ... ORDER BY order_list [LIMIT n]) ORDER BY ...
+ or of the form
+ (SELECT ... ORDER BY LIMIT n) ORDER BY ...
+
+ NOTES
+ The object is used to retrieve rows from the temporary table
+ where the result on the union is obtained.
+
+ RETURN VALUES
+ 1 on failure to create the object
+ 0 on success
+*/
+
+bool st_select_lex_unit::add_fake_select_lex(THD *thd)
+{
+ SELECT_LEX *first_sl= first_select();
+ DBUG_ENTER("add_fake_select_lex");
+ DBUG_ASSERT(!fake_select_lex);
+
+ if (!(fake_select_lex= new (thd->mem_root) SELECT_LEX()))
+ DBUG_RETURN(1);
+ fake_select_lex->include_standalone(this,
+ (SELECT_LEX_NODE**)&fake_select_lex);
+ fake_select_lex->select_number= INT_MAX;
+ fake_select_lex->parent_lex= thd->lex; /* Used in init_query. */
+ fake_select_lex->make_empty_select();
+ fake_select_lex->linkage= GLOBAL_OPTIONS_TYPE;
+ fake_select_lex->select_limit= 0;
+
+ fake_select_lex->context.outer_context=first_sl->context.outer_context;
+ /* allow item list resolving in fake select for ORDER BY */
+ fake_select_lex->context.resolve_in_select_list= TRUE;
+ fake_select_lex->context.select_lex= fake_select_lex;
+
+ if (!first_sl->next_select())
+ {
+ /*
+ This works only for
+ (SELECT ... ORDER BY list [LIMIT n]) ORDER BY order_list [LIMIT m],
+ (SELECT ... LIMIT n) ORDER BY order_list [LIMIT m]
+ just before the parser starts processing order_list
+ */
+ global_parameters= fake_select_lex;
+ fake_select_lex->no_table_names_allowed= 1;
+ thd->lex->current_select= fake_select_lex;
+ }
+ thd->lex->pop_context();
+ DBUG_RETURN(0);
+}
+
+
+/*
Push a new name resolution context for a JOIN ... ON clause to the
context stack of a query block.
@@ -6706,27 +6736,6 @@
send_ok(thd);
else
my_error(error, MYF(0), id);
-}
-
-
-/* Clear most status variables */
-
-static void refresh_status(THD *thd)
-{
- pthread_mutex_lock(&LOCK_status);
-
- /* We must update the global status before cleaning up the thread */
- add_to_status(&global_status_var, &thd->status_var);
- bzero((char*) &thd->status_var, sizeof(thd->status_var));
-
- for (struct show_var_st *ptr=status_vars; ptr->name; ptr++)
- {
- if (ptr->type == SHOW_LONG)
- *(ulong*) ptr->value= 0;
- }
- /* Reset the counters of all key caches (default and named). */
- process_key_caches(reset_key_cache_counters);
- pthread_mutex_unlock(&LOCK_status);
}
| Thread |
|---|
| • bk commit into 5.0 tree (cmiller:1.2093) | Chad MILLER | 25 Apr |