summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2010-08-20 12:09:17 +0300
committerGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2010-08-20 12:09:17 +0300
commit7d3a9b4cf68475f24b24f64ae43a205d6016b83e (patch)
treed7d20b0fb3455280191417a9653848ff8d25442e /sql
parentdd9329761ae48e3d8518f882d1ca12737a4165d0 (diff)
parent69c280506808e434e20669d838724d43b675540c (diff)
downloadmariadb-git-7d3a9b4cf68475f24b24f64ae43a205d6016b83e.tar.gz
merge
Diffstat (limited to 'sql')
-rw-r--r--sql/item_func.cc2
-rw-r--r--sql/item_sum.cc19
-rw-r--r--sql/log.cc13
-rw-r--r--sql/log.h3
-rw-r--r--sql/sql_insert.cc11
-rw-r--r--sql/sql_table.cc5
-rw-r--r--sql/table.h1
7 files changed, 51 insertions, 3 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 1bec4700bff..1b13297c951 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2243,6 +2243,8 @@ void Item_func_min_max::fix_length_and_dec()
max_length= my_decimal_precision_to_length_no_truncation(max_int_part +
decimals, decimals,
unsigned_flag);
+ else if (cmp_type == REAL_RESULT)
+ max_length= float_length(decimals);
cached_field_type= agg_field_type(args, arg_count);
}
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index f92bde9ce87..25b3bd5d91d 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -3035,7 +3035,6 @@ Item_func_group_concat::Item_func_group_concat(THD *thd,
tree(item->tree),
unique_filter(item->unique_filter),
table(item->table),
- order(item->order),
context(item->context),
arg_count_order(item->arg_count_order),
arg_count_field(item->arg_count_field),
@@ -3048,6 +3047,24 @@ Item_func_group_concat::Item_func_group_concat(THD *thd,
{
quick_group= item->quick_group;
result.set_charset(collation.collation);
+
+ /*
+ Since the ORDER structures pointed to by the elements of the 'order' array
+ may be modified in find_order_in_list() called from
+ Item_func_group_concat::setup(), create a copy of those structures so that
+ such modifications done in this object would not have any effect on the
+ object being copied.
+ */
+ ORDER *tmp;
+ if (!(order= (ORDER **) thd->alloc(sizeof(ORDER *) * arg_count_order +
+ sizeof(ORDER) * arg_count_order)))
+ return;
+ tmp= (ORDER *)(order + arg_count_order);
+ for (uint i= 0; i < arg_count_order; i++, tmp++)
+ {
+ memcpy(tmp, item->order[i], sizeof(ORDER));
+ order[i]= tmp;
+ }
}
diff --git a/sql/log.cc b/sql/log.cc
index 614a07e6b63..3f41bf1c929 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1628,6 +1628,19 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
DBUG_RETURN(error);
}
+/**
+ Cleanup the cache.
+
+ @param thd The client thread that wants to clean up the cache.
+*/
+void MYSQL_BIN_LOG::reset_gathered_updates(THD *thd)
+{
+ binlog_trx_data *const trx_data=
+ (binlog_trx_data*) thd_get_ha_data(thd, binlog_hton);
+
+ trx_data->reset();
+}
+
void MYSQL_BIN_LOG::set_write_error(THD *thd)
{
DBUG_ENTER("MYSQL_BIN_LOG::set_write_error");
diff --git a/sql/log.h b/sql/log.h
index 8d3880d9171..8f1ed7ee90c 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -356,10 +356,11 @@ public:
/* Use this to start writing a new log file */
void new_file();
+ void reset_gathered_updates(THD *thd);
bool write(Log_event* event_info); // binary log write
bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event, bool incident);
- bool write_incident(THD *thd, bool lock);
+ bool write_incident(THD *thd, bool lock);
int write_cache(IO_CACHE *cache, bool lock_log, bool flush_and_sync);
void set_write_error(THD *thd);
bool check_write_error(THD *thd);
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 8604f876f37..567c7ff2b30 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -3972,6 +3972,17 @@ void select_create::abort()
if (table)
{
+ if (thd->lex->sql_command == SQLCOM_CREATE_TABLE &&
+ thd->current_stmt_binlog_row_based &&
+ !(thd->lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) &&
+ mysql_bin_log.is_open())
+ {
+ /*
+ This should be removed after BUG#47899.
+ */
+ mysql_bin_log.reset_gathered_updates(thd);
+ }
+
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
if (!create_info->table_existed)
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index f765e5c5cae..d3ac2bf0f95 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -7393,6 +7393,11 @@ view_err:
mysql_unlock_tables(thd, thd->lock);
thd->lock=0;
}
+ /*
+ If LOCK TABLES list is not empty and contains this table,
+ unlock the table and remove the table from this list.
+ */
+ mysql_lock_remove(thd, thd->locked_tables, table, FALSE);
/* Remove link to old table and rename the new one */
close_temporary_table(thd, table, 1, 1);
/* Should pass the 'new_name' as we store table name in the cache */
diff --git a/sql/table.h b/sql/table.h
index 8ea7175eec4..bbb39aae6f7 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -55,7 +55,6 @@ typedef struct st_order {
struct st_order *next;
Item **item; /* Point at item in select fields */
Item *item_ptr; /* Storage for initial item */
- Item **item_copy; /* For SPs; the original item ptr */
int counter; /* position in SELECT list, correct
only if counter_used is true*/
bool asc; /* true if ascending */