Author: rfm
Date: Wed Oct 14 15:28:52 2015
New Revision: 39067

URL: http://svn.gna.org/viewcvs/gnustep?rev=39067&view=rev
Log:
morte error handling fixups

Modified:
    libs/sqlclient/trunk/Postgres.m

Modified: libs/sqlclient/trunk/Postgres.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/Postgres.m?rev=39067&r1=39066&r2=39067&view=diff
==============================================================================
--- libs/sqlclient/trunk/Postgres.m     (original)
+++ libs/sqlclient/trunk/Postgres.m     Wed Oct 14 15:28:52 2015
@@ -664,8 +664,12 @@
           if (result != 0)
             {
               PQclear(result);
-            }
-          [self backendDisconnect];
+              result = 0;
+            }
+          if (PQstatus(connection) != CONNECTION_OK)
+            {
+              [self backendDisconnect];
+            }
          [NSException raise: SQLException format: @"Error executing %@: %@",
            stmt, str];
        }
@@ -677,13 +681,11 @@
     }
   NS_HANDLER
     {
-      NSString *n = [localException name];
-
       if (result != 0)
        {
          PQclear(result);
        }
-      if (YES == connected && [n isEqual: SQLConnectionException] == YES) 
+      if (YES == connected && PQstatus(connection) != CONNECTION_OK)
        {
          [self disconnect];
        }
@@ -1020,8 +1022,12 @@
           if (result != 0)
             {
               PQclear(result);
-            }
-          [self backendDisconnect];
+              result = 0;
+            }
+          if (PQstatus(connection) != CONNECTION_OK)
+            {
+              [self backendDisconnect];
+            }
          [NSException raise: SQLException format: @"Error executing %@: %@",
            stmt, str];
        }
@@ -1142,13 +1148,12 @@
     }
   NS_HANDLER
     {
-      NSString *n = [localException name];
-
       if (result != 0)
        {
          PQclear(result);
-       }
-      if (YES == connected && [n isEqual: SQLConnectionException] == YES) 
+          result = 0;
+       }
+      if (YES == connected && PQstatus(connection) != CONNECTION_OK)
        {
          [self disconnect];
        }


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to