summaryrefslogtreecommitdiff
path: root/mysys/charset.c
diff options
context:
space:
mode:
authorunknown <bar@bar.mysql.r18.ru>2003-01-04 14:12:20 +0400
committerunknown <bar@bar.mysql.r18.ru>2003-01-04 14:12:20 +0400
commit782295137b513c45f83add72008b1bfbfde2502d (patch)
tree43f10d041f0f37a8e361f86eb0f69bdf64ef0864 /mysys/charset.c
parenta533a95c288e1a4b8ff24874f880ed1cc8d7dd9b (diff)
downloadmariadb-git-782295137b513c45f83add72008b1bfbfde2502d.tar.gz
Some changes to separate charset and collation terms
Diffstat (limited to 'mysys/charset.c')
-rw-r--r--mysys/charset.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/mysys/charset.c b/mysys/charset.c
index 3f650bbe14d..37dd484c58e 100644
--- a/mysys/charset.c
+++ b/mysys/charset.c
@@ -165,15 +165,24 @@ static int cs_leave(MY_XML_PARSER *st,const char *attr, uint len)
{
struct my_cs_file_info *i = (struct my_cs_file_info *)st->user_data;
struct my_cs_file_section_st *s = cs_file_sec(attr,len);
+ int state = s ? s->state : 0;
- if (s && (s->state == _CS_COLLATION) && !all_charsets[i->cs.number])
+ if (state == _CS_COLLATION)
{
- if (!(all_charsets[i->cs.number]=
+ if (!all_charsets[i->cs.number])
+ {
+ if (!(all_charsets[i->cs.number]=
(CHARSET_INFO*) my_once_alloc(sizeof(CHARSET_INFO),i->myflags)))
+ {
+ return MY_XML_ERROR;
+ }
+ all_charsets[i->cs.number][0]=i->cs;
+ }
+ else
{
- return MY_XML_ERROR;
+ all_charsets[i->cs.number]->state |= i->cs.state;
}
- all_charsets[i->cs.number][0]=i->cs;
+ i->cs.state=0;
}
return MY_XML_OK;
}
@@ -203,6 +212,16 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, uint len)
((char*)(i->cs.name))[len]='\0';
}
break;
+ case _CS_NAME:
+ if ((i->cs.csname = (char*) my_once_alloc(len+1,i->myflags)))
+ {
+ memcpy((char*)i->cs.csname,attr,len);
+ ((char*)(i->cs.csname))[len]='\0';
+ }
+ break;
+ case _CS_FLAG:
+ if (!strncmp("primary",attr,len))
+ i->cs.state |= MY_CS_PRIMARY;
}
return MY_XML_OK;
}