diff --git a/test/tap/tap/utils.cpp b/test/tap/tap/utils.cpp index ead8437ff..2e4383b3c 100644 --- a/test/tap/tap/utils.cpp +++ b/test/tap/tap/utils.cpp @@ -199,8 +199,8 @@ std::size_t count_matches(const string& str, const string& substr) { return result; } -int mysql_query_t(MYSQL* mysql, const char* query) { - diag("%s: Issuing query '%s' to ('%s':%d)", get_formatted_time().c_str(), query, mysql->host, mysql->port); +int mysql_query_t__(MYSQL* mysql, const char* query, const char* f, int ln, const char* fn) { + diag("%s:%d:%s(): Issuing query '%s' to ('%s':%d)", f, ln, fn, query, mysql->host, mysql->port); return mysql_query(mysql, query); } diff --git a/test/tap/tap/utils.h b/test/tap/tap/utils.h index 0b918b0d0..3456c478b 100644 --- a/test/tap/tap/utils.h +++ b/test/tap/tap/utils.h @@ -68,7 +68,18 @@ inline std::string get_formatted_time() { return std::string(__buffer); } -int mysql_query_t(MYSQL* mysql, const char* query); +/** + * @brief Wrapper for 'mysql_query' with logging for convenience. + * @details Should be used through 'mysql_query_t' macro. + * @return Result of calling 'mysql_query'. + */ +int mysql_query_t__(MYSQL* mysql, const char* query, const char* f, int ln, const char* fn); + +/** + * @brief Convenience macro with query logging. + */ +#define mysql_query_t(mysql, query)\ + mysql_query_t__(mysql, query, __FILE__, __LINE__, __func__) #define MYSQL_QUERY(mysql, query) \ do { \