Skip to content

Commit 0f10d07

Browse files
committed
Add env MYSQL_CONN_CHARSET to set MYSQL_SET_CHARSET_NAME
1 parent 50e4dcb commit 0f10d07

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/drivers/mysql/drv_mysql.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,10 @@ static int mysql_drv_real_connect(db_mysql_conn_t *db_mysql_con)
411411
DEBUG("mysql_options(%p, %s, %s)",con, "MYSQL_OPT_COMPRESS", "NULL");
412412
mysql_options(con, MYSQL_OPT_COMPRESS, NULL);
413413
}
414+
const char* cs = getenv("MYSQL_CONN_CHARSET");
415+
if (cs) {
416+
mysql_options(con, MYSQL_SET_CHARSET_NAME, cs);
417+
}
414418

415419
DEBUG("mysql_real_connect(%p, \"%s\", \"%s\", \"%s\", \"%s\", %u, \"%s\", %s)",
416420
con,

0 commit comments

Comments
 (0)