MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / main

Function main

extra/comp_err.c:171–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169
170
171int main(int argc, char *argv[])
172{
173 MY_INIT(argv[0]);
174 {
175 uint row_count;
176 struct errors *error_head;
177 struct languages *lang_head;
178 DBUG_ENTER("main");
179
180 charsets_dir= DEFAULT_CHARSET_DIR;
181 my_umask_dir= 0777;
182 if (get_options(&argc, &argv))
183 DBUG_RETURN(1);
184 if (!(row_count= parse_input_file(TXTFILE, &error_head, &lang_head)))
185 {
186 fprintf(stderr, "Failed to parse input file %s\n", TXTFILE);
187 DBUG_RETURN(1);
188 }
189#if MYSQL_VERSION_ID >= 50100 && MYSQL_VERSION_ID < 50500
190/* Number of error messages in 5.1 - do not change this number! */
191#define MYSQL_OLD_GA_ERROR_MESSAGE_COUNT 641
192#elif MYSQL_VERSION_ID >= 50500 && MYSQL_VERSION_ID < 50600
193/* Number of error messages in 5.5 - do not change this number! */
194#define MYSQL_OLD_GA_ERROR_MESSAGE_COUNT 728
195#endif
196#if MYSQL_OLD_GA_ERROR_MESSAGE_COUNT
197 if (row_count != MYSQL_OLD_GA_ERROR_MESSAGE_COUNT)
198 {
199 fprintf(stderr, "Can only add new error messages to latest GA. ");
200 fprintf(stderr, "Use ER_UNKNOWN_ERROR instead.\n");
201 fprintf(stderr, "Expected %u messages, found %u.\n",
202 MYSQL_OLD_GA_ERROR_MESSAGE_COUNT, row_count);
203 DBUG_RETURN(1);
204 }
205#endif
206 if (lang_head == NULL || error_head == NULL)
207 {
208 fprintf(stderr, "Failed to parse input file %s\n", TXTFILE);
209 DBUG_RETURN(1);
210 }
211
212 if (create_header_files(error_head))
213 {
214 fprintf(stderr, "Failed to create header files\n");
215 DBUG_RETURN(1);
216 }
217 if (create_sys_files(lang_head, error_head, row_count))
218 {
219 fprintf(stderr, "Failed to create sys files\n");
220 DBUG_RETURN(1);
221 }
222 clean_up(lang_head, error_head);
223 DBUG_LEAVE; /* Can't use dbug after my_end() */
224 my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
225 return 0;
226 }
227}
228

Callers

nothing calls this directly

Calls 6

parse_input_fileFunction · 0.85
create_header_filesFunction · 0.85
create_sys_filesFunction · 0.85
my_endFunction · 0.85
get_optionsFunction · 0.70
clean_upFunction · 0.70

Tested by

no test coverage detected