@@ -28,7 +28,7 @@ class GameDataDBConnection : public game_data {
2828 r_string to_string () const override {
2929 if (!session) return r_string (" <no session>" sv);
3030 if (!session->connected ()) return r_string (" <not connected>" sv);
31- return " <connected to database: " + session->schema () + " >" ;
31+ return " <connected to database: " + session->schema () + " >" ;
3232 }
3333 // virtual bool equals(const game_data*) const override; //#TODO isEqualTo on hashMaps would be quite nice I guess?
3434 const char * type_as_string () const override { return " databaseConnection" ; }
@@ -85,10 +85,15 @@ GameDataDBAsyncResult* Connection::pushAsyncQuery(game_state& gs, mariadb::conne
8585
8686 // If we give them to task, it will destruct the array after task is done, and may call dealloc int he pool allocator
8787 std::vector<
88- std::variant<float , bool , r_string>
88+ std::variant<float , bool , r_string, std::monostate >
8989 > boundValuesQuery;
9090
9191 for (auto & it : boundValues) {
92+ if (it.is_null ()) {
93+ boundValuesQuery.emplace_back (std::monostate ());
94+ continue ;
95+ }
96+
9297 switch (it.type_enum ()) {
9398 case game_data_type::SCALAR: boundValuesQuery.emplace_back (static_cast <float >(it)); break ;
9499 case game_data_type::BOOL: boundValuesQuery.emplace_back (static_cast <bool >(it)); break ;
@@ -119,6 +124,8 @@ GameDataDBAsyncResult* Connection::pushAsyncQuery(game_state& gs, mariadb::conne
119124 statement->set_boolean (idx++, arg);
120125 else if constexpr (std::is_same_v<T, r_string>)
121126 statement->set_string (idx++, arg);
127+ else if constexpr (std::is_same_v<T, std::monostate>)
128+ statement->set_null (idx++);
122129 else
123130 static_assert (false , " non-exhaustive visitor!" );
124131 }, it);
0 commit comments