Lock database before setting character set
SQL_SetCharset wasn't thread safe and could race with other threaded queries causing a crash.
This commit is contained in:
parent
f960c64dc6
commit
c6a7e86762
@ -297,5 +297,9 @@ IDBDriver *MyDatabase::GetDriver()
|
|||||||
|
|
||||||
bool MyDatabase::SetCharacterSet(const char *characterset)
|
bool MyDatabase::SetCharacterSet(const char *characterset)
|
||||||
{
|
{
|
||||||
return mysql_set_character_set(m_mysql, characterset) == 0 ? true : false;
|
bool res;
|
||||||
|
LockForFullAtomicOperation();
|
||||||
|
res = mysql_set_character_set(m_mysql, characterset) == 0 ? true : false;
|
||||||
|
UnlockFromFullAtomicOperation();
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user