Date: Wednesday, February 1, 2006 @ 10:25:56
  Author: zsolt
    Path: /cvsroot/carob/libmysequoia

Modified: include/CarobMySQL.hpp (1.24 -> 1.25) src/CarobMySQL.cpp (1.44
          -> 1.45) src/MySQLAPI.cpp (1.41 -> 1.42)

-reset the last error after each successfully executed command 
-commented out more debug info


------------------------+
 include/CarobMySQL.hpp |    5 +++++
 src/CarobMySQL.cpp     |   31 +++++++++++++++++++++++++++++++
 src/MySQLAPI.cpp       |    5 +++--
 3 files changed, 39 insertions(+), 2 deletions(-)


Index: libmysequoia/include/CarobMySQL.hpp
diff -u libmysequoia/include/CarobMySQL.hpp:1.24 
libmysequoia/include/CarobMySQL.hpp:1.25
--- libmysequoia/include/CarobMySQL.hpp:1.24    Tue Jan 31 11:25:47 2006
+++ libmysequoia/include/CarobMySQL.hpp Wed Feb  1 10:25:56 2006
@@ -256,6 +256,11 @@
   void set_error (int errcode, const char *errmsg, const char *sqlstate);
 
   /**
+   * Reset the error codes
+   */
+  void reset_error ();
+  
+  /**
    * Allocates a row from the freshly fetched results
    * @param row the resulting row
    * @param fields pointer to the field structure to update the max column 
length or null
Index: libmysequoia/src/CarobMySQL.cpp
diff -u libmysequoia/src/CarobMySQL.cpp:1.44 
libmysequoia/src/CarobMySQL.cpp:1.45
--- libmysequoia/src/CarobMySQL.cpp:1.44        Wed Feb  1 09:13:24 2006
+++ libmysequoia/src/CarobMySQL.cpp     Wed Feb  1 10:25:56 2006
@@ -187,6 +187,8 @@
       set_connect_info(host, user, passwd, db, port);
 
       LOG4CXX_INFO(logger, "Connected: host=" << host << " user=" << user << " 
passwd=" << passwd << " db=" << db << " port=" << port);
+      
+      reset_error();
 
       connectionPtr = newConnectionPtr;
       
@@ -285,6 +287,8 @@
       LOG4CXX_INFO(logger, "Executed query. Affected_rows=" << 
mysqlPtr->affected_rows);
     }
 
+    reset_error();
+
     LOG4CXX_DEBUG(logger, "Leaving real_query: result=1");
     return true;
   }
@@ -364,6 +368,8 @@
         mysqlPtr->field_count = result->field_count;
         mysqlPtr->affected_rows = result->row_count;
         mysqlPtr->fields = result->fields;
+
+        reset_error();
       }
 #ifdef MYSQL5
       else
@@ -402,6 +408,9 @@
     unsigned long len;
     alloc_row_data(liveResultPtr->row, liveResultPtr->fields, 
liveResultPtr->field_count, len, liveResultPtr->lengths);
     LOG4CXX_DEBUG(logger, "Leaving fetch_row: result=" << liveResultPtr->row);
+
+    reset_error();
+
     return (liveResultPtr->current_row = liveResultPtr->row);
   }
   else
@@ -409,6 +418,9 @@
     liveResultPtr->eof = 1;
     liveResultPtr->current_row = 0;
     LOG4CXX_DEBUG(logger, "Leaving fetch_row: result=0");
+
+    reset_error();
+
     return 0;
   }
 }
@@ -444,6 +456,8 @@
         mysqlPtr->affected_rows = stmtPtr->getUpdateCount();
         mysqlPtr->status = MYSQL_STATUS_GET_RESULT;
       }
+
+      reset_error();
     }
     catch (CarobException &e)
     {
@@ -542,6 +556,9 @@
   {
     connectionPtr->setAutoCommit(mode);
     LOG4CXX_DEBUG(logger, "Leaving set_autocommit: result=1");
+
+    reset_error();
+
     return true;
   }
   catch (CarobException &e)
@@ -568,6 +585,9 @@
   {
     connectionPtr->commit();
     LOG4CXX_DEBUG(logger, "Leaving commit: result=1");
+
+    reset_error();
+
     return true;
   }
   catch (CarobException &e)
@@ -594,6 +614,9 @@
   {
     connectionPtr->rollback();
     LOG4CXX_DEBUG(logger, "Leaving rollback: result=1");
+
+    reset_error();
+
     return true;
   }
   catch (CarobException &e)
@@ -746,6 +769,14 @@
 }
 
 void
+CarobMYSQL::reset_error ()
+{
+  mysqlPtr->net.last_errno = 0;
+  *mysqlPtr->net.last_error = 0;
+  *mysqlPtr->net.sqlstate = 0;
+}
+
+void
 CarobMYSQL::alloc_row_data(MYSQL_ROW &row, MYSQL_FIELD *fields, const unsigned 
int field_count, unsigned long &length, unsigned long *lengths)
 {
 //Commented out because the debug info get unusable
Index: libmysequoia/src/MySQLAPI.cpp
diff -u libmysequoia/src/MySQLAPI.cpp:1.41 libmysequoia/src/MySQLAPI.cpp:1.42
--- libmysequoia/src/MySQLAPI.cpp:1.41  Tue Jan 31 16:31:52 2006
+++ libmysequoia/src/MySQLAPI.cpp       Wed Feb  1 10:25:56 2006
@@ -568,7 +568,8 @@
 MYSQL_FIELD *STDCALL
 mysql_fetch_field (MYSQL_RES * res)
 {
-  LOG4CXX_DEBUG(logger, "Entering mysql_fetch_field: res=" << res);
+//Commented out because the debug info get unusable
+//  LOG4CXX_DEBUG(logger, "Entering mysql_fetch_field: res=" << res);
 
   MYSQL_FIELD *result;
   
@@ -577,7 +578,7 @@
   else
     result = 0;
 
-  LOG4CXX_DEBUG(logger, "Leaving mysql_fetch_field: result=" << result);
+//  LOG4CXX_DEBUG(logger, "Leaving mysql_fetch_field: result=" << result);
   return result;
 }
 

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

Reply via email to