Below is the list of changes that have just been committed into a local
5.1 repository of andrey. When andrey 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.2233 06/03/27 11:38:30 andrey@lmy004. +10 -0
manual merge
sql/event_timed.cc
1.46 06/03/27 11:38:23 andrey@lmy004. +3 -10
manual merge
sql/event_executor.cc
1.41 06/03/27 11:38:23 andrey@lmy004. +6 -9
manual merge
sql/event.h
1.31 06/03/27 11:38:23 andrey@lmy004. +9 -8
manual merge
mysql-test/t/disabled.def
1.88 06/03/27 11:38:23 andrey@lmy004. +3 -3
manual merge
sql/sql_yacc.yy
1.471 06/03/27 11:02:10 andrey@lmy004. +0 -1
Auto merged
sql/sql_show.cc
1.317 06/03/27 11:02:09 andrey@lmy004. +0 -0
Auto merged
sql/sql_parse.cc
1.535 06/03/27 11:02:09 andrey@lmy004. +0 -0
Auto merged
sql/sql_lex.h
1.219 06/03/27 11:02:08 andrey@lmy004. +0 -0
Auto merged
sql/field.h
1.181 06/03/27 11:02:08 andrey@lmy004. +0 -0
Auto merged
sql/Makefile.am
1.134 06/03/27 11:02:08 andrey@lmy004. +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: andrey
# Host: lmy004.
# Root: /work/mysql-5.1-bug17619/RESYNC
--- 1.133/sql/Makefile.am 2006-02-27 17:45:49 +01:00
+++ 1.134/sql/Makefile.am 2006-03-27 11:02:08 +02:00
@@ -174,10 +174,11 @@ ha_ndbcluster_binlog.o:ha_ndbcluster_bin
handler.o: handler.cc ha_ndbcluster.h
$(CXXCOMPILE) @ndbcluster_includes@ $(CXXFLAGS) -c $<
-# For testing of udf_example.so; Works on platforms with gcc
-# (This is not part of our build process but only provided as an example)
-udf_example.so: udf_example.cc
- $(CXXCOMPILE) -shared -o $@ $<
+# For testing of udf_example.so
+noinst_LTLIBRARIES= udf_example.la
+udf_example_la_SOURCES= udf_example.cc
+udf_example_la_LDFLAGS= -module -rpath $(pkglibdir)
+
# Don't update the files from bitkeeper
%::SCCS/s.%
--- 1.180/sql/field.h 2006-03-01 10:16:09 +01:00
+++ 1.181/sql/field.h 2006-03-27 11:02:08 +02:00
@@ -101,6 +101,10 @@ public:
virtual ~Field() {}
/* Store functions returns 1 on overflow and -1 on fatal error */
virtual int store(const char *to,uint length,CHARSET_INFO *cs)=0;
+ int store(LEX_STRING *str,CHARSET_INFO *cs)
+ {
+ return store(str->str, str->length, cs);
+ }
virtual int store(double nr)=0;
virtual int store(longlong nr, bool unsigned_val)=0;
virtual int store_decimal(const my_decimal *d)=0;
--- 1.218/sql/sql_lex.h 2006-02-28 20:58:15 +01:00
+++ 1.219/sql/sql_lex.h 2006-03-27 11:02:08 +02:00
@@ -41,14 +41,23 @@ class Event_timed;
#define LEX_YYSTYPE void *
#else
#include "lex_symbol.h"
+#if MYSQL_LEX
#include "sql_yacc.h"
#define LEX_YYSTYPE YYSTYPE *
+#else
+#define LEX_YYSTYPE void *
+#endif
#endif
#endif
/*
When a command is added here, be sure it's also added in mysqld.cc
in "struct show_var_st status_vars[]= {" ...
+
+ If the command returns a result set or is not allowed in stored
+ functions or triggers, please also make sure that
+ sp_get_flags_for_command (sp_head.cc) returns proper flags for the
+ added SQLCOM_.
*/
enum enum_sql_command {
@@ -696,6 +705,7 @@ typedef class st_select_lex SELECT_LEX;
#define ALTER_ANALYZE_PARTITION (1L << 22)
#define ALTER_CHECK_PARTITION (1L << 23)
#define ALTER_REPAIR_PARTITION (1L << 24)
+#define ALTER_REMOVE_PARTITIONING (1L << 25)
typedef struct st_alter_info
{
@@ -753,10 +763,11 @@ typedef struct st_lex
const uchar *buf; /* The beginning of string, used by SPs */
const uchar *ptr,*tok_start,*tok_end,*end_of_query;
- /* The values of tok_start/tok_end as they were one call of yylex before */
+ /* The values of tok_start/tok_end as they were one call of MYSQLlex before */
const uchar *tok_start_prev, *tok_end_prev;
char *length,*dec,*change,*name;
+ Table_ident *like_name;
char *help_arg;
char *backup_dir; /* For RESTORE/BACKUP */
char* to_log; /* For PURGE MASTER LOGS TO */
@@ -876,7 +887,11 @@ typedef struct st_lex
uint8 create_view_check;
bool drop_if_exists, drop_temporary, local_file, one_shot_set;
bool in_comment, ignore_space, verbose, no_write_to_binlog;
- bool tx_chain, tx_release;
+ /*
+ binlog_row_based_if_mixed tells if the parsing stage detected that some
+ items require row-based binlogging to give a reliable binlog/replication.
+ */
+ bool tx_chain, tx_release, binlog_row_based_if_mixed;
/*
Special JOIN::prepare mode: changing of query is prohibited.
When creating a view, we need to just check its syntax omitting
@@ -957,12 +972,16 @@ typedef struct st_lex
SQL_LIST trg_table_fields;
/*
- trigger_definition_begin points to the beginning of the word "TRIGGER" in
- CREATE TRIGGER statement. This is used to add possibly omitted DEFINER
- clause to the trigger definition statement before dumping it to the
- binlog.
+ stmt_definition_begin is intended to point to the next word after
+ DEFINER-clause in the following statements:
+ - CREATE TRIGGER (points to "TRIGGER");
+ - CREATE PROCEDURE (points to "PROCEDURE");
+ - CREATE FUNCTION (points to "FUNCTION" or "AGGREGATE");
+
+ This pointer is required to add possibly omitted DEFINER-clause to the
+ DDL-statement before dumping it to the binlog.
*/
- const char *trigger_definition_begin;
+ const char *stmt_definition_begin;
/*
If non-0 then indicates that query requires prelocking and points to
@@ -1111,7 +1130,7 @@ extern void lex_init(void);
extern void lex_free(void);
extern void lex_start(THD *thd, const uchar *buf, uint length);
extern void lex_end(LEX *lex);
-extern int yylex(void *arg, void *yythd);
+extern int MYSQLlex(void *arg, void *yythd);
extern pthread_key(LEX*,THR_LEX);
--- 1.534/sql/sql_parse.cc 2006-03-21 13:10:09 +01:00
+++ 1.535/sql/sql_parse.cc 2006-03-27 11:02:09 +02:00
@@ -3793,15 +3793,15 @@ end_with_restore_list:
uint rows_affected= 1;
DBUG_ASSERT(lex->et);
do {
- if (! lex->et->dbname.str)
+ if (! lex->et->ident.dbname.str)
{
my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0));
res= true;
break;
}
- if (check_access(thd, EVENT_ACL, lex->et->dbname.str, 0, 0, 0,
- is_schema_db(lex->et->dbname.str)))
+ if (check_access(thd, EVENT_ACL, lex->et->ident.dbname.str, 0, 0, 0,
+ is_schema_db(lex->et->ident.dbname.str)))
break;
if (end_active_trans(thd))
@@ -3852,12 +3852,12 @@ end_with_restore_list:
is_schema_db(lex->spname->m_db.str)))
break;
- if (lex->spname->m_name.length > NAME_LEN)
+ if (lex->et->ident.name.length > NAME_LEN)
{
- my_error(ER_TOO_LONG_IDENT, MYF(0), lex->spname->m_name.str);
+ my_error(ER_TOO_LONG_IDENT, MYF(0), lex->et->ident.name.str);
goto error;
}
- res= evex_show_create_event(thd, lex->spname, lex->et->definer);
+ res= evex_show_create_event(thd, lex->et->get_ident());
break;
}
case SQLCOM_CREATE_FUNCTION: // UDF function
--- 1.316/sql/sql_show.cc 2006-02-28 20:58:15 +01:00
+++ 1.317/sql/sql_show.cc 2006-03-27 11:02:09 +02:00
@@ -476,7 +476,7 @@ mysql_find_files(THD *thd,List<char> *fi
table_list.table_name= file->name;
table_list.table_name_length= strlen(file->name);
table_list.grant.privilege=col_access;
- if (check_grant(thd, TABLE_ACLS, &table_list, 1, UINT_MAX, 1))
+ if (check_grant(thd, TABLE_ACLS, &table_list, 1, 1, 1))
continue;
}
#endif
@@ -766,6 +766,18 @@ static const char *require_quotes(const
}
+/*
+ Quote the given identifier if needed and append it to the target string.
+ If the given identifier is empty, it will be quoted.
+
+ SYNOPSIS
+ append_identifier()
+ thd thread handler
+ packet target string
+ name the identifier to be appended
+ name_length length of the appending identifier
+*/
+
void
append_identifier(THD *thd, String *packet, const char *name, uint length)
{
@@ -819,8 +831,11 @@ append_identifier(THD *thd, String *pack
length length of name
IMPLEMENTATION
- If name is a keyword or includes a special character, then force
- quoting.
+ Force quoting in the following cases:
+ - name is empty (for one, it is possible when we use this function for
+ quoting user and host names for DEFINER clause);
+ - name is a keyword;
+ - name includes a special character;
Otherwise identifier is quoted only if the option OPTION_QUOTE_SHOW_CREATE
is set.
@@ -831,7 +846,8 @@ append_identifier(THD *thd, String *pack
int get_quote_char_for_identifier(THD *thd, const char *name, uint length)
{
- if (!is_keyword(name,length) &&
+ if (length &&
+ !is_keyword(name,length) &&
!require_quotes(name, length) &&
!(thd->options & OPTION_QUOTE_SHOW_CREATE))
return EOF;
@@ -966,7 +982,7 @@ store_create_info(THD *thd, TABLE_LIST *
{
if (field->charset() != share->table_charset)
{
- packet->append(STRING_WITH_LEN(" character set "));
+ packet->append(STRING_WITH_LEN(" CHARACTER SET "));
packet->append(field->charset()->csname);
}
/*
@@ -975,7 +991,7 @@ store_create_info(THD *thd, TABLE_LIST *
*/
if (!(field->charset()->state & MY_CS_PRIMARY))
{
- packet->append(STRING_WITH_LEN(" collate "));
+ packet->append(STRING_WITH_LEN(" COLLATE "));
packet->append(field->charset()->name);
}
}
@@ -1006,7 +1022,7 @@ store_create_info(THD *thd, TABLE_LIST *
if (has_default)
{
- packet->append(STRING_WITH_LEN(" default "));
+ packet->append(STRING_WITH_LEN(" DEFAULT "));
if (has_now_default)
packet->append(STRING_WITH_LEN("CURRENT_TIMESTAMP"));
else if (!field->is_null())
@@ -1034,11 +1050,11 @@ store_create_info(THD *thd, TABLE_LIST *
if (!(thd->variables.sql_mode & MODE_NO_FIELD_OPTIONS) &&
table->timestamp_field == field &&
field->unireg_check != Field::TIMESTAMP_DN_FIELD)
- packet->append(STRING_WITH_LEN(" on update CURRENT_TIMESTAMP"));
+ packet->append(STRING_WITH_LEN(" ON UPDATE CURRENT_TIMESTAMP"));
if (field->unireg_check == Field::NEXT_NUMBER &&
!(thd->variables.sql_mode & MODE_NO_FIELD_OPTIONS))
- packet->append(STRING_WITH_LEN(" auto_increment"));
+ packet->append(STRING_WITH_LEN(" AUTO_INCREMENT"));
if (field->comment.length)
{
@@ -3832,6 +3848,12 @@ static int get_schema_partitions_record(
uint no_items= part_elem->list_val_list.elements;
tmp_str.length(0);
tmp_res.length(0);
+ if (part_elem->has_null_value)
+ {
+ tmp_str.append("NULL");
+ if (no_items > 0)
+ tmp_str.append(",");
+ }
while ((list_value= list_val_it++))
{
tmp_res.set(*list_value, cs);
@@ -4642,7 +4664,8 @@ bool get_schema_tables_result(JOIN *join
TABLE_LIST *table_list= tab->table->pos_in_table_list;
if (table_list->schema_table && thd->fill_derived_tables())
{
- bool is_subselect= (&lex->unit != lex->current_select->master_unit());
+ bool is_subselect= (&lex->unit != lex->current_select->master_unit() &&
+ lex->current_select->master_unit()->item);
/*
The schema table is already processed and
the statement is not a subselect.
--- 1.470/sql/sql_yacc.yy 2006-02-28 20:58:16 +01:00
+++ 1.471/sql/sql_yacc.yy 2006-03-27 11:02:10 +02:00
@@ -42,18 +42,19 @@
#include <myisam.h>
#include <myisammrg.h>
+typedef struct p_elem_val
+{
+ longlong value;
+ bool null_value;
+} part_elem_value;
+
int yylex(void *yylval, void *yythd);
const LEX_STRING null_lex_str={0,0};
#define yyoverflow(A,B,C,D,E,F) {ulong val= *(F); if (my_yyoverflow((B), (D), &val)) { yyerror((char*) (A)); return 2; } else { *(F)= (YYSIZE_T)val; }}
-#define WARN_DEPRECATED(A,B) \
- push_warning_printf(((THD *)yythd), MYSQL_ERROR::WARN_LEVEL_WARN, \
- ER_WARN_DEPRECATED_SYNTAX, \
- ER(ER_WARN_DEPRECATED_SYNTAX), (A), (B));
-
-#define YYERROR_UNLESS(A) \
+#define YYERROR_UNLESS(A) \
if (!(A)) \
{ \
yyerror(ER(ER_SYNTAX_ERROR)); \
@@ -110,6 +111,7 @@ inline Item *is_truth_value(Item *A, boo
sp_name *spname;
struct st_lex *lex;
sp_head *sphead;
+ struct p_elem_val *p_elem_value;
}
%{
@@ -493,6 +495,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
%token PARSER_SYM
%token PARTIAL
%token PARTITION_SYM
+%token PARTITIONING_SYM
%token PARTITIONS_SYM
%token PASSWORD
%token PARAM_MARKER
@@ -535,6 +538,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
%token RELAY_THREAD
%token RELEASE_SYM
%token RELOAD
+%token REMOVE_SYM
%token RENAME
%token REORGANIZE_SYM
%token REPAIR
@@ -757,7 +761,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
%type <ulonglong_number>
ulonglong_num size_number
-%type <longlong_number>
+%type <p_elem_value>
part_bit_expr
%type <lock_type>
@@ -824,7 +828,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
%type <symbol> FUNC_ARG0 FUNC_ARG1 FUNC_ARG2 FUNC_ARG3 keyword keyword_sp
-%type <lex_user> user grant_user get_definer
+%type <lex_user> user grant_user
%type <charset>
opt_collate
@@ -879,8 +883,9 @@ bool my_yyoverflow(short **a, YYSTYPE **
sp_c_chistics sp_a_chistics sp_chistic sp_c_chistic xa
load_data opt_field_or_var_spec fields_or_vars opt_load_data_set_spec
definer view_replace_or_algorithm view_replace view_algorithm_opt
- view_algorithm view_or_trigger_tail view_suid view_tail view_list_opt
- view_list view_select view_check_option trigger_tail
+ view_algorithm view_or_trigger_or_sp view_or_trigger_or_sp_tail
+ view_suid view_tail view_list_opt view_list view_select
+ view_check_option trigger_tail sp_tail
install uninstall partition_entry binlog_base64_event
END_OF_INPUT
@@ -1211,7 +1216,8 @@ create:
lex->create_info.options=$2 | $4;
lex->create_info.db_type= lex->thd->variables.table_type;
lex->create_info.default_table_charset= NULL;
- lex->name=0;
+ lex->name= 0;
+ lex->like_name= 0;
}
create2
{ Lex->current_select= &Lex->select_lex; }
@@ -1250,78 +1256,6 @@ create:
lex->name=$4.str;
lex->create_info.options=$3;
}
- | CREATE udf_func_type FUNCTION_SYM sp_name
- {
- LEX *lex=Lex;
- lex->spname= $4;
- lex->udf.type= $2;
- }
- create_function_tail
- {}
- | CREATE PROCEDURE sp_name
- {
- LEX *lex= Lex;
- sp_head *sp;
-
- if (lex->sphead)
- {
- my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "PROCEDURE");
- YYABORT;
- }
- /* Order is important here: new - reset - init */
- sp= new sp_head();
- sp->reset_thd_mem_root(YYTHD);
- sp->init(lex);
-
- sp->m_type= TYPE_ENUM_PROCEDURE;
- lex->sphead= sp;
- /*
- * We have to turn of CLIENT_MULTI_QUERIES while parsing a
- * stored procedure, otherwise yylex will chop it into pieces
- * at each ';'.
- */
- $<ulong_num>$= YYTHD->client_capabilities & CLIENT_MULTI_QUERIES;
- YYTHD->client_capabilities &= (~CLIENT_MULTI_QUERIES);
- }
- '('
- {
- LEX *lex= Lex;
-
- lex->sphead->m_param_begin= lex->tok_start+1;
- }
- sp_pdparam_list
- ')'
- {
- LEX *lex= Lex;
-
- lex->sphead->m_param_end= lex->tok_start;
- bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
- }
- sp_c_chistics
- {
- LEX *lex= Lex;
-
- lex->sphead->m_chistics= &lex->sp_chistics;
- lex->sphead->m_body_begin= lex->tok_start;
- }
- sp_proc_stmt
- {
- LEX *lex= Lex;
- sp_head *sp= lex->sphead;
-
- if (sp->check_backpatch(YYTHD))
- YYABORT;
- sp->init_strings(YYTHD, lex, $3);
- lex->sql_command= SQLCOM_CREATE_PROCEDURE;
-
- /*
- Restore flag if it was cleared above
- Be careful with counting. the block where we save the value
- is $4.
- */
- YYTHD->client_capabilities |= $<ulong_num>4;
- sp->restore_thd_mem_root(YYTHD);
- }
| CREATE EVENT_SYM opt_if_not_exists sp_name
/*
BE CAREFUL when you add a new rule to update the block where
@@ -1343,7 +1277,7 @@ create:
lex->create_info.options= $3;
- if (!(lex->et= new Event_timed())) // implicitly calls Event_timed::init()
+ if (!(lex->et= new(YYTHD->mem_root) Event_timed())) // implicitly calls Event_timed::init()
YYABORT;
/*
@@ -1386,7 +1320,7 @@ create:
Lex->create_view_algorithm= VIEW_ALGORITHM_UNDEFINED;
Lex->create_view_suid= TRUE;
}
- view_or_trigger
+ view_or_trigger_or_sp
{}
| CREATE USER clear_privileges grant_list
{
@@ -2466,10 +2400,10 @@ sp_proc_stmt_leave:
uint ip= sp->instructions();
uint n;
- n= ctx->diff_handlers(lab->ctx);
+ n= ctx->diff_handlers(lab->ctx, TRUE); /* Exclusive the dest. */
if (n)
sp->add_instr(new sp_instr_hpop(ip++, ctx, n));
- n= ctx->diff_cursors(lab->ctx);
+ n= ctx->diff_cursors(lab->ctx, TRUE); /* Exclusive the dest. */
if (n)
sp->add_instr(new sp_instr_cpop(ip++, ctx, n));
i= new sp_instr_jump(ip, ctx);
@@ -2498,10 +2432,10 @@ sp_proc_stmt_iterate:
uint ip= sp->instructions();
uint n;
- n= ctx->diff_handlers(lab->ctx);
+ n= ctx->diff_handlers(lab->ctx, FALSE); /* Inclusive the dest. */
if (n)
sp->add_instr(new sp_instr_hpop(ip++, ctx, n));
- n= ctx->diff_cursors(lab->ctx);
+ n= ctx->diff_cursors(lab->ctx, FALSE); /* Inclusive the dest. */
if (n)
sp->add_instr(new sp_instr_cpop(ip++, ctx, n));
i= new sp_instr_jump(ip, ctx, lab->ip); /* Jump back */
@@ -3339,13 +3273,13 @@ create2:
| LIKE table_ident
{
LEX *lex=Lex;
- if (!(lex->name= (char *)$2))
+ if (!(lex->like_name= $2))
YYABORT;
}
| '(' LIKE table_ident ')'
{
LEX *lex=Lex;
- if (!(lex->name= (char *)$3))
+ if (!(lex->like_name= $3))
YYABORT;
}
;
@@ -3487,7 +3421,7 @@ part_func:
uint expr_len= (uint)($4 - $2) - 1;
lex->part_info->list_of_part_fields= FALSE;
lex->part_info->part_expr= $3;
- lex->part_info->part_func_string= $2+1;
+ lex->part_info->part_func_string= (char* ) sql_memdup($2+1, expr_len);
lex->part_info->part_func_len= expr_len;
}
;
@@ -3499,7 +3433,7 @@ sub_part_func:
uint expr_len= (uint)($4 - $2) - 1;
lex->part_info->list_of_subpart_fields= FALSE;
lex->part_info->subpart_expr= $3;
- lex->part_info->subpart_func_string= $2+1;
+ lex->part_info->subpart_func_string= (char* ) sql_memdup($2+1, expr_len);
lex->part_info->subpart_func_len= expr_len;
}
;
@@ -3730,6 +3664,8 @@ opt_part_values:
YYABORT;
}
}
+ else
+ lex->part_info->part_type= HASH_PARTITION;
}
| VALUES LESS_SYM THAN_SYM part_func_max
{
@@ -3743,6 +3679,8 @@ opt_part_values:
YYABORT;
}
}
+ else
+ lex->part_info->part_type= RANGE_PARTITION;
}
| VALUES IN_SYM '(' part_list_func ')'
{
@@ -3756,6 +3694,8 @@ opt_part_values:
YYABORT;
}
}
+ else
+ lex->part_info->part_type= LIST_PARTITION;
}
;
@@ -3784,7 +3724,7 @@ part_func_max:
part_range_func:
'(' part_bit_expr ')'
{
- Lex->part_info->curr_part_elem->range_value= $2;
+ Lex->part_info->curr_part_elem->range_value= $2->value;
}
;
@@ -3796,12 +3736,12 @@ part_list_func:
part_list_item:
part_bit_expr
{
- longlong *value_ptr;
- if (!(value_ptr= (longlong*)sql_alloc(sizeof(longlong))) ||
- ((*value_ptr= $1, FALSE) ||
- Lex->part_info->curr_part_elem->list_val_list.push_back(value_ptr)))
+ part_elem_value *value_ptr= $1;
+ if (!value_ptr->null_value &&
+ Lex->part_info->curr_part_elem->
+ list_val_list.push_back((longlong*) &value_ptr->value))
{
- mem_alloc_error(sizeof(longlong));
+ mem_alloc_error(sizeof(part_elem_value));
YYABORT;
}
}
@@ -3821,6 +3761,15 @@ part_bit_expr:
context->table_list= 0;
thd->where= "partition function";
+
+ part_elem_value *value_ptr=
+ (part_elem_value*)sql_alloc(sizeof(part_elem_value));
+ if (!value_ptr)
+ {
+ mem_alloc_error(sizeof(part_elem_value));
+ YYABORT;
+ }
+
if (part_expr->fix_fields(YYTHD, (Item**)0) ||
((context->table_list= save_list), FALSE) ||
(!part_expr->const_item()) ||
@@ -3830,18 +3779,36 @@ part_bit_expr:
YYABORT;
}
thd->where= save_where;
- if (part_expr->result_type() != INT_RESULT)
+ value_ptr->value= part_expr->val_int();
+ if ((value_ptr->null_value= part_expr->null_value))
+ {
+ if (Lex->part_info->curr_part_elem->has_null_value)
+ {
+ my_error(ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR, MYF(0));
+ YYABORT;
+ }
+ Lex->part_info->curr_part_elem->has_null_value= TRUE;
+ }
+ else if (part_expr->result_type() != INT_RESULT &&
+ !part_expr->null_value)
{
yyerror(ER(ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR));
YYABORT;
}
- item_value= part_expr->val_int();
- $$= item_value;
+ $$= value_ptr;
}
;
opt_sub_partition:
- /* empty */ {}
+ /* empty */
+ {
+ if (Lex->part_info->no_subparts != 0 &&
+ !Lex->part_info->use_default_subpartitions)
+ {
+ yyerror(ER(ER_PARTITION_WRONG_NO_SUBPART_ERROR));
+ YYABORT;
+ }
+ }
| '(' sub_part_list ')'
{
LEX *lex= Lex;
@@ -3857,6 +3824,11 @@ opt_sub_partition:
}
else if (part_info->count_curr_subparts > 0)
{
+ if (part_info->partitions.elements > 1)
+ {
+ yyerror(ER(ER_PARTITION_WRONG_NO_SUBPART_ERROR));
+ YYABORT;
+ }
part_info->no_subparts= part_info->count_curr_subparts;
}
part_info->count_curr_subparts= 0;
@@ -4007,6 +3979,13 @@ create_table_options:
create_table_option:
ENGINE_SYM opt_equal storage_engines { Lex->create_info.db_type= $3; Lex->create_info.used_fields|= HA_CREATE_USED_ENGINE; }
+ | TYPE_SYM opt_equal storage_engines
+ {
+ Lex->create_info.db_type= $3;
+ WARN_DEPRECATED(yythd, "5.2", "TYPE=storage_engine",
+ "'ENGINE=storage_engine'");
+ Lex->create_info.used_fields|= HA_CREATE_USED_ENGINE;
+ }
| MAX_ROWS opt_equal ulonglong_num { Lex->create_info.max_rows= $3; Lex->create_info.used_fields|= HA_CREATE_USED_MAX_ROWS;}
| MIN_ROWS opt_equal ulonglong_num { Lex->create_info.min_rows= $3; Lex->create_info.used_fields|= HA_CREATE_USED_MIN_ROWS;}
| AVG_ROW_LENGTH opt_equal ulong_num { Lex->create_info.avg_row_length=$3; Lex->create_info.used_fields|= HA_CREATE_USED_AVG_ROW_LENGTH;}
@@ -4734,8 +4713,8 @@ alter:
{
THD *thd= YYTHD;
LEX *lex= thd->lex;
+ lex->name= 0;
lex->sql_command= SQLCOM_ALTER_TABLE;
- lex->name= 0;
lex->duplicates= DUP_ERROR;
if (!lex->select_lex.add_table_to_list(thd, $4, NULL,
TL_OPTION_UPDATING))
@@ -4744,7 +4723,8 @@ alter:
lex->key_list.empty();
lex->col_list.empty();
lex->select_lex.init_order();
- lex->select_lex.db=lex->name=0;
+ lex->select_lex.db=lex->name= 0;
+ lex->like_name= 0;
bzero((char*) &lex->create_info,sizeof(lex->create_info));
lex->create_info.db_type= (handlerton*) &default_hton;
lex->create_info.default_table_charset= NULL;
@@ -4833,7 +4813,7 @@ alter:
}
lex->spname= 0;//defensive programming
- if (!(et= new Event_timed()))// implicitly calls Event_timed::init()
+ if (!(et= new (YYTHD->mem_root) Event_timed()))// implicitly calls Event_timed::init()
YYABORT;
lex->et = et;
@@ -4925,6 +4905,9 @@ alter_commands:
| IMPORT TABLESPACE { Lex->alter_info.tablespace_op= IMPORT_TABLESPACE; }
| alter_list
opt_partitioning
+ | alter_list
+ remove_partitioning
+ | remove_partitioning
| partitioning
/*
This part was added for release 5.1 by Mikael Ronström.
@@ -4990,8 +4973,15 @@ alter_commands:
| reorg_partition_rule
;
+remove_partitioning:
+ REMOVE_SYM PARTITIONING_SYM
+ {
+ Lex->alter_info.flags|= ALTER_REMOVE_PARTITIONING;
+ }
+ ;
+
all_or_alt_part_name_list:
- | ALL
+ ALL
{
Lex->alter_info.flags|= ALTER_ALL_PARTITION;
}
@@ -5360,11 +5350,8 @@ restore:
RESTORE_SYM table_or_tables
{
Lex->sql_command = SQLCOM_RESTORE_TABLE;
- push_warning_printf(((THD *)yythd), MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_WARN_DEPRECATED_STATEMENT,
- ER(ER_WARN_DEPRECATED_STATEMENT),
- "RESTORE TABLE", "5.2",
- "mysqldump, mysql, MySQL Administrator");
+ WARN_DEPRECATED(yythd, "5.2", "RESTORE TABLE",
+ "MySQL Administrator (mysqldump, mysql)");
}
table_list FROM TEXT_STRING_sys
{
@@ -5375,11 +5362,8 @@ backup:
BACKUP_SYM table_or_tables
{
Lex->sql_command = SQLCOM_BACKUP_TABLE;
- push_warning_printf(((THD *)yythd), MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_WARN_DEPRECATED_STATEMENT,
- ER(ER_WARN_DEPRECATED_STATEMENT),
- "BACKUP TABLE", "5.2",
- "mysqldump, mysql, MySQL Administrator");
+ WARN_DEPRECATED(yythd, "5.2", "BACKUP TABLE",
+ "MySQL Administrator (mysqldump, mysql)");
}
table_list TO_SYM TEXT_STRING_sys
{
@@ -6386,9 +6370,19 @@ simple_expr:
| SUBSTRING_INDEX '(' expr ',' expr ',' expr ')'
{ $$= new Item_func_substr_index($3,$5,$7); }
| SYSDATE optional_braces
- { $$= new Item_func_sysdate_local(); Lex->safe_to_cache_query=0;}
+ {
+ if (global_system_variables.sysdate_is_now == 0)
+ $$= new Item_func_sysdate_local();
+ else $$= new Item_func_now_local();
+ Lex->safe_to_cache_query=0;
+ }
| SYSDATE '(' expr ')'
- { $$= new Item_func_sysdate_local($3); Lex->safe_to_cache_query=0;}
+ {
+ if (global_system_variables.sysdate_is_now == 0)
+ $$= new Item_func_sysdate_local($3);
+ else $$= new Item_func_now_local($3);
+ Lex->safe_to_cache_query=0;
+ }
| TIME_SYM '(' expr ')'
{ $$= new Item_time_typecast($3); }
| TIMESTAMP '(' expr ')'
@@ -6459,6 +6453,8 @@ simple_expr:
if (udf->type == UDFTYPE_AGGREGATE)
Select->in_sum_expr--;
+ Lex->binlog_row_based_if_mixed= 1;
+
switch (udf->returns) {
case STRING_RESULT:
if (udf->type == UDFTYPE_FUNCTION)
@@ -7149,9 +7145,8 @@ select_derived2:
{
LEX *lex= Lex;
lex->derived_tables|= DERIVED_SUBQUERY;
- if (((int)lex->sql_command >= (int)SQLCOM_HA_OPEN &&
- lex->sql_command <= (int)SQLCOM_HA_READ) ||
- lex->sql_command == (int)SQLCOM_KILL)
+ if (lex->sql_command == (int)SQLCOM_HA_READ ||
+ lex->sql_command == (int)SQLCOM_KILL)
{
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
@@ -7729,7 +7724,7 @@ drop:
YYABORT;
}
- if (!(lex->et= new Event_timed()))
+ if (!(lex->et= new (YYTHD->mem_root) Event_timed()))
YYABORT;
if (!lex->et_compile_phase)
@@ -7818,7 +7813,19 @@ replace:
;
insert_lock_option:
- /* empty */ { $$= TL_WRITE_CONCURRENT_INSERT; }
+ /* empty */
+ {
+#ifdef HAVE_QUERY_CACHE
+ /*
+ If it is SP we do not allow insert optimisation whan result of
+ insert visible only after the table unlocking but everyone can
+ read table.
+ */
+ $$= (Lex->sphead ? TL_WRITE :TL_WRITE_CONCURRENT_INSERT);
+#else
+ $$= TL_WRITE_CONCURRENT_INSERT;
+#endif
+ }
| LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; }
| DELAYED_SYM { $$= TL_WRITE_DELAYED; }
| HIGH_PRIORITY { $$= TL_WRITE; }
@@ -8219,7 +8226,7 @@ show_param:
{
LEX *lex=Lex;
lex->sql_command= SQLCOM_SHOW_STORAGE_ENGINES;
- WARN_DEPRECATED("SHOW TABLE TYPES", "SHOW [STORAGE] ENGINES");
+ WARN_DEPRECATED(yythd, "5.2", "SHOW TABLE TYPES", "'SHOW [STORAGE] ENGINES'");
}
| opt_storage ENGINES_SYM
{
@@ -8255,7 +8262,7 @@ show_param:
lex->option_type= $1;
if (prepare_schema_table(YYTHD, lex, 0, SCH_STATUS))
YYABORT;
- }
+ }
| INNOBASE_SYM STATUS_SYM
{
LEX *lex= Lex;
@@ -8266,19 +8273,19 @@ show_param:
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), "InnoDB");
YYABORT;
}
- WARN_DEPRECATED("SHOW INNODB STATUS", "SHOW ENGINE INNODB STATUS");
+ WARN_DEPRECATED(yythd, "5.2", "SHOW INNODB STATUS", "'SHOW ENGINE INNODB STATUS'");
}
| MUTEX_SYM STATUS_SYM
{
LEX *lex= Lex;
- lex->sql_command = SQLCOM_SHOW_ENGINE_MUTEX;
+ lex->sql_command = SQLCOM_SHOW_ENGINE_MUTEX;
if (!(lex->create_info.db_type=
ha_resolve_by_legacy_type(YYTHD, DB_TYPE_INNODB)))
{
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), "InnoDB");
YYABORT;
}
- WARN_DEPRECATED("SHOW MUTEX STATUS", "SHOW ENGINE INNODB MUTEX");
+ WARN_DEPRECATED(yythd, "5.2", "SHOW MUTEX STATUS", "'SHOW ENGINE INNODB MUTEX'");
}
| opt_full PROCESSLIST_SYM
{ Lex->sql_command= SQLCOM_SHOW_PROCESSLIST;}
@@ -8317,7 +8324,7 @@ show_param:
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), "BerkeleyDB");
YYABORT;
}
- WARN_DEPRECATED("SHOW BDB LOGS", "SHOW ENGINE BDB LOGS");
+ WARN_DEPRECATED(yythd, "5.2", "SHOW BDB LOGS", "'SHOW ENGINE BDB LOGS'");
}
| LOGS_SYM
{
@@ -8329,7 +8336,7 @@ show_param:
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), "BerkeleyDB");
YYABORT;
}
- WARN_DEPRECATED("SHOW LOGS", "SHOW ENGINE BDB LOGS");
+ WARN_DEPRECATED(yythd, "5.2", "SHOW LOGS", "'SHOW ENGINE BDB LOGS'");
}
| GRANTS
{
@@ -8450,7 +8457,7 @@ show_param:
{
Lex->sql_command = SQLCOM_SHOW_CREATE_EVENT;
Lex->spname= $3;
- Lex->et= new Event_timed();
+ Lex->et= new (YYTHD->mem_root) Event_timed();
if (!Lex->et)
YYABORT;
Lex->et->init_name_and_definer(YYTHD, $3);
@@ -8643,18 +8650,18 @@ purge_option:
/* kill threads */
kill:
- KILL_SYM kill_option expr
+ KILL_SYM { Lex->sql_command= SQLCOM_KILL; } kill_option expr
{
LEX *lex=Lex;
lex->value_list.empty();
- lex->value_list.push_front($3);
- lex->sql_command= SQLCOM_KILL;
+ lex->value_list.push_front($4);
};
kill_option:
/* empty */ { Lex->type= 0; }
| CONNECTION_SYM { Lex->type= 0; }
- | QUERY_SYM { Lex->type= ONLY_KILL_QUERY; };
+ | QUERY_SYM { Lex->type= ONLY_KILL_QUERY; }
+ ;
/* change database */
@@ -8667,7 +8674,7 @@ use: USE_SYM ident
/* import, export of files */
-load: LOAD DATA_SYM
+load: LOAD DATA_SYM
{
LEX *lex=Lex;
if (lex->sphead)
@@ -8683,11 +8690,8 @@ load: LOAD DATA_SYM
LOAD TABLE_SYM table_ident FROM MASTER_SYM
{
LEX *lex=Lex;
- push_warning_printf(((THD *)yythd), MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_WARN_DEPRECATED_STATEMENT,
- ER(ER_WARN_DEPRECATED_STATEMENT),
- "LOAD TABLE FROM MASTER", "5.2",
- "mysqldump, mysql, MySQL Administrator");
+ WARN_DEPRECATED(yythd, "5.2", "LOAD TABLE FROM MASTER",
+ "MySQL Administrator (mysqldump, mysql)");
if (lex->sphead)
{
my_error(ER_SP_BADSTATEMENT, MYF(0), "LOAD TABLE");
@@ -8740,7 +8744,16 @@ opt_local:
load_data_lock:
/* empty */ { $$= YYTHD->update_lock_default; }
- | CONCURRENT { $$= TL_WRITE_CONCURRENT_INSERT ; }
+ | CONCURRENT
+ {
+#ifdef HAVE_QUERY_CACHE
+ /*
+ Ignore this option in SP to avoid problem with query cache
+ */
+ if (Lex->sphead != 0)
+#endif
+ $$= TL_WRITE_CONCURRENT_INSERT;
+ }
| LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; };
@@ -9338,6 +9351,7 @@ keyword:
| PARTITION_SYM {}
| PLUGIN_SYM {}
| PREPARE_SYM {}
+ | REMOVE_SYM {}
| REPAIR {}
| RESET_SYM {}
| RESTORE_SYM {}
@@ -9512,6 +9526,7 @@ keyword_sp:
| ONE_SYM {}
| PACK_KEYS_SYM {}
| PARTIAL {}
+ | PARTITIONING_SYM {}
| PARTITIONS_SYM {}
| PASSWORD {}
| PHASE_SYM {}
@@ -10738,9 +10753,8 @@ subselect_start:
'(' SELECT_SYM
{
LEX *lex=Lex;
- if (((int)lex->sql_command >= (int)SQLCOM_HA_OPEN &&
- lex->sql_command <= (int)SQLCOM_HA_READ) ||
- lex->sql_command == (int)SQLCOM_KILL)
+ if (lex->sql_command == (int)SQLCOM_HA_READ ||
+ lex->sql_command == (int)SQLCOM_KILL)
{
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
@@ -10758,45 +10772,61 @@ subselect_end:
lex->nest_level--;
};
+/**************************************************************************
+
+ CREATE VIEW | TRIGGER | PROCEDURE statements.
+
+**************************************************************************/
+
+view_or_trigger_or_sp:
+ definer view_or_trigger_or_sp_tail
+ {}
+ | view_replace_or_algorithm definer view_tail
+ {}
+ ;
+
+view_or_trigger_or_sp_tail:
+ view_tail
+ {}
+ | trigger_tail
+ {}
+ | sp_tail
+ {}
+ ;
+
+/**************************************************************************
+
+ DEFINER clause support.
+
+**************************************************************************/
+
definer:
- get_definer
+ /* empty */
{
- THD *thd= YYTHD;
-
- if (! (thd->lex->definer= create_definer(thd, &$1->user, &$1->host)))
- YYABORT;
+ /*
+ We have to distinguish missing DEFINER-clause from case when
+ CURRENT_USER specified as definer explicitly in order to properly
+ handle CREATE TRIGGER statements which come to replication thread
+ from older master servers (i.e. to create non-suid trigger in this
+ case).
+ */
+ YYTHD->lex->definer= 0;
}
- ;
-
-get_definer:
- opt_current_definer
+ | DEFINER_SYM EQ CURRENT_USER optional_braces
{
- THD *thd= YYTHD;
-
- if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
- YYABORT;
-
- if (get_default_definer(thd, $$))
- YYABORT;
+ if (! (YYTHD->lex->definer= create_default_definer(YYTHD)))
+ YYABORT;
}
| DEFINER_SYM EQ ident_or_text '@' ident_or_text
{
- if (!($$=(LEX_USER*) YYTHD->alloc(sizeof(st_lex_user))))
- YYABORT;
-
- $$->user= $3;
- $$->host= $5;
+ if (!(YYTHD->lex->definer= create_definer(YYTHD, &$3, &$5)))
+ YYABORT;
}
;
-opt_current_definer:
- /* empty */
- | DEFINER_SYM EQ CURRENT_USER optional_braces
- ;
-
/**************************************************************************
- CREATE VIEW statement options.
+ CREATE VIEW statement parts.
**************************************************************************/
@@ -10830,20 +10860,6 @@ view_algorithm_opt:
{}
;
-view_or_trigger:
- definer view_or_trigger_tail
- {}
- | view_replace_or_algorithm definer view_tail
- {}
- ;
-
-view_or_trigger_tail:
- view_tail
- {}
- | trigger_tail
- {}
- ;
-
view_suid:
/* empty */
{ Lex->create_view_suid= TRUE; }
@@ -10926,7 +10942,7 @@ view_check_option:
trigger_tail:
TRIGGER_SYM remember_name sp_name trg_action_time trg_event
- ON remember_name table_ident remember_end FOR_SYM EACH_SYM ROW_SYM
+ ON remember_name table_ident FOR_SYM remember_name EACH_SYM ROW_SYM
{
LEX *lex= Lex;
sp_head *sp;
@@ -10942,9 +10958,9 @@ trigger_tail:
sp->reset_thd_mem_root(YYTHD);
sp->init(lex);
- lex->trigger_definition_begin= $2;
+ lex->stmt_definition_begin= $2;
lex->ident.str= $7;
- lex->ident.length= $9 - $7;
+ lex->ident.length= $10 - $7;
sp->m_type= TYPE_ENUM_TRIGGER;
lex->sphead= sp;
@@ -10988,6 +11004,90 @@ trigger_tail:
TL_OPTION_UPDATING,
TL_IGNORE))
YYABORT;
+ }
+ ;
+
+/**************************************************************************
+
+ CREATE FUNCTION | PROCEDURE statements parts.
+
+**************************************************************************/
+
+sp_tail:
+ udf_func_type remember_name FUNCTION_SYM sp_name
+ {
+ LEX *lex=Lex;
+ lex->udf.type= $1;
+ lex->stmt_definition_begin= $2;
+ lex->spname= $4;
+ }
+ create_function_tail
+ {}
+ | PROCEDURE remember_name sp_name
+ {
+ LEX *lex= Lex;
+ sp_head *sp;
+
+ if (lex->sphead)
+ {
+ my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "PROCEDURE");
+ YYABORT;
+ }
+
+ lex->stmt_definition_begin= $2;
+
+ /* Order is important here: new - reset - init */
+ sp= new sp_head();
+ sp->reset_thd_mem_root(YYTHD);
+ sp->init(lex);
+
+ sp->m_type= TYPE_ENUM_PROCEDURE;
+ lex->sphead= sp;
+ /*
+ * We have to turn of CLIENT_MULTI_QUERIES while parsing a
+ * stored procedure, otherwise yylex will chop it into pieces
+ * at each ';'.
+ */
+ $<ulong_num>$= YYTHD->client_capabilities & CLIENT_MULTI_QUERIES;
+ YYTHD->client_capabilities &= (~CLIENT_MULTI_QUERIES);
+ }
+ '('
+ {
+ LEX *lex= Lex;
+
+ lex->sphead->m_param_begin= lex->tok_start+1;
+ }
+ sp_pdparam_list
+ ')'
+ {
+ LEX *lex= Lex;
+
+ lex->sphead->m_param_end= lex->tok_start;
+ bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
+ }
+ sp_c_chistics
+ {
+ LEX *lex= Lex;
+
+ lex->sphead->m_chistics= &lex->sp_chistics;
+ lex->sphead->m_body_begin= lex->tok_start;
+ }
+ sp_proc_stmt
+ {
+ LEX *lex= Lex;
+ sp_head *sp= lex->sphead;
+
+ if (sp->check_backpatch(YYTHD))
+ YYABORT;
+ sp->init_strings(YYTHD, lex, $3);
+ lex->sql_command= SQLCOM_CREATE_PROCEDURE;
+ /*
+ Restore flag if it was cleared above
+ Be careful with counting. the block where we save the value
+ is $4.
+ */
+ YYTHD->client_capabilities |= $<ulong_num>4;
+ sp->restore_thd_mem_root(YYTHD);
}
;
--- 1.30/sql/event.h 2006-02-28 21:21:56 +01:00
+++ 1.31/sql/event.h 2006-03-27 11:38:23 +02:00
@@ -40,7 +40,6 @@
#define EVENT_EXEC_NO_MORE (1L << 0)
#define EVENT_NOT_USED (1L << 1)
-
extern ulong opt_event_executor;
enum enum_event_on_completion
@@ -208,6 +207,39 @@ public:
bool killed;
ulong event_thread_id;
+ static void *operator new(size_t size)
+ {
+ void *p;
+ DBUG_ENTER("Event_timed::new(size)");
+ p= my_malloc(size, MYF(0));
+ DBUG_PRINT("info", ("alloc_ptr=0x%lx", p));
+ DBUG_RETURN(p);
+ }
+
+ static void *operator new(size_t size, MEM_ROOT *mem_root)
+ { return (void*) alloc_root(mem_root, (uint) size); }
+
+ static void operator delete(void *ptr, size_t size)
+ {
+ DBUG_ENTER("Event_timed::delete(ptr,size)");
+ DBUG_PRINT("enter", ("free_ptr=0x%lx", ptr));
+ TRASH(ptr, size);
+ my_free((gptr) ptr, MYF(0));
+ DBUG_VOID_RETURN;
+ }
+
+ static void operator delete(void *ptr, MEM_ROOT *mem_root)
+ {
+ /*
+ Don't free the memory it will be done by the mem_root but
+ we need to call the destructor because we free other resources
+ which are not allocated on the root but on the heap, or we
+ deinit mutexes.
+ */
+ DBUG_ASSERT(0);
+ }
+
+
Event_timed():in_spawned_thread(0),locked_by_thread_id(0),
running(0), status_changed(false),
last_executed_changed(false), ident(), expression(0), created(0),
@@ -223,17 +255,26 @@ public:
}
~Event_timed()
- {
- pthread_mutex_lock(&this->LOCK_running);
+ {
+ deinit_mutexes();
+
if (free_sphead_on_delete)
free_sp();
- pthread_mutex_unlock(&this->LOCK_running);
- pthread_mutex_destroy(&this->LOCK_running);
}
-
void
init();
+
+ void
+ deinit_mutexes()
+ {
+ pthread_mutex_lock(&this->LOCK_running);
+
+ if (free_sphead_on_delete)
+ free_sp();
+ pthread_mutex_unlock(&this->LOCK_running);
+ pthread_mutex_destroy(&this->LOCK_running);
+ }
int
init_execute_at(THD *thd, Item *expr);
--- 1.40/sql/event_executor.cc 2006-02-28 21:21:56 +01:00
+++ 1.41/sql/event_executor.cc 2006-03-27 11:38:23 +02:00
@@ -280,7 +280,7 @@ init_event_thread(THD* thd)
my_net_init(&thd->net, 0);
thd->net.read_timeout = slave_net_timeout;
thd->slave_thread= 0;
- thd->options= OPTION_AUTO_IS_NULL;
+ thd->options|= OPTION_AUTO_IS_NULL;
thd->client_capabilities= CLIENT_LOCAL_FILES;
thd->real_id=pthread_self();
VOID(pthread_mutex_lock(&LOCK_thread_count));
@@ -336,7 +336,7 @@ executor_wait_till_next_event_exec(THD *
element in the queue.
*/
VOID(pthread_mutex_lock(&LOCK_event_arrays));
- if (!EVEX_EQ_NAME.elements)
+ if (!evex_queue_num_elements(EVEX_EQ_NAME))
{
VOID(pthread_mutex_unlock(&LOCK_event_arrays));
DBUG_RETURN(WAIT_STATUS_EMPTY_QUEUE);
@@ -366,21 +366,28 @@ executor_wait_till_next_event_exec(THD *
t2sleep*=10;
if (t2sleep > 0)
{
+ ulonglong modified= et->modified;
/*
We sleep t2sleep seconds but we check every second whether this thread
has been killed, or there is a new candidate
*/
while (t2sleep-- && !thd->killed && event_executor_running_global_var &&
- EVEX_EQ_NAME.elements && !et->killed &&
- (new_top= (et==evex_queue_first_element(&EVEX_EQ_NAME,Event_timed*))))
+ evex_queue_num_elements(EVEX_EQ_NAME) &&
+ (evex_queue_first_element(&EVEX_EQ_NAME, Event_timed*) == et &&
+ evex_queue_first_element(&EVEX_EQ_NAME, Event_timed*)->modified ==
+ modified))
{
- DBUG_PRINT("evex main thread", ("will sleep a bit more"));
+ DBUG_PRINT("evex main thread",("will sleep a bit more."));
my_sleep(100000);
}
+ DBUG_PRINT("info",("saved_modified=%llu current=%llu", modified,
+ evex_queue_num_elements(EVEX_EQ_NAME)?
+ evex_queue_first_element(&EVEX_EQ_NAME, Event_timed*)->modified:
+ (ulonglong)~0));
}
int ret= WAIT_STATUS_READY;
- if (!EVEX_EQ_NAME.elements)
+ if (!evex_queue_num_elements(EVEX_EQ_NAME))
ret= WAIT_STATUS_EMPTY_QUEUE;
else if (evex_queue_first_element(&EVEX_EQ_NAME, Event_timed*) != et)
ret= WAIT_STATUS_NEW_TOP_EVENT;
@@ -503,7 +510,7 @@ event_executor_main(void *arg)
break;
}
- if (!EVEX_EQ_NAME.elements)
+ if (!evex_queue_num_elements(EVEX_EQ_NAME))
{
my_sleep(100000);// sleep 0.1s
continue;
@@ -534,7 +541,7 @@ restart_ticking:
thd->end_time();
my_tz_UTC->gmt_sec_to_TIME(&time_now, thd->query_start());
- if (!EVEX_EQ_NAME.elements)
+ if (!evex_queue_num_elements(EVEX_EQ_NAME))
{
VOID(pthread_mutex_unlock(&LOCK_event_arrays));
DBUG_PRINT("evex main thread",("empty queue"));
@@ -632,7 +639,7 @@ finish:
*/
sql_print_information("SCHEDULER: Emptying the queue.");
VOID(pthread_mutex_lock(&LOCK_event_arrays));
- for (i= 0; i < EVEX_EQ_NAME.elements; ++i)
+ for (i= 0; i < evex_queue_num_elements(EVEX_EQ_NAME); ++i)
{
Event_timed *et= evex_queue_element(&EVEX_EQ_NAME, i, Event_timed*);
et->free_sp();
--- 1.45/sql/event_timed.cc 2006-03-27 10:58:31 +02:00
+++ 1.46/sql/event_timed.cc 2006-03-27 11:38:23 +02:00
@@ -14,13 +14,14 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#define MYSQL_LEX 1
#include "event_priv.h"
#include "event.h"
#include "sp.h"
-extern int yyparse(void *thd);
+extern int MYSQLparse(void *thd);
/*
@@ -207,6 +208,7 @@ Event_timed::init_execute_at(THD *thd, I
{
my_bool not_used;
TIME ltime;
+ my_time_t t;
TIME time_tmp;
DBUG_ENTER("Event_timed::init_execute_at");
@@ -230,12 +232,18 @@ Event_timed::init_execute_at(THD *thd, I
TIME_to_ulonglong_datetime(&time_tmp))
DBUG_RETURN(EVEX_BAD_PARAMS);
-
/*
This may result in a 1970-01-01 date if ltime is > 2037-xx-xx.
CONVERT_TZ has similar problem.
+ mysql_priv.h currently lists
+ #define TIMESTAMP_MAX_YEAR 2038 (see TIME_to_timestamp())
*/
- my_tz_UTC->gmt_sec_to_TIME(<ime, TIME_to_timestamp(thd,<ime, ¬_used));
+ my_tz_UTC->gmt_sec_to_TIME(<ime,t=TIME_to_timestamp(thd,<ime,¬_used));
+ if (!t)
+ {
+ DBUG_PRINT("error", ("Execute AT after year 2037"));
+ DBUG_RETURN(ER_WRONG_VALUE);
+ }
execute_at_null= FALSE;
execute_at= ltime;
@@ -358,6 +366,7 @@ Event_timed::init_interval(THD *thd, Ite
RETURNS
0 OK
EVEX_PARSE_ERROR fix_fields failed
+ EVEX_BAD_PARAMS starts before now
*/
int
@@ -365,6 +374,7 @@ Event_timed::init_starts(THD *thd, Item
{
my_bool not_used;
TIME ltime, time_tmp;
+ my_time_t t;
DBUG_ENTER("Event_timed::init_starts");
@@ -385,10 +395,17 @@ Event_timed::init_starts(THD *thd, Item
DBUG_RETURN(EVEX_BAD_PARAMS);
/*
- This may result in a 1970-01-01 date if ltime is > 2037-xx-xx
- CONVERT_TZ has similar problem
+ This may result in a 1970-01-01 date if ltime is > 2037-xx-xx.
+ CONVERT_TZ has similar problem.
+ mysql_priv.h currently lists
+ #define TIMESTAMP_MAX_YEAR 2038 (see TIME_to_timestamp())
*/
- my_tz_UTC->gmt_sec_to_TIME(<ime, TIME_to_timestamp(thd, <ime, ¬_used));
+ my_tz_UTC->gmt_sec_to_TIME(<ime,t=TIME_to_timestamp(thd, <ime, ¬_used));
+ if (!t)
+ {
+ DBUG_PRINT("error", ("STARTS after year 2037"));
+ DBUG_RETURN(EVEX_BAD_PARAMS);
+ }
starts= ltime;
starts_null= FALSE;
@@ -415,6 +432,7 @@ Event_timed::init_starts(THD *thd, Item
RETURNS
0 OK
EVEX_PARSE_ERROR fix_fields failed
+ ER_WRONG_VALUE starts distant date (after year 2037)
EVEX_BAD_PARAMS ENDS before STARTS
*/
@@ -423,6 +441,7 @@ Event_timed::init_ends(THD *thd, Item *n
{
TIME ltime, ltime_now;
my_bool not_used;
+ my_time_t t;
DBUG_ENTER("Event_timed::init_ends");
@@ -434,11 +453,18 @@ Event_timed::init_ends(THD *thd, Item *n
DBUG_RETURN(EVEX_BAD_PARAMS);
/*
- This may result in a 1970-01-01 date if ltime is > 2037-xx-xx ?
- CONVERT_TZ has similar problem ?
+ This may result in a 1970-01-01 date if ltime is > 2037-xx-xx.
+ CONVERT_TZ has similar problem.
+ mysql_priv.h currently lists
+ #define TIMESTAMP_MAX_YEAR 2038 (see TIME_to_timestamp())
*/
DBUG_PRINT("info", ("get the UTC time"));
- my_tz_UTC->gmt_sec_to_TIME(<ime, TIME_to_timestamp(thd, <ime, ¬_used));
+ my_tz_UTC->gmt_sec_to_TIME(<ime,t=TIME_to_timestamp(thd, <ime, ¬_used));
+ if (!t)
+ {
+ DBUG_PRINT("error", ("ENDS after year 2037"));
+ DBUG_RETURN(EVEX_BAD_PARAMS);
+ }
/* Check whether ends is after starts */
DBUG_PRINT("info", ("ENDS after STARTS?"));
@@ -1080,8 +1106,6 @@ Event_timed::get_create_event(THD *thd,
DBUG_RETURN(EVEX_MICROSECOND_UNSUP);
buf->append(STRING_WITH_LEN("CREATE EVENT "));
- append_identifier(thd, buf, ident.dbname.str, ident.dbname.length);
- buf->append('.');
append_identifier(thd, buf, ident.name.str, ident.name.length);
buf->append(STRING_WITH_LEN(" ON SCHEDULE "));
@@ -1167,19 +1191,28 @@ Event_timed::execute(THD *thd, MEM_ROOT
goto done;
/* Now we are sure we have valid this->sphead so we can copy the context */
sphead->m_security_ctx= security_ctx;
+ /*
+ THD::~THD will clean this or if there is DROP DATABASE in the SP then
+ it will be free there. It should not point to our buffer which is allocated
+ on a mem_root.
+ */
thd->db= my_strdup(ident.dbname.str, MYF(0));
thd->db_length= ident.dbname.length;
- if (!check_access(thd, EVENT_ACL, ident.dbname.str, 0, 0, 0,
+ if (!check_access(thd, EVENT_ACL,ident.dbname.str, 0, 0, 0,
is_schema_db(ident.dbname.str)))
{
List<Item> empty_item_list;
empty_item_list.empty();
+ if (thd->enable_slow_log)
+ sphead->m_flags|= sp_head::LOG_SLOW_STATEMENTS;
+ sphead->m_flags|= sp_head::LOG_GENERAL_LOG;
+
ret= sphead->execute_procedure(thd, &empty_item_list);
}
else
{
- DBUG_PRINT("error", ("%s has no rights on %s", ident.definer.str,
- ident.dbname.str));
+ DBUG_PRINT("error", ("%s@%s has no rights on %s", definer_user.str,
+ definer_host.str, dbname.str));
ret= -99;
}
restore_security_context(thd, save_ctx);
@@ -1228,12 +1261,12 @@ Event_timed::change_security_context(THD
definer_host.str, ident.dbname.str))
{
my_error(ER_NO_SUCH_USER, MYF(0), definer_user.str, definer_host.str);
- DBUG_RETURN(TRUE);
+ DBUG_RETURN(true);
}
*backup= thd->security_ctx;
thd->security_ctx= s_ctx;
#endif
- DBUG_RETURN(FALSE);
+ DBUG_RETURN(false);
}
@@ -1243,7 +1276,7 @@ Event_timed::change_security_context(THD
Event_timed::restore_security_context()
thd - thread
backup - switch to this context
- */
+*/
void
Event_timed::restore_security_context(THD *thd, Security_context *backup)
@@ -1337,7 +1370,7 @@ Event_timed::compile(THD *thd, MEM_ROOT
thd->lex= &lex;
lex_start(thd, (uchar*)thd->query, thd->query_length);
lex.et_compile_phase= TRUE;
- if (yyparse((void *)thd) || thd->is_fatal_error)
+ if (MYSQLparse((void *)thd) || thd->is_fatal_error)
{
DBUG_PRINT("error", ("error during compile or thd->is_fatal_error=%d",
thd->is_fatal_error));
@@ -1361,16 +1394,14 @@ Event_timed::compile(THD *thd, MEM_ROOT
sphead= lex.et->sphead;
sphead->m_db= ident.dbname;
- /*
- Copy also chistics since they will vanish otherwise we get 0x0 pointer
- */
sphead->set_definer(ident.definer.str, ident.definer.length);
sphead->set_info(0, 0, &lex.sp_chistics, sql_mode);
sphead->optimize();
ret= 0;
done:
lex.et->free_sphead_on_delete= false;
- delete lex.et;
+ lex.et->deinit_mutexes();
+
lex_end(&lex);
DBUG_PRINT("note", ("return old data on its place. set back NAMES"));
--- 1.87/mysql-test/t/disabled.def 2006-02-28 16:16:01 +01:00
+++ 1.88/mysql-test/t/disabled.def 2006-03-27 11:38:23 +02:00
@@ -9,33 +9,37 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
+events_bugs : test case unstable (race conditions). andrey will fix
+events_stress : test case unstable. andrey will fix
+events : test case unstable. andrey will fix
#ndb_alter_table_row : sometimes wrong error 1015!=1046
-#events_bugs : test case unstable (race conditions). andrey will fix
-#events_stress : test case unstable. andrey will fix
-#events : test case unstable. andrey will fix
ndb_autodiscover : Needs to be fixed w.r.t binlog
ndb_autodiscover2 : Needs to be fixed w.r.t binlog
-ndb_binlog_basic : Results are not deterministic, Tomas will fix
-ndb_binlog_ddl_multi : Bug#17038 [PATCH PENDING]
+#ndb_binlog_basic : Results are not deterministic, Tomas will fix
+ndb_binlog_ddl_multi : Bug #18490 cluster: binlog events lost on remote mysqld (asynchronous)
+#ndb_binlog_multi : Results are not deterministic, Tomas will fix
ndb_load : Bug#17233
partition_03ndb : Bug#16385
ps_7ndb : dbug assert in RBR mode when executing test suite
-rpl_bit_npk : Bug#13418
-rpl_ddl : Bug#15963 SBR does not show "Definer" correctly
-rpl_ndb_2innodb : Bugs#17400, 17687, 17701
-rpl_ndb_2myisam : Bugs#17400, 17687, 17701
+#rpl_bit_npk : Bug#13418
+#rpl_ddl : Bug#15963 SBR does not show "Definer" correctly
+rpl_ndb_2innodb : assertion in get_parts_for_update()
+rpl_ndb_2myisam : assertion in get_parts_for_update()
rpl_ndb_auto_inc : Bug#17086
-rpl_ndb_basic : Bug#16228 [IN REVIEW]
-rpl_ndb_charset : Bug#17246
-rpl_ndb_ddl : Bug#17400: delete & update of rows in table without pk fails
-rpl_ndb_delete_nowhere : Bug#17400: delete & update of rows in table without pk fails
-rpl_ndb_innodb2ndb : Bugs#17400, 17687, 17701
-rpl_ndb_insert_ignore : Bugs: #17431: INSERT IGNORE INTO returns failed: 1296
-rpl_ndb_myisam2ndb : Bugs#17400, 17687, 17701
-rpl_ndb_log : result not deterministic
+#rpl_ndb_basic : Bug#16228 [IN REVIEW]
+#rpl_ndb_blob : interferes with following tests, causing hang
+#rpl_ndb_blob2 : interferes with following tests, causing hang
+rpl_ndb_ddl : master hangs
+#rpl_ndb_delete_nowhere : Bug#17400: delete & update of rows in table without pk fails
+rpl_ndb_innodb2ndb : Bug#18261: Cluster Replication: tests rpl_ndb_xxx2ndb fails
+rpl_ndb_myisam2ndb : Bug#18261: Cluster Replication: tests rpl_ndb_xxx2ndb fails
+rpl_ndb_log : result not deterministic, TBD if should remove
rpl_ndb_relay_space : Bug#16993
-rpl_ndb_multi_update3 : Bug#17400: delete & update of rows in table without pk fails
-rpl_ndb_sp007 : Bug #17290
+#rpl_ndb_multi_update3 : Bug#17400: delete & update of rows in table without pk fails
+#rpl_ndb_sp007 : Bug #17290
+rpl_row_inexist_tbl : Disabled since patch makes this test wait forever
rpl_sp : Bug#16456
rpl_until : Unstable test case, bug#15886
sp-goto : GOTO is currently is disabled - will be fixed in the future
+mysqldump : BUG#18078
+udf : Need to check if udf_example.so has been built
| Thread |
|---|
| • bk commit into 5.1 tree (andrey:1.2233) | ahristov | 27 Mar |