Commit b500a155 authored by unknown's avatar unknown

Added creation of mysqld_ername.h


extra/Makefile.am:
  Added rule for creating mysqld_ername.h
parent 0b842a55
...@@ -19,7 +19,7 @@ INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include \ ...@@ -19,7 +19,7 @@ INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include \
-I$(top_srcdir)/extra -I$(top_srcdir)/extra
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \ LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \
../dbug/libdbug.a ../strings/libmystrings.a ../dbug/libdbug.a ../strings/libmystrings.a
BUILT_SOURCES= mysqld_error.h sql_state.h BUILT_SOURCES= mysqld_error.h sql_state.h mysqld_ername.h
pkginclude_HEADERS= $(BUILT_SOURCES) pkginclude_HEADERS= $(BUILT_SOURCES)
created_sources = created_include_files created_sources = created_include_files
CLEANFILES = $(created_sources) CLEANFILES = $(created_sources)
...@@ -29,10 +29,11 @@ all: $(created_sources) ...@@ -29,10 +29,11 @@ all: $(created_sources)
# This will build mysqld_error.h and sql_state.h # This will build mysqld_error.h and sql_state.h
mysqld_error.h: created_include_files mysqld_error.h: created_include_files
mysqld_ername.h: created_include_files
sql_state.h: created_include_files sql_state.h: created_include_files
created_include_files: comp_err created_include_files: comp_err
$(top_builddir)/extra/comp_err --charset=$(srcdir)/../sql/share/charsets --out-dir=$(top_builddir)/sql/share/ --header_file=$(top_builddir)/extra/mysqld_error.h --state_file=$(top_builddir)/extra/sql_state.h --in_file=$(srcdir)/../sql/share/errmsg.txt $(top_builddir)/extra/comp_err --charset=$(srcdir)/../sql/share/charsets --out-dir=$(top_builddir)/sql/share/ --header_file=$(top_builddir)/extra/mysqld_error.h --name_file=$(top_builddir)/extra/mysqld_ername.h --state_file=$(top_builddir)/extra/sql_state.h --in_file=$(srcdir)/../sql/share/errmsg.txt
touch created_include_files touch created_include_files
bin_PROGRAMS = replace comp_err perror resolveip my_print_defaults \ bin_PROGRAMS = replace comp_err perror resolveip my_print_defaults \
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#define ER_PREFIX "ER_" #define ER_PREFIX "ER_"
static char *OUTFILE= (char*) "errmsg.sys"; static char *OUTFILE= (char*) "errmsg.sys";
static char *HEADERFILE= (char*) "mysqld_error.h"; static char *HEADERFILE= (char*) "mysqld_error.h";
static char *NAMEFILE= (char*) "mysqld_ername.h";
static char *STATEFILE= (char*) "sql_state.h"; static char *STATEFILE= (char*) "sql_state.h";
static char *TXTFILE= (char*) "../sql/share/errmsg.txt"; static char *TXTFILE= (char*) "../sql/share/errmsg.txt";
static char *DATADIR= (char*) "../sql/share/"; static char *DATADIR= (char*) "../sql/share/";
...@@ -117,6 +118,8 @@ static struct my_option my_long_options[]= ...@@ -117,6 +118,8 @@ static struct my_option my_long_options[]=
(gptr *) & OUTFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, (gptr *) & OUTFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"header_file", 'H', "mysqld_error.h file ", (gptr *) & HEADERFILE, {"header_file", 'H', "mysqld_error.h file ", (gptr *) & HEADERFILE,
(gptr *) & HEADERFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, (gptr *) & HEADERFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"name_file", 'N', "mysqld_ername.h file ", (gptr *) & NAMEFILE,
(gptr *) & NAMEFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"state_file", 'S', "sql_state.h file", (gptr *) & STATEFILE, {"state_file", 'S', "sql_state.h file", (gptr *) & STATEFILE,
(gptr *) & STATEFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, (gptr *) & STATEFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
...@@ -192,7 +195,7 @@ int main(int argc, char *argv[]) ...@@ -192,7 +195,7 @@ int main(int argc, char *argv[])
static int create_header_files(struct errors *error_head) static int create_header_files(struct errors *error_head)
{ {
uint er_count= 0; uint er_count= 0;
FILE *er_definef, *sql_statef; FILE *er_definef, *sql_statef, *er_namef;
struct errors *tmp_error; struct errors *tmp_error;
DBUG_ENTER("create_header_files"); DBUG_ENTER("create_header_files");
...@@ -205,9 +208,16 @@ static int create_header_files(struct errors *error_head) ...@@ -205,9 +208,16 @@ static int create_header_files(struct errors *error_head)
my_fclose(er_definef, MYF(0)); my_fclose(er_definef, MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (!(er_namef= my_fopen(NAMEFILE, O_WRONLY, MYF(MY_WME))))
{
my_fclose(er_definef, MYF(0));
my_fclose(sql_statef, MYF(0));
DBUG_RETURN(1);
}
fprintf(er_definef, "/* Autogenerated file, please don't edit */\n\n"); fprintf(er_definef, "/* Autogenerated file, please don't edit */\n\n");
fprintf(sql_statef, "/* Autogenerated file, please don't edit */\n\n"); fprintf(sql_statef, "/* Autogenerated file, please don't edit */\n\n");
fprintf(er_namef, "/* Autogenerated file, please don't edit */\n\n");
for (tmp_error= error_head; tmp_error; tmp_error= tmp_error->next_error) for (tmp_error= error_head; tmp_error; tmp_error= tmp_error->next_error)
{ {
...@@ -223,6 +233,10 @@ static int create_header_files(struct errors *error_head) ...@@ -223,6 +233,10 @@ static int create_header_files(struct errors *error_head)
fprintf(sql_statef, fprintf(sql_statef,
"%-40s,\"%s\", \"%s\",\n", tmp_error->er_name, "%-40s,\"%s\", \"%s\",\n", tmp_error->er_name,
tmp_error->sql_code1, tmp_error->sql_code2); tmp_error->sql_code1, tmp_error->sql_code2);
/*generating er_name file */
fprintf(er_namef, "{ \"%s\", %d },\n", tmp_error->er_name,
tmp_error->d_code);
er_count++; er_count++;
} }
/* finishing off with mysqld_error.h */ /* finishing off with mysqld_error.h */
......
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