summaryrefslogtreecommitdiff
path: root/sql/unireg.cc
diff options
context:
space:
mode:
authorunknown <igor@rurik.mysql.com>2006-09-20 09:47:36 -0700
committerunknown <igor@rurik.mysql.com>2006-09-20 09:47:36 -0700
commit54bb1045ca5fdcba99c3f8f8dfcb6a7139917614 (patch)
treed2f8ab56ede9c4ab30a543b216cb72e1fb56d4d7 /sql/unireg.cc
parentc358e322f8e63037154927ef168212857ff52629 (diff)
parent0f50a8a7fea053127f236ca4956bba58370a8d81 (diff)
downloadmariadb-git-54bb1045ca5fdcba99c3f8f8dfcb6a7139917614.tar.gz
Merge rurik.mysql.com:/home/igor/mysql-4.1-opt
into rurik.mysql.com:/home/igor/mysql-5.0-opt mysql-test/r/ctype_ucs.result: Auto merged mysql-test/t/ctype_ucs.test: Auto merged sql/field.h: Auto merged sql/unireg.cc: Auto merged
Diffstat (limited to 'sql/unireg.cc')
-rw-r--r--sql/unireg.cc39
1 files changed, 32 insertions, 7 deletions
diff --git a/sql/unireg.cc b/sql/unireg.cc
index 3a139aea4c7..93afd9c9e4e 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -228,13 +228,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);
@@ -514,18 +520,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];
hex_length= length * 2;
field->interval->type_lengths[pos]= hex_length;
field->interval->type_names[pos]= dst= sql_alloc(hex_length + 1);
@@ -777,7 +801,8 @@ static bool make_empty_rec(THD *thd, 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);
if (!regfield)