Date: Friday, February 17, 2006 @ 11:48:25
  Author: zsolt
    Path: /cvsroot/carob/libmysequoia/src

Modified: CarobMySQL.cpp (1.48 -> 1.49)

- modified if the user gives the hardcoded mysql port first try to connect to 
sequoia hardcoded port and if not successful than to the mysql hardcoded port
- small leak fix


----------------+
 CarobMySQL.cpp |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)


Index: libmysequoia/src/CarobMySQL.cpp
diff -u libmysequoia/src/CarobMySQL.cpp:1.48 
libmysequoia/src/CarobMySQL.cpp:1.49
--- libmysequoia/src/CarobMySQL.cpp:1.48        Mon Feb 13 13:44:23 2006
+++ libmysequoia/src/CarobMySQL.cpp     Fri Feb 17 11:48:25 2006
@@ -101,7 +101,7 @@
 {
   LOG4CXX_DEBUG(logger, "Entering connect: host=" << host << " user=" << user 
<< " passwd=" << passwd << " db=" << db << " port=" << port);
   
-  bool defaultport = port == 0;
+  bool defaultport = false;
   
   if (mysqlPtr->status != MYSQL_STATUS_READY)
   {
@@ -152,14 +152,20 @@
     
   if (!port)
   {
-    //check if the cnf file contains the hardcoded mysql port (3306)
-    //if so, then first try to connect to the default sequoia port (25322)
-    //and if is unsuccessful, then to the 3306 port.
-    port = mysqlPtr->options.port == 3306 ? 25322 : mysqlPtr->options.port;
+    port = mysqlPtr->options.port;
     if (!port)
       port = 25322;
   }
   
+  //check if the port contains the hardcoded mysql port (3306)
+  //if so, then first try to connect to the default sequoia port (25322)
+  //and if is unsuccessful, then to the 3306 port.
+  if (port == 3306)
+  {
+    port = 25322;
+    defaultport = true;
+  }
+  
   /* set the default character set if not set */
   if (!mysqlPtr->options.charset_name)
     mysqlPtr->options.charset_name = cstrdup("latin1");
@@ -287,14 +293,15 @@
       stmtPtr->setQueryTimeout(mysqlPtr->options.read_timeout);
       stmtPtr->setFetchSize(1);
     }
-  
+
+    FREE_AND_NULL_ARRAY(mysqlPtr->info);
+
     if (stmtPtr->execute(fromString(std::string(query,length))))
     {
       mysqlPtr->affected_rows = 0;
       drsPtr = stmtPtr->getResultSet();
       mysqlPtr->field_count = drsPtr ? drsPtr->getNumberOfColumns() : 0;
       mysqlPtr->status = MYSQL_STATUS_GET_RESULT;
-      FREE_AND_NULL_ARRAY(mysqlPtr->info);
       LOG4CXX_INFO(logger, "Executed query with result set. Field_count=" << 
mysqlPtr->field_count);
     }
     else

_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits

Reply via email to