mirror of
https://github.com/MariaDB/server.git
synced 2026-05-07 07:35:32 +02:00
mysql-5.1.62 merge
This commit is contained in:
commit
dea3544b2d
268 changed files with 6715 additions and 5654 deletions
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2006, 2010, Oracle and/or its affiliates.
|
||||
# Copyright (c) 2006, 2011, Oracle and/or its affiliates.
|
||||
#
|
||||
# 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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2000, 2010, Oracle and/or its affiliates.
|
||||
# Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
||||
#
|
||||
# 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
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2010, Oracle and/or its affiliates.
|
||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2010, Oracle and/or its affiliates.
|
||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
||||
|
||||
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
|
||||
|
|
@ -41,8 +41,9 @@ if (my_b_write((file),(uchar*) (from),param->ref_length)) \
|
|||
|
||||
/* functions defined in this file */
|
||||
|
||||
static char **make_char_array(char **old_pos, register uint fields,
|
||||
uint length, myf my_flag);
|
||||
static size_t char_array_size(uint fields, uint length);
|
||||
static uchar **make_char_array(uchar **old_pos, uint fields,
|
||||
uint length, myf my_flag);
|
||||
static uchar *read_buffpek_from_file(IO_CACHE *buffer_file, uint count,
|
||||
uchar *buf);
|
||||
static ha_rows find_all_keys(SORTPARAM *param,SQL_SELECT *select,
|
||||
|
|
@ -222,10 +223,22 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
|
|||
ulong old_memavl;
|
||||
ulong keys= memavl/(param.rec_length+sizeof(char*));
|
||||
param.keys=(uint) min(records+1, keys);
|
||||
|
||||
if (table_sort.sort_keys &&
|
||||
table_sort.sort_keys_size != char_array_size(param.keys,
|
||||
param.rec_length))
|
||||
{
|
||||
x_free((uchar*) table_sort.sort_keys);
|
||||
table_sort.sort_keys= NULL;
|
||||
table_sort.sort_keys_size= 0;
|
||||
}
|
||||
if ((table_sort.sort_keys=
|
||||
(uchar **) make_char_array((char **) table_sort.sort_keys,
|
||||
param.keys, param.rec_length, MYF(0))))
|
||||
make_char_array(table_sort.sort_keys,
|
||||
param.keys, param.rec_length, MYF(0))))
|
||||
{
|
||||
table_sort.sort_keys_size= char_array_size(param.keys, param.rec_length);
|
||||
break;
|
||||
}
|
||||
old_memavl=memavl;
|
||||
if ((memavl=memavl/4*3) < min_sort_memory && old_memavl > min_sort_memory)
|
||||
memavl= min_sort_memory;
|
||||
|
|
@ -307,6 +320,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
|
|||
{
|
||||
x_free((uchar*) sort_keys);
|
||||
table_sort.sort_keys= 0;
|
||||
table_sort.sort_keys_size= 0;
|
||||
x_free((uchar*) buffpek);
|
||||
table_sort.buffpek= 0;
|
||||
table_sort.buffpek_len= 0;
|
||||
|
|
@ -354,6 +368,7 @@ void filesort_free_buffers(TABLE *table, bool full)
|
|||
{
|
||||
x_free((uchar*) table->sort.sort_keys);
|
||||
table->sort.sort_keys= 0;
|
||||
table->sort.sort_keys_size= 0;
|
||||
}
|
||||
if (table->sort.buffpek)
|
||||
{
|
||||
|
|
@ -373,19 +388,28 @@ void filesort_free_buffers(TABLE *table, bool full)
|
|||
|
||||
/** Make a array of string pointers. */
|
||||
|
||||
static char **make_char_array(char **old_pos, register uint fields,
|
||||
uint length, myf my_flag)
|
||||
static size_t char_array_size(uint fields, uint length)
|
||||
{
|
||||
register char **pos;
|
||||
char *char_pos;
|
||||
return fields * (length + sizeof(uchar*));
|
||||
}
|
||||
|
||||
|
||||
static uchar **make_char_array(uchar **old_pos, uint fields,
|
||||
uint length, myf my_flag)
|
||||
{
|
||||
register uchar **pos;
|
||||
uchar *char_pos;
|
||||
DBUG_ENTER("make_char_array");
|
||||
|
||||
if (old_pos ||
|
||||
(old_pos= (char**) my_malloc((uint) fields*(length+sizeof(char*)),
|
||||
my_flag)))
|
||||
(old_pos= (uchar**) my_malloc(char_array_size(fields, length), my_flag)))
|
||||
{
|
||||
pos=old_pos; char_pos=((char*) (pos+fields)) -length;
|
||||
while (fields--) *(pos++) = (char_pos+= length);
|
||||
pos=old_pos;
|
||||
char_pos= ((uchar*)(pos+fields)) -length;
|
||||
while (fields--)
|
||||
{
|
||||
*(pos++) = (char_pos+= length);
|
||||
}
|
||||
}
|
||||
|
||||
DBUG_RETURN(old_pos);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
||||
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
|
||||
|
||||
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
|
||||
|
|
@ -7040,7 +7040,7 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item)
|
|||
|
||||
return my_time_compare(&field_time, &item_time);
|
||||
}
|
||||
return stringcmp(field_result, item_result);
|
||||
return sortcmp(field_result, item_result, field->charset());
|
||||
}
|
||||
if (res_type == INT_RESULT)
|
||||
return 0; // Both are of type int
|
||||
|
|
@ -7052,7 +7052,7 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item)
|
|||
if (item->null_value)
|
||||
return 0;
|
||||
field_val= field->val_decimal(&field_buf);
|
||||
return my_decimal_cmp(item_val, field_val);
|
||||
return my_decimal_cmp(field_val, item_val);
|
||||
}
|
||||
double result= item->val_real();
|
||||
if (item->null_value)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2002, 2010, Oracle and/or its affiliates.
|
||||
/* Copyright (c) 2002, 2011, Oracle and/or its affiliates.
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2002, 2010, Oracle and/or its affiliates.
|
||||
Copyright (c) 2002, 2011, Oracle and/or its affiliates.
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
||||
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
|
||||
|
||||
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
|
||||
|
|
@ -2653,7 +2653,7 @@ String *Item_time_typecast::val_str(String *str)
|
|||
|
||||
bool Item_date_typecast::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
|
||||
{
|
||||
bool res= get_arg0_date(ltime, fuzzy_date);
|
||||
bool res= get_arg0_date(ltime, TIME_FUZZY_DATE);
|
||||
ltime->hour= ltime->minute= ltime->second= ltime->second_part= 0;
|
||||
ltime->time_type= MYSQL_TIMESTAMP_DATE;
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2005, 2010, Oracle and/or its affiliates.
|
||||
Copyright (c) 2005, 2011, Oracle and/or its affiliates.
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
|
||||
Copyright (c) 2008-2011 Monty Program Ab
|
||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
||||
Copyright (c) 2008, 2011, Monty Program 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
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2005, 2010, Oracle and/or its affiliates.
|
||||
Copyright (c) 2005, 2011, Oracle and/or its affiliates.
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -3355,6 +3355,23 @@ sp_instr_hpush_jump::opt_mark(sp_head *sp, List<sp_instr> *leads)
|
|||
m_optdest= sp->get_instr(m_dest);
|
||||
}
|
||||
sp->add_mark_lead(m_dest, leads);
|
||||
|
||||
/*
|
||||
For continue handlers, all instructions in the scope of the handler
|
||||
are possible leads. For example, the instruction after freturn might
|
||||
be executed if the freturn triggers the condition handled by the
|
||||
continue handler.
|
||||
|
||||
m_dest marks the start of the handler scope. It's added as a lead
|
||||
above, so we start on m_dest+1 here.
|
||||
m_opt_hpop is the hpop marking the end of the handler scope.
|
||||
*/
|
||||
if (m_type == SP_HANDLER_CONTINUE)
|
||||
{
|
||||
for (uint scope_ip= m_dest+1; scope_ip <= m_opt_hpop; scope_ip++)
|
||||
sp->add_mark_lead(scope_ip, leads);
|
||||
}
|
||||
|
||||
return m_ip+1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1000,7 +1000,7 @@ class sp_instr_hpush_jump : public sp_instr_jump
|
|||
public:
|
||||
|
||||
sp_instr_hpush_jump(uint ip, sp_pcontext *ctx, int htype, uint fp)
|
||||
: sp_instr_jump(ip, ctx), m_type(htype), m_frame(fp)
|
||||
: sp_instr_jump(ip, ctx), m_type(htype), m_frame(fp), m_opt_hpop(0)
|
||||
{
|
||||
m_cond.empty();
|
||||
}
|
||||
|
|
@ -1022,6 +1022,15 @@ public:
|
|||
return m_ip;
|
||||
}
|
||||
|
||||
virtual void backpatch(uint dest, sp_pcontext *dst_ctx)
|
||||
{
|
||||
DBUG_ASSERT(!m_dest || !m_opt_hpop);
|
||||
if (!m_dest)
|
||||
m_dest= dest;
|
||||
else
|
||||
m_opt_hpop= dest;
|
||||
}
|
||||
|
||||
inline void add_condition(struct sp_cond_type *cond)
|
||||
{
|
||||
m_cond.push_front(cond);
|
||||
|
|
@ -1031,6 +1040,7 @@ private:
|
|||
|
||||
int m_type; ///< Handler type
|
||||
uint m_frame;
|
||||
uint m_opt_hpop; // hpop marking end of handler scope.
|
||||
List<struct sp_cond_type> m_cond;
|
||||
|
||||
}; // class sp_instr_hpush_jump : public sp_instr_jump
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2010, Oracle and/or its affiliates.
|
||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -123,9 +123,9 @@ Key::Key(const Key &rhs, MEM_ROOT *mem_root)
|
|||
*/
|
||||
|
||||
Foreign_key::Foreign_key(const Foreign_key &rhs, MEM_ROOT *mem_root)
|
||||
:Key(rhs),
|
||||
:Key(rhs,mem_root),
|
||||
ref_table(rhs.ref_table),
|
||||
ref_columns(rhs.ref_columns),
|
||||
ref_columns(rhs.ref_columns,mem_root),
|
||||
delete_opt(rhs.delete_opt),
|
||||
update_opt(rhs.update_opt),
|
||||
match_opt(rhs.match_opt)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2007, 2011, Oracle and/or its affiliates.
|
||||
Copyright (c) 2008-2011 Monty Program Ab
|
||||
Copyright (c) 2007, 2012, Oracle and/or its affiliates.
|
||||
Copyright (c) 2008, 2011, Monty Program 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
|
||||
|
|
@ -1096,13 +1096,38 @@ void prepare_new_connection_state(THD* thd)
|
|||
execute_init_command(thd, &sys_init_connect, &LOCK_sys_init_connect);
|
||||
if (thd->is_error())
|
||||
{
|
||||
thd->killed= THD::KILL_CONNECTION;
|
||||
ulong packet_length;
|
||||
NET *net= &thd->net;
|
||||
|
||||
sql_print_warning(ER(ER_NEW_ABORTING_CONNECTION),
|
||||
thd->thread_id,(thd->db ? thd->db : "unconnected"),
|
||||
thd->thread_id,
|
||||
thd->db ? thd->db : "unconnected",
|
||||
sctx->user ? sctx->user : "unauthenticated",
|
||||
sctx->host_or_ip, "init_connect command failed");
|
||||
sql_print_warning("%s", thd->main_da.message());
|
||||
|
||||
thd->lex->current_select= 0;
|
||||
my_net_set_read_timeout(net, thd->variables.net_wait_timeout);
|
||||
thd->clear_error();
|
||||
net_new_transaction(net);
|
||||
packet_length= my_net_read(net);
|
||||
/*
|
||||
If my_net_read() failed, my_error() has been already called,
|
||||
and the main Diagnostics Area contains an error condition.
|
||||
*/
|
||||
if (packet_length != packet_error)
|
||||
my_error(ER_NEW_ABORTING_CONNECTION, MYF(0),
|
||||
thd->thread_id,
|
||||
thd->db ? thd->db : "unconnected",
|
||||
sctx->user ? sctx->user : "unauthenticated",
|
||||
sctx->host_or_ip, "init_connect command failed");
|
||||
|
||||
thd->server_status&= ~SERVER_STATUS_CLEAR_SET;
|
||||
net_end_statement(thd);
|
||||
thd->killed = THD::KILL_CONNECTION;
|
||||
return;
|
||||
}
|
||||
|
||||
thd->proc_info=0;
|
||||
thd->set_time();
|
||||
thd->init_for_queries();
|
||||
|
|
|
|||
|
|
@ -9037,11 +9037,9 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
|
|||
}
|
||||
|
||||
/* Flatten nested joins that can be flattened. */
|
||||
TABLE_LIST *right_neighbor= NULL;
|
||||
li.rewind();
|
||||
while ((table= li++))
|
||||
{
|
||||
bool fix_name_res= FALSE;
|
||||
nested_join= table->nested_join;
|
||||
if (nested_join && !table->on_expr)
|
||||
{
|
||||
|
|
@ -9055,15 +9053,7 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
|
|||
tbl->join_list= table->join_list;
|
||||
}
|
||||
li.replace(nested_join->join_list);
|
||||
/* Need to update the name resolution table chain when flattening joins */
|
||||
fix_name_res= TRUE;
|
||||
table= *li.ref();
|
||||
}
|
||||
if (fix_name_res)
|
||||
table->next_name_resolution_table= right_neighbor ?
|
||||
right_neighbor->first_leaf_for_name_resolution() :
|
||||
NULL;
|
||||
right_neighbor= table;
|
||||
}
|
||||
DBUG_RETURN(conds);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
||||
2009-2011 Monty Program Ab
|
||||
Copyright (c) 2009, 2011, Monty Program 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
|
||||
|
|
@ -1234,7 +1234,9 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
|
|||
handler *file= table->file;
|
||||
TABLE_SHARE *share= table->s;
|
||||
HA_CREATE_INFO create_info;
|
||||
bool show_table_options __attribute__ ((unused))= FALSE;
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
bool show_table_options= FALSE;
|
||||
#endif /* WITH_PARTITION_STORAGE_ENGINE */
|
||||
bool foreign_db_mode= (thd->variables.sql_mode & (MODE_POSTGRESQL |
|
||||
MODE_ORACLE |
|
||||
MODE_MSSQL |
|
||||
|
|
@ -1453,7 +1455,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
|
|||
{
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
show_table_options= TRUE;
|
||||
#endif
|
||||
#endif /* WITH_PARTITION_STORAGE_ENGINE */
|
||||
/*
|
||||
Get possible table space definitions and append them
|
||||
to the CREATE TABLE statement
|
||||
|
|
|
|||
|
|
@ -2541,9 +2541,15 @@ sp_decl:
|
|||
sp_instr_hpush_jump *i=
|
||||
new sp_instr_hpush_jump(sp->instructions(), ctx, $2,
|
||||
ctx->current_var_count());
|
||||
if (i == NULL ||
|
||||
sp->add_instr(i) ||
|
||||
sp->push_backpatch(i, ctx->push_label((char *)"", 0)))
|
||||
if (i == NULL || sp->add_instr(i))
|
||||
MYSQL_YYABORT;
|
||||
|
||||
/* For continue handlers, mark end of handler scope. */
|
||||
if ($2 == SP_HANDLER_CONTINUE &&
|
||||
sp->push_backpatch(i, ctx->last_label()))
|
||||
MYSQL_YYABORT;
|
||||
|
||||
if (sp->push_backpatch(i, ctx->push_label(empty_c_string, 0)))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
sp_hcond_list sp_proc_stmt
|
||||
|
|
|
|||
|
|
@ -157,6 +157,7 @@ typedef struct st_filesort_info
|
|||
{
|
||||
IO_CACHE *io_cache; /* If sorted through filesort */
|
||||
uchar **sort_keys; /* Buffer for sorting keys */
|
||||
size_t sort_keys_size; /* Number of bytes allocated */
|
||||
uchar *buffpek; /* Buffer for buffpek structures */
|
||||
uint buffpek_len; /* Max number of buffpeks in the buffer */
|
||||
uchar *addon_buf; /* Pointer to a buffer if sorted with fields */
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2010, Oracle and/or its affiliates.
|
||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
||||
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue