| 32 | }; |
| 33 | |
| 34 | const 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 | } |
no outgoing calls
no test coverage detected