Commit 5f257a1b authored by unknown's avatar unknown

Charset number is now stored into error.sys by comp_err and loaded by mysqld.

parent d47e94fb
......@@ -42,11 +42,12 @@ static int copy_rows(FILE *to);
int main(int argc,char *argv[])
{
uint csnum= 0;
int i,error,files,length;
uchar head[32];
FILE *from,*to;
MY_INIT(argv[0]);
get_options(&argc,&argv);
error=1;
row_count=files=0;
......@@ -70,6 +71,13 @@ int main(int argc,char *argv[])
goto end;
}
if (!(csnum= get_charset_number(charset_name, MY_CS_PRIMARY)))
{
fprintf(stderr,"Unknown character '%s' in '%s'\n",charset_name, *argv);
fclose(from);
goto end;
}
if (remember_rows(from,'}') < 0) /* Remember rows */
{
fprintf(stderr,"Can't find textrows in '%s'\n",*argv);
......@@ -100,7 +108,8 @@ int main(int argc,char *argv[])
{
int2store(head+10+i+i,file_row_pos[i]);
}
head[30]= csnum;
fseek(to,0l,0);
if (fwrite(head,1,32,to) != 32)
goto end;
......@@ -144,7 +153,6 @@ static void get_options(register int *argc,register char **argv[])
printf("%s (Compile errormessage) Ver 1.3\n",progname);
break;
case 'C':
printf("pos=%s\n", pos+1);
charsets_dir= pos+1;
*(pos--)= '\0';
break;
......
......@@ -209,8 +209,10 @@ extern CHARSET_INFO *default_charset_info;
extern CHARSET_INFO *all_charsets[256];
extern CHARSET_INFO compiled_charsets[];
extern uint get_charset_number(const char *cs_name);
extern uint get_charset_number(const char *cs_name, uint cs_flags);
extern uint get_collation_number(const char *name);
extern const char *get_charset_name(uint cs_number);
extern CHARSET_INFO *get_charset(uint cs_number, myf flags);
extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags);
extern CHARSET_INFO *get_charset_by_csname(const char *cs_name,
......
......@@ -278,7 +278,7 @@ static my_bool simple_cs_is_full(CHARSET_INFO *cs)
static int add_collation(CHARSET_INFO *cs)
{
if (cs->name && (cs->number || (cs->number=get_charset_number(cs->name))))
if (cs->name && (cs->number || (cs->number=get_collation_number(cs->name))))
{
if (!all_charsets[cs->number])
{
......@@ -513,7 +513,7 @@ void free_charsets(void)
}
uint get_charset_number(const char *charset_name)
uint get_collation_number(const char *name)
{
CHARSET_INFO **cs;
if (init_available_charsets(MYF(0))) /* If it isn't initialized */
......@@ -522,12 +522,27 @@ uint get_charset_number(const char *charset_name)
for (cs= all_charsets; cs < all_charsets+255; ++cs)
{
if ( cs[0] && cs[0]->name &&
!my_strcasecmp(&my_charset_latin1, cs[0]->name, charset_name))
!my_strcasecmp(&my_charset_latin1, cs[0]->name, name))
return cs[0]->number;
}
return 0; /* this mimics find_type() */
}
uint get_charset_number(const char *charset_name, uint cs_flags)
{
CHARSET_INFO **cs;
if (init_available_charsets(MYF(0))) /* If it isn't initialized */
return 0;
for (cs= all_charsets; cs < all_charsets+255; ++cs)
{
if ( cs[0] && cs[0]->csname && (cs[0]->state & cs_flags) &&
!my_strcasecmp(&my_charset_latin1, cs[0]->csname, charset_name))
return cs[0]->number;
}
return 0;
}
const char *get_charset_name(uint charset_number)
{
......@@ -593,7 +608,7 @@ CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags)
CHARSET_INFO *cs;
(void) init_available_charsets(MYF(0)); /* If it isn't initialized */
cs_number=get_charset_number(cs_name);
cs_number=get_collation_number(cs_name);
cs= cs_number ? get_internal_charset(cs_number,flags) : NULL;
if (!cs && (flags & MY_WME))
......@@ -611,23 +626,15 @@ CHARSET_INFO *get_charset_by_csname(const char *cs_name,
uint cs_flags,
myf flags)
{
CHARSET_INFO *cs=NULL;
CHARSET_INFO **css;
uint cs_number;
CHARSET_INFO *cs;
DBUG_ENTER("get_charset_by_csname");
DBUG_PRINT("enter",("name: '%s'", cs_name));
(void) init_available_charsets(MYF(0)); /* If it isn't initialized */
for (css= all_charsets; css < all_charsets+255; ++css)
{
if ( css[0] && (css[0]->state & cs_flags) &&
css[0]->csname && !my_strcasecmp(&my_charset_latin1,
css[0]->csname, cs_name))
{
cs= css[0]->number ? get_internal_charset(css[0]->number,flags) : NULL;
break;
}
}
cs_number= get_charset_number(cs_name, cs_flags);
cs= cs_number ? get_internal_charset(cs_number, flags) : NULL;
if (!cs && (flags & MY_WME))
{
......
......@@ -49,6 +49,7 @@ static void read_texts(const char *file_name,const char ***point,
char name[FN_REFLEN];
const char *buff;
uchar head[32],*pos;
CHARSET_INFO *cset;
DBUG_ENTER("read_texts");
*point=0; // If something goes wrong
......@@ -65,6 +66,13 @@ static void read_texts(const char *file_name,const char ***point,
head[2] != 2 || head[3] != 1)
goto err; /* purecov: inspected */
textcount=head[4];
if (!(cset= get_charset(head[30],MYF(MY_WME))))
{
funktpos= 3;
goto err;
}
length=uint2korr(head+6); count=uint2korr(head+8);
if (count < error_messages)
......@@ -104,6 +112,9 @@ Check that the above file is the right version for this program!",
err:
switch (funktpos) {
case 3:
buff="Character set is not supported for messagefile '%s'";
break;
case 2:
buff="Not enough memory for messagefile '%s'";
break;
......
......@@ -30,7 +30,7 @@ install-data-local:
fix_errors:
for lang in @AVAILABLE_LANGUAGES@; \
do \
../../extra/comp_err $(srcdir)/$$lang/errmsg.txt $(srcdir)/$$lang/errmsg.sys; \
../../extra/comp_err -C$(srcdir)/charsets/ $(srcdir)/$$lang/errmsg.txt $(srcdir)/$$lang/errmsg.sys; \
done
# Don't update the files from bitkeeper
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment