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

Function parse_error_string

extra/comp_err.c:976–1030  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

974*/
975
976static struct errors *parse_error_string(char *str, int er_count)
977{
978 char *er_name;
979 int d_code;
980 const char *sql_code1= empty_string;
981 const char *sql_code2= empty_string;
982 DBUG_ENTER("parse_error_string");
983 DBUG_PRINT("enter", ("str: %s", str));
984
985 str= skip_delimiters(str);
986
987 /* getting the error name */
988
989 if (!(er_name= get_word(&str)))
990 DBUG_RETURN(0); /* OOM: Fatal error */
991
992 str= skip_delimiters(str);
993
994 /* getting the code1 */
995 d_code= er_offset + er_count;
996
997 str= skip_delimiters(str);
998
999 /* if we reached EOL => no more codes, but this can happen */
1000 if (!*str)
1001 {
1002 DBUG_PRINT("info", ("str: %s", str));
1003 goto complete_create;
1004 }
1005 /* getting the sql_code 1 */
1006 if (!(sql_code1= get_word(&str)))
1007 DBUG_RETURN(0); /* OOM: Fatal error */
1008
1009 str= skip_delimiters(str);
1010
1011 /* if we reached EOL => no more codes, but this can happen */
1012 if (!*str)
1013 {
1014 DBUG_PRINT("info", ("str: %s", str));
1015 goto complete_create;
1016 }
1017 /* getting the sql_code 2 */
1018 if (!(sql_code2= get_word(&str)))
1019 DBUG_RETURN(0); /* OOM: Fatal error */
1020
1021 str= skip_delimiters(str);
1022
1023 if (*str)
1024 {
1025 fprintf(stderr, "The error line did not end with sql/odbc code!");
1026 DBUG_RETURN(0);
1027 }
1028complete_create:
1029 DBUG_RETURN(create_new_error(FALSE,er_name,d_code,sql_code1,sql_code2));
1030}
1031
1032
1033/*

Callers 1

parse_input_fileFunction · 0.85

Calls 3

skip_delimitersFunction · 0.85
get_wordFunction · 0.85
create_new_errorFunction · 0.85

Tested by

no test coverage detected