Date: Thursday, February 16, 2006 @ 16:07:47
  Author: gilles
    Path: /cvsroot/carob/carob

Modified: include/Connection.hpp (1.59 -> 1.60) src/Connection.cpp (1.66
          -> 1.67)

Fixed missing connection-state restore after reconnection


------------------------+
 include/Connection.hpp |    2 +-
 src/Connection.cpp     |   22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)


Index: carob/include/Connection.hpp
diff -u carob/include/Connection.hpp:1.59 carob/include/Connection.hpp:1.60
--- carob/include/Connection.hpp:1.59   Thu Feb 16 11:55:59 2006
+++ carob/include/Connection.hpp        Thu Feb 16 16:07:47 2006
@@ -67,7 +67,7 @@
 #define Reset                                   31
 #define FetchNextResultSetRows                  32
 #define CloseRemoteResultSet                    33
-//#define RestoreConnectionState                  34
+#define RestoreConnectionState                  34
 #define SetAutoCommit                           35
 //#define ConnectionGetCatalog                    36
 //#define ConnectionGetCatalogs                   37
Index: carob/src/Connection.cpp
diff -u carob/src/Connection.cpp:1.66 carob/src/Connection.cpp:1.67
--- carob/src/Connection.cpp:1.66       Thu Feb 16 11:55:59 2006
+++ carob/src/Connection.cpp    Thu Feb 16 16:07:47 2006
@@ -1004,6 +1004,28 @@
       logWarn(fctName, msg);
     throw DriverException(msg+ce.description());
   }
+
+  // Connection succeeded, restore the previous connection state on the
+  // controller
+  try
+  {
+    if (isInfoEnabled())
+      logInfo(fctName, L"Restoring connection state on controller "
+          + static_cast<wstring>(connected_controller));
+    sendCommand(*driverSocketPtr, RestoreConnectionState);
+    *driverSocketPtr<<writeExecutedInTransaction;
+    *driverSocketPtr<<autoCommit;
+    if (!autoCommit)
+      *driverSocketPtr<<transactionId;
+    *driverSocketPtr<<persistent_connection;
+    if (persistent_connection)
+      *driverSocketPtr<<persistent_connection_id;
+  }
+  catch (SocketIOException sioe)
+  {
+    throw (DriverException(L"Failed to reconnect to controller"
+        + sioe.description()));
+  }
 }
 
 

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

Reply via email to