Added
Link Here
|
1 |
--- src/cdbconf.cpp Thu Apr 8 02:16:21 2004 |
2 |
+++ src/cdbconf.cpp Thu Oct 12 16:57:43 2006 |
3 |
@@ -18,6 +18,7 @@ |
4 |
Add("db_user",db_user,string("verlihub")); |
5 |
Add("db_pass",db_pass,string("")); |
6 |
Add("db_data",db_data,string("verlihub")); |
7 |
+ Add("db_charset",db_charset,string("latin1")); |
8 |
Add("config_name",config_name,string("config")); |
9 |
Add("lang_name",lang_name,string("lang_en")); |
10 |
Load(); |
11 |
|
12 |
diff -Nur verlihub-orig/src/cdbconf.h verlihub/src/cdbconf.h |
13 |
--- src/cdbconf.h 2006-07-15 18:42:52.000000000 +0400 |
14 |
+++ src/cdbconf.h 2006-07-15 18:43:50.000000000 +0400 |
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 |
bool allow_exec; |
23 |
diff -Nur verlihub-orig/src/cmysql.cpp verlihub/src/cmysql.cpp |
24 |
--- src/cmysql.cpp 2006-07-15 18:42:52.000000000 +0400 |
25 |
+++ src/cmysql.cpp 2006-07-15 18:45:25.000000000 +0400 |
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 -Nur verlihub-orig/src/cmysql.h verlihub/src/cmysql.h |
56 |
--- src/cmysql.h 2006-07-15 18:42:52.000000000 +0400 |
57 |
+++ src/cmysql.h 2006-07-15 18:43:50.000000000 +0400 |
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 -Nur verlihub-orig/src/cserverdc.cpp verlihub/src/cserverdc.cpp |
72 |
--- src/cserverdc.cpp 2006-07-15 18:42:52.000000000 +0400 |
73 |
+++ src/cserverdc.cpp 2006-07-15 18:43:50.000000000 +0400 |
74 |
@@ -72,7 +72,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), |