83 lines
2.9 KiB
Text
83 lines
2.9 KiB
Text
--- src/cdbconf.cpp Thu Apr 8 02:16:21 2004
|
|
+++ src/cdbconf.cpp Thu Oct 12 16:57:43 2006
|
|
@@ -18,6 +18,7 @@
|
|
Add("db_user",db_user,string("verlihub"));
|
|
Add("db_pass",db_pass,string(""));
|
|
Add("db_data",db_data,string("verlihub"));
|
|
+ Add("db_charset",db_charset,string("latin1"));
|
|
Add("config_name",config_name,string("config"));
|
|
Add("lang_name",lang_name,string("lang_en"));
|
|
Load();
|
|
|
|
diff -Nur verlihub-orig/src/cdbconf.h verlihub/src/cdbconf.h
|
|
--- src/cdbconf.h 2006-07-15 18:42:52.000000000 +0400
|
|
+++ src/cdbconf.h 2006-07-15 18:43:50.000000000 +0400
|
|
@@ -31,6 +31,7 @@
|
|
string db_user;
|
|
string db_pass;
|
|
string db_data;
|
|
+ string db_charset;
|
|
string config_name;
|
|
string lang_name;
|
|
bool allow_exec;
|
|
diff -Nur verlihub-orig/src/cmysql.cpp verlihub/src/cmysql.cpp
|
|
--- src/cmysql.cpp.orig Sun Jun 24 00:11:33 2007
|
|
+++ src/cmysql.cpp Tue Jan 29 16:39:29 2008
|
|
@@ -19,10 +19,10 @@
|
|
/*!
|
|
\fn nMySQL::cMySQL::cMySQL(string&host,string&user,string&pass,string&data)
|
|
*/
|
|
-cMySQL::cMySQL(string&host,string&user,string&pass,string&data) : cObj("cMySQL")
|
|
+cMySQL::cMySQL(string&host,string&user,string&pass,string&data,string&charset) : cObj("cMySQL")
|
|
{
|
|
Init();
|
|
- if(!Connect(host,user,pass,data))
|
|
+ if(!Connect(host,user,pass,data,charset))
|
|
{
|
|
throw "Mysql connection error.";
|
|
}
|
|
@@ -40,12 +40,13 @@
|
|
if(!mDBHandle) Error(0, string("Can't init mysql structure :(.: "));
|
|
}
|
|
|
|
-bool cMySQL::Connect(string &host, string &user, string &pass, string &data)
|
|
+bool cMySQL::Connect(string &host, string &user, string &pass, string &data, string &charset)
|
|
{
|
|
if(Log(1)) LogStream() << "Connecting to mysql server: "
|
|
- << user << "@" << host << "/" << data << endl;
|
|
+ << user << "@" << host << "/" << data << "with charset " << charset << endl;
|
|
|
|
mysql_options(mDBHandle,MYSQL_OPT_COMPRESS,0);
|
|
+ mysql_options(mDBHandle,MYSQL_SET_CHARSET_NAME,charset.c_str());
|
|
|
|
if(!mysql_real_connect(
|
|
mDBHandle,
|
|
diff -Nur verlihub-orig/src/cmysql.h verlihub/src/cmysql.h
|
|
--- src/cmysql.h 2006-07-15 18:42:52.000000000 +0400
|
|
+++ src/cmysql.h 2006-07-15 18:43:50.000000000 +0400
|
|
@@ -34,10 +34,10 @@
|
|
friend class cQuery;
|
|
public:
|
|
cMySQL();
|
|
- cMySQL(string&host,string&user,string&pass,string&data);
|
|
+ cMySQL(string&host,string&user,string&pass,string&data,string&charset);
|
|
~cMySQL();
|
|
void Init();
|
|
- bool Connect(string &host, string &user, string &passwd, string &db);
|
|
+ bool Connect(string &host, string &user, string &passwd, string &db, string &charset);
|
|
public: void Error(int level, string text);
|
|
|
|
private:
|
|
diff -Nur verlihub-orig/src/cserverdc.cpp verlihub/src/cserverdc.cpp
|
|
--- src/cserverdc.cpp 2006-07-15 18:42:52.000000000 +0400
|
|
+++ src/cserverdc.cpp 2006-07-15 18:43:50.000000000 +0400
|
|
@@ -72,7 +72,8 @@
|
|
mDBConf.db_host,
|
|
mDBConf.db_user,
|
|
mDBConf.db_pass,
|
|
- mDBConf.db_data), // connect to mysql
|
|
+ mDBConf.db_data,
|
|
+ mDBConf.db_charset), // connect to mysql
|
|
mC(*this), // create the config object
|
|
mL(*this),
|
|
mSetupList(mMySQL),
|