mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 18:20:07 +01:00
Added creation of mysqld_ername.h
This commit is contained in:
parent
f56efde6a3
commit
e52dce98da
2 changed files with 18 additions and 3 deletions
|
@ -19,7 +19,7 @@ INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include \
|
|||
-I$(top_srcdir)/extra
|
||||
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.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)
|
||||
created_sources = created_include_files
|
||||
CLEANFILES = $(created_sources)
|
||||
|
@ -29,10 +29,11 @@ all: $(created_sources)
|
|||
|
||||
# This will build mysqld_error.h and sql_state.h
|
||||
mysqld_error.h: created_include_files
|
||||
mysqld_ername.h: created_include_files
|
||||
sql_state.h: created_include_files
|
||||
|
||||
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
|
||||
|
||||
bin_PROGRAMS = replace comp_err perror resolveip my_print_defaults \
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#define ER_PREFIX "ER_"
|
||||
static char *OUTFILE= (char*) "errmsg.sys";
|
||||
static char *HEADERFILE= (char*) "mysqld_error.h";
|
||||
static char *NAMEFILE= (char*) "mysqld_ername.h";
|
||||
static char *STATEFILE= (char*) "sql_state.h";
|
||||
static char *TXTFILE= (char*) "../sql/share/errmsg.txt";
|
||||
static char *DATADIR= (char*) "../sql/share/";
|
||||
|
@ -117,6 +118,8 @@ static struct my_option my_long_options[]=
|
|||
(gptr *) & OUTFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"header_file", 'H', "mysqld_error.h file ", (gptr *) & HEADERFILE,
|
||||
(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,
|
||||
(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}
|
||||
|
@ -192,7 +195,7 @@ int main(int argc, char *argv[])
|
|||
static int create_header_files(struct errors *error_head)
|
||||
{
|
||||
uint er_count= 0;
|
||||
FILE *er_definef, *sql_statef;
|
||||
FILE *er_definef, *sql_statef, *er_namef;
|
||||
struct errors *tmp_error;
|
||||
DBUG_ENTER("create_header_files");
|
||||
|
||||
|
@ -205,9 +208,16 @@ static int create_header_files(struct errors *error_head)
|
|||
my_fclose(er_definef, MYF(0));
|
||||
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(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)
|
||||
{
|
||||
|
@ -223,6 +233,10 @@ static int create_header_files(struct errors *error_head)
|
|||
fprintf(sql_statef,
|
||||
"%-40s,\"%s\", \"%s\",\n", tmp_error->er_name,
|
||||
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++;
|
||||
}
|
||||
/* finishing off with mysqld_error.h */
|
||||
|
|
Loading…
Add table
Reference in a new issue