Commit 731b8392 authored by bar@bar.mysql.r18.ru's avatar bar@bar.mysql.r18.ru

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

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