From: Neil T. <nt...@us...> - 2006-08-11 18:05:22
|
Update of /cvsroot/pgsqlformac/pgCocoaDB In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29745 Modified Files: ChangeLog Connection.h Connection.m DataSource.m Database.m Databases.m ExplorerModel.m ExplorerNode.m Field.m Fields.m Record.h Record.m RecordSet.m Table.m Log Message: Fix a number of memory issues. Index: RecordSet.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/RecordSet.m,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RecordSet.m 7 May 2006 17:32:30 -0000 1.3 --- RecordSet.m 11 Aug 2006 18:01:26 -0000 1.4 *************** *** 21,24 **** --- 21,32 ---- } + -(void) dealloc + { + [items removeAllObjects]; + [items release]; + + [super dealloc]; + } + // collection management *************** *** 26,32 **** { Record *newItem = [[Record alloc] init]; ! [newItem retain]; ! [items addObject:newItem]; return newItem; } --- 34,40 ---- { Record *newItem = [[Record alloc] init]; ! [items addObject:newItem]; + [newItem release]; return newItem; } Index: Table.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Table.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Table.m 11 Mar 2006 22:32:32 -0000 1.2 --- Table.m 11 Aug 2006 18:01:26 -0000 1.3 *************** *** 12,15 **** --- 12,23 ---- @implementation Table + -(void)dealloc + { + [schema release]; + [name release]; + [owner release]; + [super dealloc]; + } + - (NSString *)schema { return [[schema retain] autorelease]; Index: Record.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Record.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Record.h 8 Mar 2005 15:45:10 -0000 1.1.1.1 --- Record.h 11 Aug 2006 18:01:25 -0000 1.2 *************** *** 17,20 **** - (Fields *)fields; - @end --- 17,19 ---- Index: ExplorerModel.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ExplorerModel.m,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ExplorerModel.m 16 Jul 2006 23:13:06 -0000 1.7 --- ExplorerModel.m 11 Aug 2006 18:01:25 -0000 1.8 *************** *** 79,83 **** [titleNode setBaseTable:tableName]; [titleNode setBaseSchema:schemaName]; ! [aParent addChild:titleNode]; //NSLog(@"Processing %@ - %@", schemaName, tableName); --- 79,84 ---- [titleNode setBaseTable:tableName]; [titleNode setBaseSchema:schemaName]; ! [aParent addChild:titleNode]; ! [titleNode release]; //NSLog(@"Processing %@ - %@", schemaName, tableName); *************** *** 155,159 **** [titleNode setParent:aParent]; [aParent addChild:titleNode]; ! results = [schema getTriggerNamesFromSchema:schemaName fromTableName:tableName]; for (i = 0; i < [results count]; i++) --- 156,161 ---- [titleNode setParent:aParent]; [aParent addChild:titleNode]; ! [titleNode release]; ! results = [schema getTriggerNamesFromSchema:schemaName fromTableName:tableName]; for (i = 0; i < [results count]; i++) *************** *** 187,190 **** --- 189,193 ---- [titleNode setParent:aParent]; [aParent addChild:titleNode]; + [titleNode release]; results = [schema getConstraintNamesFromSchema:schemaName fromTableName:tableName]; *************** *** 220,223 **** --- 223,227 ---- [titleNode setParent:aParent]; [aParent addChild:titleNode]; + [titleNode release]; results = [schema getIndexNamesFromSchema:schemaName fromTableName:tableName]; *************** *** 306,310 **** { schemaName = [[[[results itemAtIndex: i] fields] itemAtIndex:0] value]; - // skip some schemas if ([schemaName isCaseInsensitiveLike:@"information_schema"]) --- 310,313 ---- *************** *** 474,483 **** if ([identifier isEqual:@"col1"]) { ! if ([[item explorerType] isEqualToString:@"Schema Child"] ) { NSDictionary *attributes = [[NSDictionary alloc] initWithObjectsAndKeys:[NSColor blueColor], NSForegroundColorAttributeName, nil]; ! NSAttributedString *myString = [[NSAttributedString alloc] initWithString:[item name] attributes: attributes]; return myString; ! } else { --- 477,488 ---- if ([identifier isEqual:@"col1"]) { ! NSRange range = [[item explorerType] rangeOfString:@"Title"]; ! if (([[item explorerType] isEqualToString:@"Schema Child"] ) || (range.length != 0)) { NSDictionary *attributes = [[NSDictionary alloc] initWithObjectsAndKeys:[NSColor blueColor], NSForegroundColorAttributeName, nil]; ! NSAttributedString *myString = [[[NSAttributedString alloc] initWithString:[item name] attributes: attributes] autorelease]; ! [attributes release]; return myString; ! } else { Index: ChangeLog =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ChangeLog,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ChangeLog 16 Jul 2006 23:13:06 -0000 1.12 --- ChangeLog 11 Aug 2006 18:01:25 -0000 1.13 *************** *** 1,2 **** --- 1,9 ---- + 2006-07-16 18:13 ntiffin + + * ChangeLog, Connection.h, Connection.m, ExplorerModel.m, + ExplorerNode.h, ExplorerNode.m, Schema.h, Schema.m, + UnitTest/pgCocoaDBSchemaTest.m: Add color to Explorer View, add + index count function. + 2006-06-24 11:16 ntiffin *************** *** 42,45 **** --- 49,58 ---- * ChangeLog: Update ChangeLog. + 2006-05-13 13:04 ntiffin + + * ChangeLog, ExplorerModel.h, ExplorerModel.m, ExplorerNode.h, + ExplorerNode.m: More tweeks to get Explorer working with + QueryTool. Re-sync after sourceforge cvs outage. + 2006-05-07 12:32 ntiffin *************** *** 71,75 **** 2006-03-15 18:01 ntiffin ! * UnitTest/pgCocoaDBSchemaTest.m: First pass at Explorer logic. 2006-03-12 10:33 ntiffin --- 84,90 ---- 2006-03-15 18:01 ntiffin ! * ExplorerModel.h, ExplorerModel.m, ExplorerNode.h, ExplorerNode.m, ! Schema.h, Schema.m, UnitTest/pgCocoaDBSchemaTest.m: First pass at ! Explorer logic. 2006-03-12 10:33 ntiffin Index: Fields.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Fields.m,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Fields.m 7 May 2006 17:32:30 -0000 1.4 --- Fields.m 11 Aug 2006 18:01:25 -0000 1.5 *************** *** 22,25 **** --- 22,33 ---- } + -(void)dealloc + { + [items removeAllObjects]; + [items release]; + + [super dealloc]; + } + // collection management *************** *** 27,33 **** { Field *newItem = [[Field alloc] init]; - [newItem retain]; [items addObject: newItem]; return newItem; } --- 35,41 ---- { Field *newItem = [[Field alloc] init]; [items addObject: newItem]; + [newItem release]; return newItem; } Index: Database.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Database.m,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Database.m 8 Mar 2005 15:45:10 -0000 1.1.1.1 --- Database.m 11 Aug 2006 18:01:25 -0000 1.2 *************** *** 15,26 **** self = [super init]; ! name = [[[[NSString alloc] init] retain] autorelease]; return self; } - (NSString *)name { ! return [[name retain] autorelease]; } --- 15,32 ---- self = [super init]; ! name = nil; return self; } + -(void)dealloc + { + [name release]; + [super dealloc]; + } + - (NSString *)name { ! return name; } Index: DataSource.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/DataSource.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DataSource.m 7 May 2006 17:32:30 -0000 1.2 --- DataSource.m 11 Aug 2006 18:01:25 -0000 1.3 *************** *** 16,24 **** items = [[NSMutableArray alloc] init]; - [items retain]; return self; } // collection management --- 16,31 ---- items = [[NSMutableArray alloc] init]; return self; } + -(void)dealloc + { + [items removeAllObjects]; + [items release]; + + [super dealloc]; + } + // collection management *************** *** 26,32 **** { NSMutableDictionary *newItem = [[NSMutableDictionary alloc] init]; - [newItem retain]; [items addObject: newItem]; return newItem; } --- 33,39 ---- { NSMutableDictionary *newItem = [[NSMutableDictionary alloc] init]; [items addObject: newItem]; + [newItem release]; return newItem; } Index: Connection.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Connection.m,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Connection.m 16 Jul 2006 23:13:06 -0000 1.11 --- Connection.m 11 Aug 2006 18:01:25 -0000 1.12 *************** *** 31,43 **** connected = NO; ! host = [[[[NSString alloc] initWithString:@"localhost"] retain] autorelease]; ! port = [[[[NSString alloc] initWithString:@"5432"] retain] autorelease]; ! options = [[[[NSString alloc] init] retain] autorelease]; ! tty = [[[[NSString alloc] init] retain] autorelease]; ! dbName = [[[[NSString alloc] initWithString:@"template1"] retain] autorelease]; dbs = nil; ! errorDescription = [[[[NSString alloc] init] retain] autorelease]; sqlLog = [[NSMutableString alloc] init]; --- 31,43 ---- connected = NO; ! host = [[NSString alloc] initWithString:@"localhost"]; ! port = [[NSString alloc] initWithString:@"5432"]; ! options = [[NSString alloc] init]; ! tty = [[NSString alloc] init]; ! dbName = [[NSString alloc] initWithString:@"template1"]; dbs = nil; ! errorDescription = nil; sqlLog = [[NSMutableString alloc] init]; *************** *** 45,48 **** --- 45,68 ---- } + -(void)dealloc + { + if (connected) + { + [self disconnect]; + } + [host release]; + [port release]; + [options release]; + [tty release]; + [dbName release]; + [userName release]; + [password release]; + [dbs release]; + [errorDescription release]; + [sqlLog release]; + + [super dealloc]; + } + - (BOOL)connect { *************** *** 127,131 **** - (NSString *)host { ! return [[host retain] autorelease]; } --- 147,151 ---- - (NSString *)host { ! return host; } *************** *** 141,145 **** - (NSString *)port { ! return [[port retain] autorelease]; } --- 161,165 ---- - (NSString *)port { ! return port; } *************** *** 155,159 **** - (NSString *)options { ! return [[options retain] autorelease]; } --- 175,179 ---- - (NSString *)options { ! return options; } *************** *** 169,173 **** - (NSString *)tty; { ! return [[tty retain] autorelease]; } --- 189,193 ---- - (NSString *)tty; { ! return tty; } *************** *** 183,187 **** - (NSString *)dbName; { ! return [[dbName retain] autorelease]; } --- 203,207 ---- - (NSString *)dbName; { ! return dbName; } *************** *** 197,201 **** - (NSString *)userName { ! return [[userName retain] autorelease]; } --- 217,221 ---- - (NSString *)userName { ! return userName; } *************** *** 211,215 **** - (NSString *)password { ! return [[password retain] autorelease]; } --- 231,235 ---- - (NSString *)password { ! return password; } *************** *** 284,292 **** if (currentDatabase) { ! return [[[NSString stringWithCString:currentDatabase] retain] autorelease]; } else { ! return [[NSString alloc] initWithString:@"Current database not defined."];; } } --- 304,312 ---- if (currentDatabase) { ! return [NSString stringWithCString:currentDatabase]; } else { ! return [NSString stringWithString:@"Current database not defined."]; } } *************** *** 295,299 **** - (NSString *)errorDescription; { ! return [[errorDescription retain] autorelease]; } --- 315,326 ---- - (NSString *)errorDescription; { ! return errorDescription; ! } ! ! - (void)setErrorDescription:(NSString *)ed; ! { ! [errorDescription release]; ! errorDescription = ed; ! [errorDescription retain]; } *************** *** 301,305 **** - (NSMutableString *)sqlLog; { ! return [[sqlLog retain] autorelease]; } --- 328,332 ---- - (NSMutableString *)sqlLog; { ! return sqlLog; } *************** *** 362,368 **** if (pgconn == nil) { ! errorDescription = [[NSString alloc] initWithString:@"Object is not Connected."]; ! [[errorDescription retain] autorelease]; ! return nil; } --- 389,393 ---- if (pgconn == nil) { ! [self setErrorDescription:@"Object is not Connected."]; return nil; } *************** *** 387,391 **** { // build the recordset ! RecordSet *rs = [[[[RecordSet alloc] init] retain] autorelease]; long nFields = PQnfields(res); long nRecords = PQntuples(res); --- 412,416 ---- { // build the recordset ! RecordSet *rs = [[[RecordSet alloc] init] autorelease]; long nFields = PQnfields(res); long nRecords = PQntuples(res); *************** *** 448,454 **** default: { ! errorDescription = [[NSString alloc] initWithFormat:@"PostgreSQL Error: %s", ! PQresultErrorMessage(res)]; ! [[errorDescription retain] autorelease]; PQclear(res); return nil; --- 473,477 ---- default: { ! [self setErrorDescription:[NSString stringWithFormat:@"PostgreSQL Error: %s", PQresultErrorMessage(res)]]; PQclear(res); return nil; *************** *** 465,472 **** if (pgconn == nil) { ! [errorDescription release]; ! errorDescription = [[NSString alloc] initWithString:@"Object is not Connected."]; ! [[errorDescription retain] autorelease]; ! return nil; } --- 488,492 ---- if (pgconn == nil) { ! [self setErrorDescription:[NSString stringWithString:@"Object is not Connected."]]; return nil; } *************** *** 475,481 **** if (PQresultStatus(res) != PGRES_COMMAND_OK) { ! [errorDescription release]; ! errorDescription = [[NSString alloc] initWithString:@"Command failed."]; ! [[errorDescription retain] autorelease]; PQclear(res); return nil; --- 495,499 ---- if (PQresultStatus(res) != PGRES_COMMAND_OK) { ! [self setErrorDescription:[NSString stringWithString:@"Command failed."]]; PQclear(res); return nil; *************** *** 496,504 **** PGcancel * pg_cancel = PQgetCancel(pgconn); ! result = PQcancel(pg_cancel, buffer, 512); ! PQfreeCancel(pg_cancel); ! [errorDescription release]; ! errorDescription = [[NSString alloc] initWithFormat:@"%s", buffer]; return result; } --- 514,520 ---- PGcancel * pg_cancel = PQgetCancel(pgconn); ! result = PQcancel(pg_cancel, buffer, 512); PQfreeCancel(pg_cancel); ! [self setErrorDescription:[NSString stringWithFormat:@"%s", buffer]]; return result; } Index: Connection.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Connection.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Connection.h 16 Jul 2006 23:13:06 -0000 1.6 --- Connection.h 11 Aug 2006 18:01:25 -0000 1.7 *************** *** 64,67 **** --- 64,68 ---- - (NSString *)errorDescription; + - (void)setErrorDescription:(NSString *)ed; - (NSMutableString *)sqlLog; Index: ExplorerNode.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ExplorerNode.m,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ExplorerNode.m 16 Jul 2006 23:13:06 -0000 1.4 --- ExplorerNode.m 11 Aug 2006 18:01:25 -0000 1.5 *************** *** 23,34 **** -(void)dealloc { ! id node; ! ! while([children count] != 0) ! { ! node = [children lastObject]; ! [children removeLastObject]; ! [node release]; ! } [children release]; children = nil; --- 23,27 ---- -(void)dealloc { ! [children removeAllObjects]; [children release]; children = nil; *************** *** 162,167 **** { [n setParent:self]; ! [n retain]; ! [children addObject:n]; } --- 155,159 ---- { [n setParent:self]; ! [children addObject:n]; } Index: Record.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Record.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Record.m 26 Mar 2006 21:16:40 -0000 1.2 --- Record.m 11 Aug 2006 18:01:25 -0000 1.3 *************** *** 16,27 **** [super init]; ! fields = [[[[Fields alloc] init] retain] autorelease]; return self; } - (Fields *)fields { ! return [[fields retain] autorelease]; } --- 16,34 ---- [super init]; ! fields = [[Fields alloc] init]; return self; } + -(void)dealloc + { + [fields release]; + + [super dealloc]; + } + - (Fields *)fields { ! return fields; } Index: Databases.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Databases.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Databases.m 7 May 2006 17:32:30 -0000 1.2 --- Databases.m 11 Aug 2006 18:01:25 -0000 1.3 *************** *** 22,25 **** --- 22,32 ---- } + -(void)dealloc + { + [items removeAllObjects]; + [items release]; + [super dealloc]; + } + // collection management *************** *** 27,33 **** { Database *newItem = [[Database alloc] init]; - [newItem retain]; [items addObject: newItem]; return newItem; } --- 34,40 ---- { Database *newItem = [[Database alloc] init]; [items addObject: newItem]; + [newItem release]; return newItem; } Index: Field.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Field.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Field.m 26 Mar 2006 21:16:40 -0000 1.2 --- Field.m 11 Aug 2006 18:01:25 -0000 1.3 *************** *** 22,28 **** } - (NSString *)name { ! return [[name retain] autorelease]; } --- 22,36 ---- } + -(void)dealloc + { + [name release]; + [value release]; + + [super dealloc]; + } + - (NSString *)name { ! return name; } *************** *** 35,39 **** - (NSString *)value { ! return [[value retain] autorelease]; } --- 43,47 ---- - (NSString *)value { ! return value; } *************** *** 47,51 **** - (NSString *)description { ! return [[[NSString alloc] initWithFormat:@"%@ %@", name, value] autorelease];; } --- 55,59 ---- - (NSString *)description { ! return [NSString stringWithFormat:@"%@ %@", name, value]; } |