Added setting for client character set (encoding) of the MySQL connection.
git-svn-id: http://voip.null.ro/svn/yate@2534 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
e779b29c62
commit
88916e0a76
|
@ -33,3 +33,7 @@
|
|||
|
||||
; compress: bool: Enable use of compression protocol
|
||||
;compress=disable
|
||||
|
||||
; encoding: string: Character set encoding used to communicate with the server
|
||||
; If not set or empty will use the default for your system
|
||||
;encoding=
|
||||
|
|
|
@ -84,6 +84,7 @@ private:
|
|||
String m_unix;
|
||||
unsigned int m_port;
|
||||
bool m_compress;
|
||||
String m_encoding;
|
||||
String m_query;
|
||||
Message* m_msg;
|
||||
int m_res;
|
||||
|
@ -144,6 +145,7 @@ DbConn::DbConn(const NamedList* sect)
|
|||
m_port = sect->getIntValue("port");
|
||||
m_unix = sect->getValue("socket");
|
||||
m_compress = sect->getBoolValue("compress");
|
||||
m_encoding = sect->getValue("encoding");
|
||||
}
|
||||
|
||||
DbConn::~DbConn()
|
||||
|
@ -179,6 +181,9 @@ bool DbConn::initDb()
|
|||
my_bool reconn = 1;
|
||||
mysql_options(m_conn,MYSQL_OPT_RECONNECT,(const char*)&reconn);
|
||||
#endif
|
||||
if (m_encoding && mysql_set_character_set(m_conn,m_encoding))
|
||||
Debug(&module,DebugWarn,"Failed to set encoding '%s' on connection '%s'",
|
||||
m_encoding.c_str(),m_name.c_str());
|
||||
return true;
|
||||
}
|
||||
Debug(&module,DebugWarn,"Connection for '%s' failed: %s",m_name.c_str(),mysql_error(m_conn));
|
||||
|
|
Loading…
Reference in New Issue