Skip to content

Commit

Permalink
Set uft8 also on reconnects.
Browse files Browse the repository at this point in the history
Backport of 10d3e39
  • Loading branch information
Pentarctagon authored and soliton- committed Aug 24, 2019
1 parent 675df8e commit 887bfe8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/server/forum_user_handler.cpp
Expand Up @@ -369,6 +369,7 @@ inline T fuh::prepared_statement(const std::string& sql, Args&&... args)
//Try to reconnect and execute query again
mysql_close(conn);
conn = mysql_init(nullptr);
mysql_options(conn, MYSQL_SET_CHARSET_NAME, "utf8mb4");
if(!conn || !mysql_real_connect(conn, db_host_.c_str(), db_user_.c_str(), db_password_.c_str(), db_name_.c_str(), 0, nullptr, 0)) {
ERR_UH << "Could not connect to database: " << mysql_errno(conn) << ": " << mysql_error(conn) << std::endl;
throw sql_error("Error querying database.");
Expand Down

0 comments on commit 887bfe8

Please sign in to comment.