Date: Tuesday, August 29, 2006 @ 21:41:12
  Author: marc
    Path: /cvsroot/carob/carob/src

Modified: Connection.cpp (1.85 -> 1.86)

Minor re-orgs before CAROB-95


----------------+
 Connection.cpp |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)


Index: carob/src/Connection.cpp
diff -u carob/src/Connection.cpp:1.85 carob/src/Connection.cpp:1.86
--- carob/src/Connection.cpp:1.85       Fri Aug 25 19:56:56 2006
+++ carob/src/Connection.cpp    Tue Aug 29 21:41:12 2006
@@ -425,17 +425,19 @@
   // autocommit false -> true
   if (autoCommitPrm)
   {
+    if (isDebugEnabled())
+      logDebug(fctName, L"Setting connection in autocommit mode");
+
     FO_TRY_NTIMES(RECONNECT_RETRIES)
-      if (isDebugEnabled())
-        logDebug(fctName, L"Setting connection in autocommit mode");
       sendCommand(*driverSocketPtr, SetAutoCommit);
       bool ack = false;
       ack = receiveBoolOrException();
+    FO_CATCH_NTIMES
+
       writeExecutedInTransaction = false;
       transactionId = 0;
       autoCommit = true;
       return;
-    FO_CATCH_NTIMES
   }
   else // autocommit true -> false
   {
@@ -508,12 +510,12 @@
           + L", expected transaction ID = "
           + toUserString(transactionId) + L")"));
     }
-    // Commit must be followed by a BEGIN
-    mustBeginTransaction = true;
   }
   catch (SocketIOException e)
   { // Connection failed, try to reconnect and re-exec the commit
     reconnectOrDie();
+
+    // FIXME: we should probably retry NTIMES here
     int64_t acknowledgedTransactionId = retrieveCommitResult();
     if (acknowledgedTransactionId != transactionId)
     {
@@ -525,8 +527,14 @@
 
     // The controller will automatically redo the commit if it was not done
     // earlier so we can safely return here, this is a success.
-    return;
   }
+
+  // Success (with or without reconnection)
+
+  // Commit must be followed by a BEGIN
+  mustBeginTransaction = true;
+  writeExecutedInTransaction = false;
+
 }
 
 void Connection::rollback() throw (SocketIOException, DriverException,

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

Reply via email to