The world's most popular open source database
#include "mysql_priv.h"#include "mysys_err.h"Include dependency graph for derror.cc:

Go to the source code of this file.
Functions | |
| static bool | read_texts (const char *file_name, const char ***point, uint error_messages) |
| static void | init_myfunc_errs (void) |
| bool | init_errmessage (void) |
| bool init_errmessage | ( | void | ) |
Definition at line 41 of file derror.cc.
References DBUG_ENTER, DBUG_RETURN, ER_ERROR_FIRST, ER_ERROR_LAST, errmesg, ERRMSG_FILE, FALSE, init_myfunc_errs(), my_error_register(), my_error_unregister(), read_texts(), TRUE, and x_free.
Referenced by init_common_variables().
00042 { 00043 const char **errmsgs; 00044 DBUG_ENTER("init_errmessage"); 00045 00046 /* 00047 Get a pointer to the old error messages pointer array. 00048 read_texts() tries to free it. 00049 */ 00050 errmsgs= my_error_unregister(ER_ERROR_FIRST, ER_ERROR_LAST); 00051 00052 /* Read messages from file. */ 00053 if (read_texts(ERRMSG_FILE, &errmsgs, ER_ERROR_LAST - ER_ERROR_FIRST + 1)) 00054 DBUG_RETURN(TRUE); 00055 00056 /* Register messages for use with my_error(). */ 00057 if (my_error_register(errmsgs, ER_ERROR_FIRST, ER_ERROR_LAST)) 00058 { 00059 x_free((gptr) errmsgs); 00060 DBUG_RETURN(TRUE); 00061 } 00062 00063 errmesg= errmsgs; /* Init global variabel */ 00064 init_myfunc_errs(); /* Init myfunc messages */ 00065 DBUG_RETURN(FALSE); 00066 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void init_myfunc_errs | ( | void | ) | [static] |
Definition at line 173 of file derror.cc.
References EE, EE_BADCLOSE, EE_CANTCREATEFILE, EE_CANTLOCK, EE_DELETE, EE_DIR, EE_DISK_FULL, EE_EOFERR, EE_FILENOTFOUND, EE_GETWD, EE_LINK, EE_OUTOFMEMORY, EE_READ, EE_SETWD, EE_STAT, EE_WRITE, ER, ER_CANT_CREATE_FILE, ER_CANT_DELETE_FILE, ER_CANT_GET_STAT, ER_CANT_GET_WD, ER_CANT_LOCK, ER_CANT_READ_DIR, ER_CANT_SET_WD, ER_DISK_FULL, ER_ERROR_ON_CLOSE, ER_ERROR_ON_READ, ER_ERROR_ON_RENAME, ER_ERROR_ON_WRITE, ER_FILE_NOT_FOUND, ER_OUTOFMEMORY, ER_UNEXPECTED_EOF, init_glob_errs(), SPECIAL_ENGLISH, and specialflag.
Referenced by init_errmessage().
00174 { 00175 init_glob_errs(); /* Initiate english errors */ 00176 if (!(specialflag & SPECIAL_ENGLISH)) 00177 { 00178 EE(EE_FILENOTFOUND) = ER(ER_FILE_NOT_FOUND); 00179 EE(EE_CANTCREATEFILE) = ER(ER_CANT_CREATE_FILE); 00180 EE(EE_READ) = ER(ER_ERROR_ON_READ); 00181 EE(EE_WRITE) = ER(ER_ERROR_ON_WRITE); 00182 EE(EE_BADCLOSE) = ER(ER_ERROR_ON_CLOSE); 00183 EE(EE_OUTOFMEMORY) = ER(ER_OUTOFMEMORY); 00184 EE(EE_DELETE) = ER(ER_CANT_DELETE_FILE); 00185 EE(EE_LINK) = ER(ER_ERROR_ON_RENAME); 00186 EE(EE_EOFERR) = ER(ER_UNEXPECTED_EOF); 00187 EE(EE_CANTLOCK) = ER(ER_CANT_LOCK); 00188 EE(EE_DIR) = ER(ER_CANT_READ_DIR); 00189 EE(EE_STAT) = ER(ER_CANT_GET_STAT); 00190 EE(EE_GETWD) = ER(ER_CANT_GET_WD); 00191 EE(EE_SETWD) = ER(ER_CANT_SET_WD); 00192 EE(EE_DISK_FULL) = ER(ER_DISK_FULL); 00193 } 00194 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static bool read_texts | ( | const char * | file_name, | |
| const char *** | point, | |||
| uint | error_messages | |||
| ) | [static] |
Definition at line 72 of file derror.cc.
References count, DBUG_ENTER, DBUG_RETURN, err, FERR, fn_format(), FN_REFLEN, get_charset(), language, LINT_INIT, my_close(), my_malloc(), MY_NABP, my_open(), my_read, MY_WME, MYF, name, O_BINARY, O_SHARE, pos(), sql_print_error(), uint2korr, unireg_abort(), VOID, and x_free.
Referenced by init_errmessage().
00074 { 00075 register uint i; 00076 uint count,funktpos,length,textcount; 00077 File file; 00078 char name[FN_REFLEN]; 00079 const char *buff; 00080 uchar head[32],*pos; 00081 DBUG_ENTER("read_texts"); 00082 00083 *point=0; // If something goes wrong 00084 LINT_INIT(buff); 00085 funktpos=0; 00086 if ((file=my_open(fn_format(name,file_name,language,"",4), 00087 O_RDONLY | O_SHARE | O_BINARY, 00088 MYF(0))) < 0) 00089 goto err; /* purecov: inspected */ 00090 00091 funktpos=1; 00092 if (my_read(file,(byte*) head,32,MYF(MY_NABP))) goto err; 00093 if (head[0] != (uchar) 254 || head[1] != (uchar) 254 || 00094 head[2] != 2 || head[3] != 1) 00095 goto err; /* purecov: inspected */ 00096 textcount=head[4]; 00097 00098 if (!head[30]) 00099 { 00100 sql_print_error("Character set information not found in '%s'. \ 00101 Please install the latest version of this file.",name); 00102 goto err1; 00103 } 00104 00105 /* TODO: Convert the character set to server system character set */ 00106 if (!get_charset(head[30],MYF(MY_WME))) 00107 { 00108 sql_print_error("Character set #%d is not supported for messagefile '%s'", 00109 (int)head[30],name); 00110 goto err1; 00111 } 00112 00113 length=uint2korr(head+6); count=uint2korr(head+8); 00114 00115 if (count < error_messages) 00116 { 00117 sql_print_error("\ 00118 Error message file '%s' had only %d error messages,\n\ 00119 but it should contain at least %d error messages.\n\ 00120 Check that the above file is the right version for this program!", 00121 name,count,error_messages); 00122 VOID(my_close(file,MYF(MY_WME))); 00123 unireg_abort(1); 00124 } 00125 00126 x_free((gptr) *point); /* Free old language */ 00127 if (!(*point= (const char**) 00128 my_malloc((uint) (length+count*sizeof(char*)),MYF(0)))) 00129 { 00130 funktpos=2; /* purecov: inspected */ 00131 goto err; /* purecov: inspected */ 00132 } 00133 buff= (char*) (*point + count); 00134 00135 if (my_read(file,(byte*) buff,(uint) count*2,MYF(MY_NABP))) goto err; 00136 for (i=0, pos= (uchar*) buff ; i< count ; i++) 00137 { 00138 (*point)[i]=buff+uint2korr(pos); 00139 pos+=2; 00140 } 00141 if (my_read(file,(byte*) buff,(uint) length,MYF(MY_NABP))) goto err; 00142 00143 for (i=1 ; i < textcount ; i++) 00144 { 00145 point[i]= *point +uint2korr(head+10+i+i); 00146 } 00147 VOID(my_close(file,MYF(0))); 00148 DBUG_RETURN(0); 00149 00150 err: 00151 switch (funktpos) { 00152 case 2: 00153 buff="Not enough memory for messagefile '%s'"; 00154 break; 00155 case 1: 00156 buff="Can't read from messagefile '%s'"; 00157 break; 00158 default: 00159 buff="Can't find messagefile '%s'"; 00160 break; 00161 } 00162 sql_print_error(buff,name); 00163 err1: 00164 if (file != FERR) 00165 VOID(my_close(file,MYF(MY_WME))); 00166 unireg_abort(1); 00167 DBUG_RETURN(1); // keep compiler happy 00168 } /* read_texts */
Here is the call graph for this function:

Here is the caller graph for this function:

1.4.7

