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

Function mysql_errno_to_sqlstate

sql/sql_state.c:34–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32};
33
34const char *mysql_errno_to_sqlstate(uint mysql_errno)
35{
36 uint first=0, end= array_elements(sqlstate_map)-1;
37 struct st_map_errno_to_sqlstate *map;
38
39 /* Do binary search in the sorted array */
40 while (first != end)
41 {
42 uint mid= (first+end)/2;
43 map= sqlstate_map+mid;
44 if (map->mysql_errno < mysql_errno)
45 first= mid+1;
46 else
47 end= mid;
48 }
49 map= sqlstate_map+first;
50 if (map->mysql_errno == mysql_errno)
51 return map->odbc_state;
52 return "HY000"; /* General error */
53}

Callers 3

set_error_statusMethod · 0.85
net_send_errorFunction · 0.85
raise_conditionMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected