Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions oursqlx/_exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,23 +617,26 @@ enum _oursqlx_exception_type _oursqlx_exc_from_errno(int err) {
return _oursqlx_PermissionsError;

default:
#if MYSQL_VERSION_ID >= 50700
for(unsigned int i = 0; i < sizeof(errmsg_section_start)/sizeof(int); ++i) {
int min = errmsg_section_start[i];
int max = errmsg_section_start[i] + errmsg_section_size[i] - 1;
if ( err >= min && err <= max ) {
return _oursqlx_ProgrammingError;
}
}
if ( err > CR_MIN_ERROR && err < CR_MAX_ERROR) {
return _oursqlx_InterfaceError;
}
#else
if (err >= ER_ERROR_FIRST && err <= ER_ERROR_LAST)
return _oursqlx_ProgrammingError;
else if (err > CR_MIN_ERROR && err < CR_MAX_ERROR)
return _oursqlx_InterfaceError;
#endif
#if MYSQL_VERSION_ID >= 50700
{
unsigned int i;
for(i = 0; i < sizeof(errmsg_section_start)/sizeof(int); ++i) {
int min = errmsg_section_start[i];
int max = errmsg_section_start[i] + errmsg_section_size[i] - 1;
if ( err >= min && err <= max ) {
return _oursqlx_ProgrammingError;
}
}
if ( err > CR_MIN_ERROR && err < CR_MAX_ERROR) {
return _oursqlx_InterfaceError;
}
}
#else
if (err >= ER_ERROR_FIRST && err <= ER_ERROR_LAST)
return _oursqlx_ProgrammingError;
else if (err > CR_MIN_ERROR && err < CR_MAX_ERROR)
return _oursqlx_InterfaceError;
#endif
}
return _oursqlx_UnknownError;
}