summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorAlexander Nozdrin <alexander.nozdrin@oracle.com>2011-10-24 13:21:32 +0400
committerAlexander Nozdrin <alexander.nozdrin@oracle.com>2011-10-24 13:21:32 +0400
commit5f99ed499791fe1ba3ae6fd3a930f255a4cd31eb (patch)
treeaeb384da78f8c6c7c36b7bb2d304bf5fa5f98199 /sql
parentb3d0054308d705aa582ad28a08363fdfa8212b56 (diff)
parentae3dead08938b7e3dbb1b352ddd551f2b18d18a6 (diff)
downloadmariadb-git-5f99ed499791fe1ba3ae6fd3a930f255a4cd31eb.tar.gz
Auto-merge from mysql-5.5.
Diffstat (limited to 'sql')
-rw-r--r--sql/item.h2
-rw-r--r--sql/item_sum.cc25
-rw-r--r--sql/item_sum.h1
-rw-r--r--sql/sql_base.cc7
-rw-r--r--sql/sql_repl.cc13
5 files changed, 44 insertions, 4 deletions
diff --git a/sql/item.h b/sql/item.h
index 3fa0f4bb50b..223a519fa33 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -592,7 +592,7 @@ public:
void init_make_field(Send_field *tmp_field,enum enum_field_types type);
virtual void cleanup();
virtual void make_field(Send_field *field);
- Field *make_string_field(TABLE *table);
+ virtual Field *make_string_field(TABLE *table);
virtual bool fix_fields(THD *, Item **);
/*
should be used in case where we are sure that we do not need
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 161c8c8eacf..d9e634f8c16 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -3128,6 +3128,31 @@ void Item_func_group_concat::cleanup()
}
+Field *Item_func_group_concat::make_string_field(TABLE *table)
+{
+ Field *field;
+ DBUG_ASSERT(collation.collation);
+ /*
+ max_characters is maximum number of characters
+ what can fit into max_length size. It's necessary
+ to use field size what allows to store group_concat
+ result without truncation. For this purpose we use
+ max_characters * CS->mbmaxlen.
+ */
+ const uint32 max_characters= max_length / collation.collation->mbminlen;
+ if (max_characters > CONVERT_IF_BIGGER_TO_BLOB)
+ field= new Field_blob(max_characters * collation.collation->mbmaxlen,
+ maybe_null, name, collation.collation, TRUE);
+ else
+ field= new Field_varstring(max_characters * collation.collation->mbmaxlen,
+ maybe_null, name, table->s, collation.collation);
+
+ if (field)
+ field->init(table);
+ return field;
+}
+
+
Item *Item_func_group_concat::copy_or_same(THD* thd)
{
return new (thd->mem_root) Item_func_group_concat(thd, this);
diff --git a/sql/item_sum.h b/sql/item_sum.h
index c303385c535..a0b54b0ec8a 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -1411,6 +1411,7 @@ public:
enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;}
const char *func_name() const { return "group_concat"; }
virtual Item_result result_type () const { return STRING_RESULT; }
+ virtual Field *make_string_field(TABLE *table);
enum_field_types field_type() const
{
if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB )
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 644796ea337..e0472e2c9b5 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -4810,10 +4810,11 @@ bool open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags,
}
/*
- temporary mem_root for new .frm parsing.
- TODO: variables for size
+ Initialize temporary MEM_ROOT for new .FRM parsing. Do not allocate
+ anything yet, to avoid penalty for statements which don't use views
+ and thus new .FRM format.
*/
- init_sql_alloc(&new_frm_mem, 8024, 8024);
+ init_sql_alloc(&new_frm_mem, 8024, 0);
thd->current_tablenr= 0;
restart:
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index a37e8700e4f..80fef42434c 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -720,6 +720,19 @@ impossible position";
else if (event_type == STOP_EVENT)
binlog_can_be_corrupted= FALSE;
+ /*
+ Introduced this code to make the gcc 4.6.1 compiler happy. When
+ warnings are converted to errors, the compiler complains about
+ the fact that binlog_can_be_corrupted is defined but never used.
+
+ We need to check if this is a dead code or if someone removed any
+ code by mistake.
+
+ /Alfranio
+ */
+ if (binlog_can_be_corrupted)
+ sql_print_information("The binlog may be corrupted.");
+
pos = my_b_tell(&log);
if (RUN_HOOK(binlog_transmit, before_send_event,
(thd, flags, packet, log_file_name, pos)))