summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-07-04 02:12:50 +0500
committerilotterytea <iltsu@alright.party>2025-07-04 02:12:50 +0500
commit76f4b021b087060116c22412f59dd3266c80c39b (patch)
tree3d1e1623cfea03b004406b831658c598bf821eec
parent616298db787197e8b01e22627e9e90271a4e5524 (diff)
fix: my_bool exists in old mysql versions, but not in latest (cross platform fix)
-rw-r--r--bot/src/database.hpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/bot/src/database.hpp b/bot/src/database.hpp
index 8bc1721..1958428 100644
--- a/bot/src/database.hpp
+++ b/bot/src/database.hpp
@@ -209,7 +209,11 @@ namespace bot::db {
std::vector<MYSQL_BIND> bind_res(num_fields);
std::vector<std::string> bufs(num_fields);
std::vector<unsigned long> lengths_out(num_fields);
+#if MYSQL_VERSION_ID >= 80000
std::vector<bool *> is_null(num_fields);
+#else
+ std::vector<my_bool> is_null(num_fields);
+#endif
for (int i = 0; i < num_fields; i++) {
bufs[i].resize(1024);
@@ -218,7 +222,11 @@ namespace bot::db {
bind_res[i].buffer = bufs[i].data();
bind_res[i].buffer_length = bufs[i].size();
bind_res[i].length = &lengths_out[i];
+#if MYSQL_VERSION_ID >= 80000
bind_res[i].is_null = reinterpret_cast<bool *>(&is_null[i]);
+#else
+ bind_res[i].is_null = &is_null[i];
+#endif
}
if (mysql_stmt_bind_result(stmt, bind_res.data())) {