Commits

Tuukka Norri  committed e2a6bae

PostgreSQL 8.3 related fixes
- Changed SQL function method type so that a cast is not needed (fixes #111).
- Wrote a preliminary finalizer for PGTSNotifier.
- PG 8.3 seems to be more strict with notification names. In particular, full stop won't be allowed in the middle of a name. This is a problem, since we use schema qualified names which are the same as tables' names. For now, a warning message shall suffice, but notification names should probably be changed somehow.

  • Participants
  • Parent commits b515acf
  • Branches PGTS

Comments (0)

Files changed (2)

File Framework/Sources/PGTSConnection.m

     NSValue* objectIdentifier = [NSValue valueWithPointer: anObject];
     NSEnumerator* e = [[notificationAssociations objectForKey: objectIdentifier] objectEnumerator];
     NSString* notificationName;
+
+    [notificationAssociations removeObjectForKey: objectIdentifier];
+    [postgresNotificationCenter removeObserver: anObject];
+	
     while ((notificationName = [e nextObject]))
     {
         [notificationCounts removeObject: notificationName];
         if (![notificationCounts containsObject: notificationName])
-        {
-            [self executeQuery: [@"UNLISTEN " stringByAppendingString: notificationName]];
-        }
+			[self executeQuery: [@"UNLISTEN " stringByAppendingString: notificationName]];
     }
-    [notificationAssociations removeObjectForKey: objectIdentifier];
-
-    [postgresNotificationCenter removeObserver: anObject];
 }
 
 @end

File Framework/Sources/PGTSNotifier.m

     return self;
 }
 
+- (void) finalize
+{
+	//FIXME: this requires some consideration.
+	NS_DURING
+		[connection stopListening: self];
+	NS_HANDLER
+	NS_ENDHANDLER
+}
+
 - (void) dealloc
 {
-    [connection stopListening: self];
-    
+	NS_DURING
+		[connection stopListening: self];
+	NS_HANDLER
+		log4Warn (@"Failed to execute UNLISTEN; caught exception: %@.", localException);
+	NS_ENDHANDLER
+				
     [notificationNames release];
     [observedTables release];
     [lastChecks release];