11 #ifndef _MARIADB_PRIVATE_HPP_ 12 #define _MARIADB_PRIVATE_HPP_ 19 inline int localtime_safe(
struct tm* _tm,
const time_t* _time) {
return localtime_s(_tm, _time); }
21 inline int gmtime_safe(
struct tm* _tm,
const time_t* _time) {
return gmtime_s(_tm, _time); }
24 return localtime_r(_time, _tm) ? 0 : -1;
28 return gmtime_r(_time, _tm) ? 0 : -1;
37 #define snprintf(buffer, szbuffer, format, ...) __mingw_sprintf(buffer, format, ##__VA_ARGS__) 39 #define snprintf sprintf_s 44 #define MARIADB_ERROR_THROW_CONNECTION(error_id, error) \ 45 throw exception::connection(error_id, error); 46 #define MARIADB_ERROR_THROW_DATE(_year, _month, _day, _hour, _minute, _second, _millisecond) \ 47 throw exception::date_time(_year, _month, _day, _hour, _minute, _second, _millisecond); 48 #define MARIADB_ERROR_THROW_TIME(_hour, _minute, _second, _millisecond) \ 49 throw exception::time(_hour, _minute, _second, _millisecond); 51 #define MARIADB_ERROR(error_id, error) \ 52 std::cerr << "MariaDB Error(" << error_id << "): " << error \ 53 << "\nIn function: " << __FUNCTION__ << "\nIn file " << __FILE__ << "\nOn line " \ 54 << __LINE__ << '\n'; \ 55 MARIADB_ERROR_THROW_CONNECTION(error_id, error) 57 #define MYSQL_ERROR_NO_BRAKET(mysql) \ 58 m_last_error_no = mysql_errno(mysql); \ 59 m_last_error = mysql_error(mysql); \ 60 MARIADB_ERROR(m_last_error_no, m_last_error); 62 #define MYSQL_ERROR(mysql) \ 63 { MYSQL_ERROR_NO_BRAKET(mysql) } 65 #define STMT_ERROR_NO_BRAKET(statement) \ 66 m_last_error_no = mysql_stmt_errno(statement); \ 67 m_last_error = mysql_stmt_error(statement); \ 68 MARIADB_ERROR(m_last_error_no, m_last_error); 70 #define STMT_ERROR(statement) \ 71 { STMT_ERROR_NO_BRAKET(statement) }
int gmtime_safe(struct tm *_tm, const time_t *_time)
int localtime_safe(struct tm *_tm, const time_t *_time)