Author: rfm
Date: Wed Sep 10 13:49:40 2014
New Revision: 38071
URL: http://svn.gna.org/viewcvs/gnustep?rev=38071&view=rev
Log:
only disconnect when connected
Modified:
libs/sqlclient/trunk/Postgres.m
libs/sqlclient/trunk/SQLClient.h
libs/sqlclient/trunk/SQLClient.m
Modified: libs/sqlclient/trunk/Postgres.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/Postgres.m?rev=38071&r1=38070&r2=38071&view=diff
==============================================================================
--- libs/sqlclient/trunk/Postgres.m (original)
+++ libs/sqlclient/trunk/Postgres.m Wed Sep 10 13:49:40 2014
@@ -392,7 +392,10 @@
{
str = [NSString stringWithCString: cstr];
}
- [self disconnect];
+ if (YES == connected)
+ {
+ [self disconnect];
+ }
[NSException raise: SQLException format: @"Error executing %@: %@",
stmt, str];
}
@@ -412,7 +415,7 @@
{
NSString *n = [localException name];
- if ([n isEqual: SQLConnectionException] == YES)
+ if (YES == connected && [n isEqual: SQLConnectionException] == YES)
{
[self disconnect];
}
@@ -525,7 +528,10 @@
{
str = [NSString stringWithCString: cstr];
}
- [self disconnect];
+ if (YES == connected)
+ {
+ [self disconnect];
+ }
[NSException raise: SQLException format: @"Error executing %@: %@",
stmt, str];
}
@@ -642,7 +648,7 @@
{
NSString *n = [localException name];
- if ([n isEqual: SQLConnectionException] == YES)
+ if (YES == connected && [n isEqual: SQLConnectionException] == YES)
{
[self disconnect];
}
@@ -993,7 +999,10 @@
{
if (extra != 0)
{
- [self disconnect];
+ if (YES == connected)
+ {
+ [self disconnect];
+ }
NSZoneFree(NSDefaultMallocZone(), extra);
}
[super dealloc];
Modified: libs/sqlclient/trunk/SQLClient.h
URL:
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/SQLClient.h?rev=38071&r1=38070&r2=38071&view=diff
==============================================================================
--- libs/sqlclient/trunk/SQLClient.h (original)
+++ libs/sqlclient/trunk/SQLClient.h Wed Sep 10 13:49:40 2014
@@ -568,8 +568,8 @@
/**
* Return a flag to say whether a connection to the database server is
- * currently live. This is mostly useful for debug/reporting, but is
- * used internally to keep track of active connections.
+ * currently live (the value of the 'connected' instance variable).<br />
+ * This is mostly useful for debug/reporting.
*/
- (BOOL) connected;
Modified: libs/sqlclient/trunk/SQLClient.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/SQLClient.m?rev=38071&r1=38070&r2=38071&view=diff
==============================================================================
--- libs/sqlclient/trunk/SQLClient.m (original)
+++ libs/sqlclient/trunk/SQLClient.m Wed Sep 10 13:49:40 2014
@@ -790,7 +790,7 @@
{
NSTimeInterval when = o->_lastOperation;
- if (when < t)
+ if (when < t && YES == o->connected)
{
[o disconnect];
}
@@ -813,7 +813,7 @@
e = NSEnumerateHashTable(clientsHash);
while (nil != (o = (SQLClient*)NSNextHashEnumeratorItem(&e)))
{
- if ([o connected] == YES)
+ if (YES == o->connected)
{
NSTimeInterval when = o->_lastOperation;
@@ -1028,7 +1028,7 @@
[clientsLock unlock];
nc = [NSNotificationCenter defaultCenter];
[nc removeObserver: self];
- [self disconnect];
+ if (YES == connected) [self disconnect];
[lock release]; lock = nil;
[_client release]; _client = nil;
[_database release]; _database = nil;
@@ -1634,7 +1634,7 @@
{
if ([s isEqual: _database] == NO)
{
- if (connected == YES)
+ if (YES == connected)
{
[self disconnect];
}
@@ -1674,7 +1674,7 @@
NS_VOIDRETURN;
}
}
- if (connected == YES)
+ if (YES == connected)
{
[self disconnect];
}
@@ -1711,7 +1711,7 @@
{
if ([s isEqual: _password] == NO)
{
- if (connected == YES)
+ if (YES == connected)
{
[self disconnect];
}
@@ -1741,7 +1741,7 @@
{
if ([s isEqual: _user] == NO)
{
- if (connected == YES)
+ if (YES == connected)
{
[self disconnect];
}
@@ -2148,7 +2148,10 @@
}
if (c != [self class])
{
- [self disconnect];
+ if (YES == connected)
+ {
+ [self disconnect];
+ }
#ifdef GNUSTEP
GSDebugAllocationRemove(object_getClass(self), self);
#endif
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs