summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <gkodinov@dl145s.mysql.com>2006-09-28 10:19:25 +0200
committerunknown <gkodinov@dl145s.mysql.com>2006-09-28 10:19:25 +0200
commitb8fe620615adb5a5ab6804689e5111b4d9952c2e (patch)
tree107adad7035c003c1c4f2ffd28f8e5c7547e0c89 /sql
parentabd883f4d02e6d32c4ac0446345bd27c2455db55 (diff)
parent2b59a97b11842a445b0351163c01dd44253fab27 (diff)
downloadmariadb-git-b8fe620615adb5a5ab6804689e5111b4d9952c2e.tar.gz
Merge dl145s.mysql.com:/data/bk/team_tree_merge/mysql-4.1
into dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-4.1-opt sql/sql_select.cc: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/field.h2
-rw-r--r--sql/item.cc1
-rw-r--r--sql/sql_select.cc5
-rw-r--r--sql/unireg.cc39
4 files changed, 38 insertions, 9 deletions
diff --git a/sql/field.h b/sql/field.h
index a33cb0a93aa..79fb7ff76d1 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1192,6 +1192,8 @@ public:
uint decimals,flags,pack_length;
Field::utype unireg_check;
TYPELIB *interval; // Which interval to use
+ TYPELIB *save_interval; // Temporary copy for the above
+ // Used only for UCS2 intervals
List<String> interval_list;
CHARSET_INFO *charset;
Field::geometry_type geom_type;
diff --git a/sql/item.cc b/sql/item.cc
index 7c9f6ec77fb..94f0a24fcc3 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -387,6 +387,7 @@ void Item::split_sum_func2(THD *thd, Item **ref_pointer_array,
}
else if ((type() == SUM_FUNC_ITEM ||
(used_tables() & ~PARAM_TABLE_BIT)) &&
+ type() != SUBSELECT_ITEM &&
type() != REF_ITEM)
{
/*
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 02ec7ae08ed..74a9fc573c4 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -290,8 +290,6 @@ JOIN::prepare(Item ***rref_pointer_array,
select_lex->having_fix_field= 0;
if (having_fix_rc || thd->net.report_error)
DBUG_RETURN(-1); /* purecov: inspected */
- if (having->with_sum_func)
- having->split_sum_func2(thd, ref_pointer_array, all_fields, &having);
}
// Is it subselect
@@ -306,6 +304,9 @@ JOIN::prepare(Item ***rref_pointer_array,
}
}
+ if (having && having->with_sum_func)
+ having->split_sum_func2(thd, ref_pointer_array, all_fields, &having);
+
if (setup_ftfuncs(select_lex)) /* should be after having->fix_fields */
DBUG_RETURN(-1);
diff --git a/sql/unireg.cc b/sql/unireg.cc
index e3bf763f700..e4fdc77912c 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -190,13 +190,19 @@ bool mysql_create_frm(THD *thd, my_string file_name,
goto err3;
{
- /* Unescape all UCS2 intervals: were escaped in pack_headers */
+ /*
+ Restore all UCS2 intervals.
+ HEX representation of them is not needed anymore.
+ */
List_iterator<create_field> it(create_fields);
create_field *field;
while ((field=it++))
{
- if (field->interval && field->charset->mbminlen > 1)
- unhex_type2(field->interval);
+ if (field->save_interval)
+ {
+ field->interval= field->save_interval;
+ field->save_interval= 0;
+ }
}
}
DBUG_RETURN(0);
@@ -452,18 +458,36 @@ static bool pack_header(uchar *forminfo, enum db_type table_type,
reclength=(uint) (field->offset+ data_offset + length);
n_length+= (ulong) strlen(field->field_name)+1;
field->interval_id=0;
+ field->save_interval= 0;
if (field->interval)
{
uint old_int_count=int_count;
if (field->charset->mbminlen > 1)
{
- /* Escape UCS2 intervals using HEX notation */
+ /*
+ Escape UCS2 intervals using HEX notation to avoid
+ problems with delimiters between enum elements.
+ As the original representation is still needed in
+ the function make_empty_rec to create a record of
+ filled with default values it is saved in save_interval
+ The HEX representation is created from this copy.
+ */
+ field->save_interval= field->interval;
+ field->interval= (TYPELIB*) sql_alloc(sizeof(TYPELIB));
+ *field->interval= *field->save_interval;
+ field->interval->type_names=
+ (const char **) sql_alloc(sizeof(char*) *
+ (field->interval->count+1));
+ field->interval->type_names[field->interval->count]= 0;
+ field->interval->type_lengths=
+ (uint *) sql_alloc(sizeof(uint) * field->interval->count);
+
for (uint pos= 0; pos < field->interval->count; pos++)
{
char *dst;
- uint length= field->interval->type_lengths[pos], hex_length;
- const char *src= field->interval->type_names[pos];
+ uint length= field->save_interval->type_lengths[pos], hex_length;
+ const char *src= field->save_interval->type_names[pos];
const char *srcend= src + length;
hex_length= length * 2;
field->interval->type_lengths[pos]= hex_length;
@@ -715,7 +739,8 @@ static bool make_empty_rec(File file,enum db_type table_type,
field->charset,
field->geom_type,
field->unireg_check,
- field->interval,
+ field->save_interval ? field->save_interval :
+ field->interval,
field->field_name,
&table);