1
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
1
/* Copyright (C) 2000-2006 MySQL AB
3
3
This program is free software; you can redistribute it and/or modify
4
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; either version 2 of the License, or
6
(at your option) any later version.
5
the Free Software Foundation; version 2 of the License.
8
7
This program is distributed in the hope that it will be useful,
9
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
715
714
if (field->interval_id > int_count)
717
int_count=field->interval_id;
718
tmp.append(NAMES_SEP_CHAR);
719
for (const char **pos=field->interval->type_names ; *pos ; pos++)
721
char *val= (char*) *pos;
722
uint str_len= strlen(val);
724
Note, hack: in old frm NAMES_SEP_CHAR is used to separate
725
names in the interval (ENUM/SET). To allow names to contain
726
NAMES_SEP_CHAR, we replace it with a comma before writing frm.
727
Backward conversion is done during frm file opening,
728
See table.cc, openfrm() function
730
for (uint cnt= 0 ; cnt < str_len ; cnt++)
733
if (c == NAMES_SEP_CHAR)
737
tmp.append(NAMES_SEP_CHAR);
739
tmp.append('\0'); // End of intervall
716
unsigned char sep= 0;
717
unsigned char occ[256];
719
unsigned char *val= NULL;
721
bzero(occ, sizeof(occ));
723
for (i=0; (val= (unsigned char*) field->interval->type_names[i]); i++)
724
for (uint j = 0; j < field->interval->type_lengths[i]; j++)
725
occ[(unsigned int) (val[j])]= 1;
727
if (!occ[(unsigned char)NAMES_SEP_CHAR])
728
sep= (unsigned char) NAMES_SEP_CHAR;
729
else if (!occ[(unsigned int)','])
733
for (uint i=1; i<256; i++)
742
if(!sep) /* disaster, enum uses all characters, none left as separator */
744
my_message(ER_WRONG_FIELD_TERMINATORS,ER(ER_WRONG_FIELD_TERMINATORS),
750
int_count= field->interval_id;
752
for (const char **pos=field->interval->type_names ; *pos ; pos++)
757
tmp.append('\0'); // End of intervall
742
760
if (my_write(file,(byte*) tmp.ptr(),tmp.length(),MYF_RW))