Line 0
Link Here
|
|
|
1 |
diff -ruN src-orig/cdbconf.cpp src/cdbconf.cpp |
2 |
--- src-orig/cdbconf.cpp Thu Apr 8 02:16:21 2004 |
3 |
+++ src/cdbconf.cpp Mon Aug 21 01:39:14 2006 |
4 |
@@ -20,6 +20,7 @@ |
5 |
Add("db_data",db_data,string("verlihub")); |
6 |
Add("config_name",config_name,string("config")); |
7 |
Add("lang_name",lang_name,string("lang_en")); |
8 |
+ Add("db_charset",db_charset,string("utf8")); |
9 |
Load(); |
10 |
} |
11 |
|
12 |
diff -ruN src-orig/cdbconf.h src/cdbconf.h |
13 |
--- src-orig/cdbconf.h Thu Apr 8 02:16:21 2004 |
14 |
+++ src/cdbconf.h Mon Aug 21 01:38:59 2006 |
15 |
@@ -31,6 +31,7 @@ |
16 |
string db_user; |
17 |
string db_pass; |
18 |
string db_data; |
19 |
+ string db_charset; |
20 |
string config_name; |
21 |
string lang_name; |
22 |
|
23 |
diff -ruN src-orig/cmysql.cpp src/cmysql.cpp |
24 |
--- src-orig/cmysql.cpp Fri Oct 1 15:19:44 2004 |
25 |
+++ src/cmysql.cpp Mon Aug 21 01:38:59 2006 |
26 |
@@ -19,10 +19,10 @@ |
27 |
/*! |
28 |
\fn nMySQL::cMySQL::cMySQL(string&host,string&user,string&pass,string&data) |
29 |
*/ |
30 |
-cMySQL::cMySQL(string&host,string&user,string&pass,string&data) : cObj("cMySQL") |
31 |
+cMySQL::cMySQL(string&host,string&user,string&pass,string&data,string&charset) : cObj("cMySQL") |
32 |
{ |
33 |
Init(); |
34 |
- if(!Connect(host,user,pass,data)) |
35 |
+ if(!Connect(host,user,pass,data,charset)) |
36 |
{ |
37 |
throw "Mysql connection error."; |
38 |
} |
39 |
@@ -40,12 +40,13 @@ |
40 |
if(!mDBHandle) Error(0, string("Can't init mysql structure :(.: ")); |
41 |
} |
42 |
|
43 |
-bool cMySQL::Connect(string &host, string &user, string &pass, string &data) |
44 |
+bool cMySQL::Connect(string &host, string &user, string &pass, string &data, string &charset) |
45 |
{ |
46 |
if(Log(1)) LogStream() << "Connecting to mysql server: " |
47 |
- << user << "@" << host << "/" << data << endl; |
48 |
+ << user << "@" << host << "/" << data << "with charset " << charset << endl; |
49 |
|
50 |
mysql_options(mDBHandle,MYSQL_OPT_COMPRESS,0); |
51 |
+ mysql_options(mDBHandle,MYSQL_SET_CHARSET_NAME,charset.c_str()); |
52 |
if(!mysql_real_connect( |
53 |
mDBHandle, |
54 |
host.c_str(), |
55 |
diff -ruN src-orig/cmysql.h src/cmysql.h |
56 |
--- src-orig/cmysql.h Mon Mar 8 18:59:56 2004 |
57 |
+++ src/cmysql.h Mon Aug 21 01:38:59 2006 |
58 |
@@ -34,10 +34,10 @@ |
59 |
friend class cQuery; |
60 |
public: |
61 |
cMySQL(); |
62 |
- cMySQL(string&host,string&user,string&pass,string&data); |
63 |
+ cMySQL(string&host,string&user,string&pass,string&data,string&charset); |
64 |
~cMySQL(); |
65 |
void Init(); |
66 |
- bool Connect(string &host, string &user, string &passwd, string &db); |
67 |
+ bool Connect(string &host, string &user, string &passwd, string &db, string &charset); |
68 |
public: void Error(int level, string text); |
69 |
|
70 |
private: |
71 |
diff -ruN src-orig/cserverdc.cpp src/cserverdc.cpp |
72 |
--- src-orig/cserverdc.cpp Tue Mar 8 12:27:21 2005 |
73 |
+++ src/cserverdc.cpp Mon Aug 21 01:38:59 2006 |
74 |
@@ -66,7 +66,8 @@ |
75 |
mDBConf.db_host, |
76 |
mDBConf.db_user, |
77 |
mDBConf.db_pass, |
78 |
- mDBConf.db_data), // connect to mysql |
79 |
+ mDBConf.db_data, |
80 |
+ mDBConf.db_charset), // connect to mysql |
81 |
mC(*this), // create the config object |
82 |
mL(*this), |
83 |
mSetupList(mMySQL), |