From 44c6b097c646702def7d02cd31964a1e36980519 Mon Sep 17 00:00:00 2001 From: ndparker Date: Mon, 6 Feb 2017 15:03:50 +0100 Subject: [PATCH] make oursql compile against mariadb and mysql 5.6 / 5.7 --- oursqlx/_exceptions.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/oursqlx/_exceptions.c b/oursqlx/_exceptions.c index 0d76ff0..3b6fa41 100644 --- a/oursqlx/_exceptions.c +++ b/oursqlx/_exceptions.c @@ -617,8 +617,10 @@ 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) { + #if MYSQL_VERSION_ID >= 50700 && !defined(ER_ERROR_FIRST) + { + 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 ) { @@ -628,6 +630,7 @@ enum _oursqlx_exception_type _oursqlx_exc_from_errno(int err) { 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;