Date: Thursday, January 25, 2007 @ 16:56:57
  Author: marc
    Path: /cvsroot/carob/carob/src

Modified: Connection.cpp (1.104 -> 1.105) DriverResultSet.cpp (1.61 ->
          1.62) Statement.cpp (1.33 -> 1.34)

Got rid of "unused fctName" warnings by actually using fctName (couple
more logs, prefixed exception messages)


---------------------+
 Connection.cpp      |   32 +++++++++++++++++++++++++-------
 DriverResultSet.cpp |    2 +-
 Statement.cpp       |   12 ++++++++----
 3 files changed, 34 insertions(+), 12 deletions(-)


Index: carob/src/Connection.cpp
diff -u carob/src/Connection.cpp:1.104 carob/src/Connection.cpp:1.105
--- carob/src/Connection.cpp:1.104      Thu Jan 25 16:10:52 2007
+++ carob/src/Connection.cpp    Thu Jan 25 16:56:57 2007
@@ -106,13 +106,32 @@
     return;
   }
   // exceptions must be reported to the user
-  catch (...)
+  catch (const CarobException& ce)
   {
+    logError(fctName, ce.description());
+
     // Clean all: we are in constructor, destructor won't be called !
     delete driverSocketPtr; driverSocketPtr = NULL;
     parameters.releaseControllerPool();
     throw;
   }
+  catch (const std::exception& se)
+  {
+    logFatal(fctName, StaticCodecs::fromASCII(se.what()));
+
+    delete driverSocketPtr; driverSocketPtr = NULL;
+    parameters.releaseControllerPool();
+    throw;
+  }
+  catch (...)
+  {
+    logFatal(fctName, L"unknown exception type");
+
+    delete driverSocketPtr; driverSocketPtr = NULL;
+    parameters.releaseControllerPool();
+    throw;
+  }
+
 }
 
 Connection::~Connection()
@@ -435,9 +454,8 @@
   checkIfConnected();
 
   if (autoCommit)
-  {
-    throw DriverException(L"Trying to commit a connection in autocommit mode");
-  }
+    throw DriverException(std::wstring(fctName)
+                         + L": trying to commit a connection in autocommit 
mode");
 
   // Check if we are not committing an empty transaction (not started yet)
   if (mustBeginTransaction)
@@ -499,9 +517,8 @@
   checkIfConnected();
 
   if (autoCommit)
-  {
-    throw DriverException(L"Trying to rollback a connection in autocommit 
mode");
-  }
+    throw DriverException(std::wstring(fctName)
+                         + L": trying to rollback a connection in autocommit 
mode");
 
   // Check if we are not rollbacking an empty transaction (not started yet)
   if (mustBeginTransaction)
@@ -1179,6 +1196,7 @@
   {
     try
     {
+      logWarn(fctName, L"tryToReconnect()");
       tryToReconnect();
       reconnected = true;
     }
Index: carob/src/DriverResultSet.cpp
diff -u carob/src/DriverResultSet.cpp:1.61 carob/src/DriverResultSet.cpp:1.62
--- carob/src/DriverResultSet.cpp:1.61  Thu Jan 25 16:10:52 2007
+++ carob/src/DriverResultSet.cpp       Thu Jan 25 16:56:57 2007
@@ -166,7 +166,7 @@
   TypeTag colTypes(socket);
   if (colTypes != TT_COL_TYPES)
   {
-    throw ProtocolException(L"Column types were expected");
+    throw ProtocolException(std::wstring(fctName) + L"Column types were 
expected");
   }
 
   socket>>nbOfRows;
Index: carob/src/Statement.cpp
diff -u carob/src/Statement.cpp:1.33 carob/src/Statement.cpp:1.34
--- carob/src/Statement.cpp:1.33        Thu Jan 25 16:10:52 2007
+++ carob/src/Statement.cpp     Thu Jan 25 16:56:57 2007
@@ -104,7 +104,8 @@
   const wchar_t fctName[] = L"Statement::execute";
   if (isClosed())
   {
-    throw DriverException(L"Unable to execute query on a closed statement");
+    throw DriverException(std::wstring(fctName)
+                         + L": unable to execute query on a closed statement");
   }
   // invalidate the last results
   cleanUpResults();
@@ -129,7 +130,8 @@
   const wchar_t fctName[] = L"Statement::executeQuery";
   if (isClosed())
   {
-    throw DriverException(L"Unable to execute query on a closed statement");
+    throw DriverException(std::wstring(fctName)
+                         + L": unable to execute query on a closed statement");
   }
   // invalidate the last write result
   cleanUpResults();
@@ -147,7 +149,8 @@
   resultList.push_back(endOfResultList);
   resultListIterator = resultList.begin();
   if (!getMoreResults())
-    throw DriverException(L"Invalid executeQuery result !");
+    throw DriverException(std::wstring(fctName)
+                         + L": invalid executeQuery result !");
   return lastResultPtr;
 }
 
@@ -159,7 +162,8 @@
   const wchar_t fctName[] = L"Statement::executeUpdate";
   if (isClosed())
   {
-    throw DriverException(L"Unable to execute query on a closed statement");
+    throw DriverException(std::wstring(fctName)
+                         + L": unable to execute query on a closed statement");
   }
   sql_request = trim(skeleton);
   cleanUpResults();

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

Reply via email to