summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-07-17 18:51:12 +0200
committerSergei Golubchik <sergii@pisem.net>2013-07-17 18:51:12 +0200
commitc1d6a2d7e194225ccc19a68ea5d0f368632620d0 (patch)
treebd13736fa139caac8c6e21484d2f03f6f0d30d57 /sql
parent1b82512914db8d5779395017e2ed4a66a48b561c (diff)
downloadmariadb-git-c1d6a2d7e194225ccc19a68ea5d0f368632620d0.tar.gz
merge few bug fixes from 5.6
Diffstat (limited to 'sql')
-rw-r--r--sql/events.cc25
-rw-r--r--sql/item_func.h5
-rw-r--r--sql/sql_table.cc14
3 files changed, 35 insertions, 9 deletions
diff --git a/sql/events.cc b/sql/events.cc
index b9c51b77f05..acf842dea44 100644
--- a/sql/events.cc
+++ b/sql/events.cc
@@ -808,7 +808,16 @@ Events::init(bool opt_noacl_or_bootstrap)
*/
thd->thread_stack= (char*) &thd;
thd->store_globals();
-
+ /*
+ Set current time for the thread that handles events.
+ Current time is stored in data member start_time of THD class.
+ Subsequently, this value is used to check whether event was expired
+ when make loading events from storage. Check for event expiration time
+ is done at Event_queue_element::compute_next_execution_time() where
+ event's status set to Event_parse_data::DISABLED and dropped flag set
+ to true if event was expired.
+ */
+ thd->set_time();
/*
We will need Event_db_repository anyway, even if the scheduler is
disabled - to perform events DDL.
@@ -1098,8 +1107,7 @@ Events::load_events_from_db(THD *thd)
while (!(read_record_info.read_record(&read_record_info)))
{
Event_queue_element *et;
- bool created;
- bool drop_on_completion;
+ bool created, dropped;
if (!(et= new Event_queue_element))
goto end;
@@ -1114,10 +1122,13 @@ Events::load_events_from_db(THD *thd)
delete et;
goto end;
}
- drop_on_completion= (et->on_completion ==
- Event_parse_data::ON_COMPLETION_DROP);
-
+ /**
+ Since the Event_queue_element object could be deleted inside
+ Event_queue::create_event we should save the value of dropped flag
+ into the temporary variable.
+ */
+ dropped= et->dropped;
if (event_queue->create_event(thd, et, &created))
{
/* Out of memory */
@@ -1126,7 +1137,7 @@ Events::load_events_from_db(THD *thd)
}
if (created)
count++;
- else if (drop_on_completion)
+ else if (dropped)
{
/*
If not created, a stale event - drop if immediately if
diff --git a/sql/item_func.h b/sql/item_func.h
index d7c065e56f3..28cda8c03d0 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -550,7 +550,10 @@ public:
longlong val_int();
longlong val_int_from_str(int *error);
void fix_length_and_dec()
- { fix_char_length(args[0]->max_char_length()); unsigned_flag=0; }
+ {
+ fix_char_length(MY_MIN(args[0]->max_char_length(), MY_INT64_NUM_DECIMAL_DIGITS));
+ unsigned_flag=0;
+ }
virtual void print(String *str, enum_query_type query_type);
uint decimal_precision() const { return args[0]->decimal_precision(); }
};
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 9a0fba6e9d7..db64c5afbc2 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -6613,6 +6613,12 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
if (def)
{ // Field is changed
def->field=field;
+ /*
+ Add column being updated to the list of new columns.
+ Note that columns with AFTER clauses are added to the end
+ of the list for now. Their positions will be corrected later.
+ */
+ new_create_list.push_back(def);
if (field->stored_in_db != def->stored_in_db)
{
my_error(ER_UNSUPPORTED_ACTION_ON_VIRTUAL_COLUMN, MYF(0));
@@ -6620,7 +6626,13 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
}
if (!def->after)
{
- new_create_list.push_back(def);
+ /*
+ If this ALTER TABLE doesn't have an AFTER clause for the modified
+ column then remove this column from the list of columns to be
+ processed. So later we can iterate over the columns remaining
+ in this list and process modified columns with AFTER clause or
+ add new columns.
+ */
def_it.remove();
}
}