summaryrefslogtreecommitdiff
path: root/net-p2p/verlihub/files/patch-db_charset
blob: 447a33bc147c89caaed354e7bc52089e2470355e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
--- 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),