SOURCES: mysqlcc-reconnect.patch - set reconnect option

arekm arekm at pld-linux.org
Wed Feb 15 18:33:46 CET 2006


Author: arekm                        Date: Wed Feb 15 17:33:46 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- set reconnect option

---- Files affected:
SOURCES:
   mysqlcc-reconnect.patch (1.5 -> 1.6) 

---- Diffs:

================================================================
Index: SOURCES/mysqlcc-reconnect.patch
diff -u SOURCES/mysqlcc-reconnect.patch:1.5 SOURCES/mysqlcc-reconnect.patch:1.6
--- SOURCES/mysqlcc-reconnect.patch:1.5	Wed Feb 15 10:41:31 2006
+++ SOURCES/mysqlcc-reconnect.patch	Wed Feb 15 18:33:41 2006
@@ -1,195 +1,13 @@
-diff -urN mysqlcc-0.9.4-src.org/shared/include/CMySQL.h mysqlcc-0.9.4-src/shared/include/CMySQL.h
---- mysqlcc-0.9.4-src.org/shared/include/CMySQL.h	2003-12-14 00:10:44.000000000 +0100
-+++ mysqlcc-0.9.4-src/shared/include/CMySQL.h	2006-02-15 10:36:21.253458616 +0100
-@@ -78,6 +78,7 @@
-   QTextCodec *codec() const;
-   
-   bool isConnected() const;
-+  bool reConnect() const;
-   
-   void setHostName(const QString &s) { mysql_host = s; }
-   void setUserName(const QString &s) { mysql_user = s; }
-diff -urN mysqlcc-0.9.4-src.org/shared/src/CMySQL.cpp mysqlcc-0.9.4-src/shared/src/CMySQL.cpp
+diff -ur mysqlcc-0.9.4-src.org/shared/src/CMySQL.cpp mysqlcc-0.9.4-src/shared/src/CMySQL.cpp
 --- mysqlcc-0.9.4-src.org/shared/src/CMySQL.cpp	2003-12-14 00:10:44.000000000 +0100
-+++ mysqlcc-0.9.4-src/shared/src/CMySQL.cpp	2006-02-15 10:35:12.277278904 +0100
-@@ -70,7 +70,7 @@
- 
-   mysql = 0;
-   textcodec = 0;
--  mysql_client_flags = 0;
-+  mysql_client_flags = MYSQL_OPT_RECONNECT;
-   mysql_client_ssl = false;
-   mysql_opt_compress = false;
-   mysql_opt_timeout = 0;
-@@ -98,6 +98,12 @@
- }
- 
- 
-+bool CMySQL::reConnect() const
-+{
-+  if (!isConnected() && (mysql != 0))
-+    return mysql_ping(mysql);
-+}
-+
- bool CMySQL::isConnected() const
- {
-   return isconnected && (mysql != 0);
-@@ -273,7 +279,8 @@
- ulong CMySQL::mysqlAffectedRows() const
- {
-   if (!isConnected())
--    return 0;
-+    if (!reConnect())
-+      return 0;
++++ mysqlcc-0.9.4-src/shared/src/CMySQL.cpp	2006-02-15 18:33:11.193456928 +0100
+@@ -223,6 +223,9 @@
+   }
    else
-     return mysql_affected_rows(mysql);
- }
-@@ -284,7 +291,8 @@
- ulong CMySQL::mysqlInsertID() const
- {
-   if (!isConnected())
--    return 0;
-+    if (!reConnect())
-+      return 0;
-   else
-     return mysql_insert_id(mysql);
- }
-@@ -300,7 +308,8 @@
- #endif
-   
-   if (!isConnected())
--    return false;
-+    if (!reConnect())
-+      return false;
-   
-   if (mysql_select_db(mysql, dbname) != 0)
-   {
-@@ -324,7 +333,7 @@
- #endif
-   
-   
--  if (!isConnected() || (version().major <= 3 && version().minor <= 22))
-+  if ((!isConnected() && !reConnect()) || (version().major <= 3 && version().minor <= 22))
-     return QString::null;
- 
-   QString ret = QString::null;
-@@ -351,7 +360,8 @@
- #endif
-   
-   if (!isConnected())
--    return QString::null;  
-+    if (!reConnect())
-+      return QString::null;  
-   
-   QString ret = QString::null;
-   CMySQLQuery *qry = new CMySQLQuery(this);
-@@ -405,7 +415,8 @@
- #endif
-   
-   if (!isConnected())
--    return false;
-+    if (!reConnect())
-+      return false;
-   
-   if (mysql_ping(mysql) != 0)
-   {
-@@ -427,7 +438,8 @@
- #endif
-   
-   if (!isConnected())
--    return false;
-+    if (!reConnect())
-+      return false;
-   
-   if (mysql_kill(mysql, pid) != 0)
    {
-@@ -449,7 +461,8 @@
- #endif
-   
-   if (!isConnected())
--    return false;
-+    if (!reConnect())
-+      return false;
-   
-   if (mysql_shutdown(mysql) != 0)
-   {
-@@ -470,7 +483,8 @@
- #endif
-   
-   if (isConnected())
--    return mysql_info(mysql);
-+    if (!reConnect())
-+      return mysql_info(mysql);
-   else
-     return QString::null;
- }
-@@ -498,7 +512,8 @@
- #endif
-   
-   if (isConnected())
--    return mysql_get_host_info(mysql);
-+    if (!reConnect())
-+      return mysql_get_host_info(mysql);
-   else
-     return QString::null;
- }
-@@ -513,7 +528,8 @@
- #endif
-   
-   if (isConnected())
--    return mysql_get_proto_info(mysql);
-+    if (!reConnect())
-+      return mysql_get_proto_info(mysql);
-   else
-     return 0;
- }
-@@ -529,7 +545,8 @@
- #endif
-   
-   if (isConnected())
--    return mysql_get_server_info(mysql);
-+    if (!reConnect())
-+      return mysql_get_server_info(mysql);
-   else
-     return QString::null;
- }
-@@ -545,7 +562,8 @@
- #endif
-   
-   if (!isConnected())
--    return QString::null;
-+    if (!reConnect())
-+      return QString::null;
-   
-   QString tmp = mysql_stat(mysql);
-   
-@@ -568,7 +586,8 @@
- #endif
-   
-   if (isConnected())
--    return  mysql_character_set_name(mysql);
-+    if (!reConnect())
-+      return  mysql_character_set_name(mysql);
-   else
-     return  QString::null;
- }
-@@ -594,7 +613,7 @@
- 
-   QRegExp rx("^(\\d+)\\.(\\d+)\\.(.+)$");
-   QString str = mysqlGetServerInfo();
--  if (!isConnected() || str.isEmpty() || rx.search(str) == -1)
-+  if ((!isConnected() && !reConnect()) || str.isEmpty() || rx.search(str) == -1)
-   {
-     ver.major = 0;
-     ver.minor = 0;
-@@ -631,7 +650,8 @@
- #endif
-   
-   if (isConnected())
--    return mysql_real_escape_string(mysql, to, from, from_length);
-+    if (!reConnect())
-+      return mysql_real_escape_string(mysql, to, from, from_length);
-   else
-     return 0;
- }
-
++    my_bool reconnect = 1;
++    mysql_options(mysql, MYSQL_OPT_RECONNECT, (char *)&reconnect);
++		  
+     isconnected = true;
+     textcodec = QTextCodec::codecForName(mysqlGetCharsetName(), 2);
+     initServerVersion();
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/mysqlcc-reconnect.patch?r1=1.5&r2=1.6&f=u



More information about the pld-cvs-commit mailing list