You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(7) |
Jul
(5) |
Aug
(24) |
Sep
(21) |
Oct
(2) |
Nov
|
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
(5) |
Mar
(6) |
Apr
(8) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(23) |
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
(7) |
Oct
(8) |
Nov
(8) |
Dec
(1) |
2009 |
Jan
(5) |
Feb
(6) |
Mar
(1) |
Apr
(1) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(1) |
Nov
(2) |
Dec
|
2010 |
Jan
|
Feb
(2) |
Mar
(2) |
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
(1) |
Oct
(6) |
Nov
(2) |
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(16) |
Oct
(1) |
Nov
|
Dec
|
2012 |
Jan
(9) |
Feb
(6) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(3) |
Oct
(2) |
Nov
(3) |
Dec
|
Update of /cvsroot/pgsqlformac/pgCocoaDB In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11899 Modified Files: ChangeLog Connection.h Connection.m ExplorerModel.h ExplorerModel.m ExplorerNode.h ExplorerNode.m Schema.h Schema.m Log Message: Fix for PGconn not being thread safe. Migrate to new PQconnectdb API. Index: ChangeLog =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ChangeLog,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ChangeLog 30 Aug 2006 21:26:54 -0000 1.19 --- ChangeLog 1 Sep 2006 00:53:35 -0000 1.20 *************** *** 1,2 **** --- 1,8 ---- + 2006-08-30 16:26 ntiffin + + * ChangeLog, ExplorerModel.m, Schema.h, Schema.m, + UnitTest/pgCocoaDBSchemaTest.m: Fix constraints, columns, + triggers. + 2006-08-30 10:48 ntiffin Index: Schema.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Schema.m,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Schema.m 30 Aug 2006 21:26:54 -0000 1.21 --- Schema.m 1 Sep 2006 00:53:35 -0000 1.22 *************** *** 16,20 **** @implementation Schema ! - initWithConnection:(Connection *) theConnection { NSString *sql; --- 16,20 ---- @implementation Schema ! - initWithConnectionString:(NSString *) theConnectionString { NSString *sql; *************** *** 23,29 **** [super init]; ! [connection release]; ! connection = theConnection; ! [connection retain]; publicSchemaName = [[NSString alloc] initWithString: @"public"]; pgCatalogSchemaName = [[NSString alloc] initWithString: @"pg_catalog"]; --- 23,30 ---- [super init]; ! ! connection = [[Connection alloc] init]; ! [connection connectUsingString:theConnectionString]; ! publicSchemaName = [[NSString alloc] initWithString: @"public"]; pgCatalogSchemaName = [[NSString alloc] initWithString: @"pg_catalog"]; *************** *** 65,68 **** --- 66,73 ---- return pgVersionFound; } + - (Connection *)connection; + { + return connection; + } Index: Schema.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Schema.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Schema.h 30 Aug 2006 21:26:54 -0000 1.13 --- Schema.h 1 Sep 2006 00:53:35 -0000 1.14 *************** *** 15,19 **** @interface Schema : NSObject { ! Connection *connection; NSString *publicSchemaName; // is "public" NSString *pgCatalogSchemaName; // is "pg_catalog" --- 15,19 ---- @interface Schema : NSObject { ! Connection * connection; NSString *publicSchemaName; // is "public" NSString *pgCatalogSchemaName; // is "pg_catalog" *************** *** 22,26 **** } ! - initWithConnection:(Connection *) theConnection; - (NSString *)publicSchemaName; --- 22,26 ---- } ! - initWithConnectionString:(NSString *) theConnection; - (NSString *)publicSchemaName; *************** *** 28,31 **** --- 28,32 ---- - (NSString *)informationSchemaName; - (NSString *)pgVersionFound; + - (Connection *)connection; // generate SQL Index: Connection.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Connection.m,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Connection.m 30 Aug 2006 15:48:49 -0000 1.15 --- Connection.m 1 Sep 2006 00:53:35 -0000 1.16 *************** *** 36,39 **** --- 36,45 ---- tty = nil; dbName = [[NSString alloc] initWithString:@"template1"]; + userName = nil; + password = nil; + sslMode = nil; + service = nil; + krbsrvName = nil; + connectionString = nil; errorDescription = nil; *************** *** 55,58 **** --- 61,68 ---- [userName release]; [password release]; + [sslMode release]; + [service release]; + [krbsrvName release]; + [connectionString release]; [dbs release]; [errorDescription release]; *************** *** 62,73 **** } - (BOOL)connect ! { [self disconnect]; ! ! // connect to the server (attempt) // TODO should use PQconnectdb() ! pgconn = (PGconn *)PQsetdbLogin([host cString], [port cString], ! [options cString], NULL, ! [dbName cString], [userName cString], [password cString]); if (PQoptions(pgconn)) { --- 72,87 ---- } + - (BOOL)connect ! { [self disconnect]; ! ! if (connectionString == nil) ! { ! connectionString = [self makeConnectionString]; ! [connectionString retain]; ! } ! NSAssert( (connectionString != nil), @"Attempted to connect to PostgreSQL with empty connectionString."); ! pgconn = (PGconn *)PQconnectdb([connectionString cString]); if (PQoptions(pgconn)) { *************** *** 81,85 **** [self setErrorDescription:[NSString stringWithFormat:@"%s", PQerrorMessage(pgconn)]]; [self appendSQLLog:[NSMutableString stringWithFormat:@"Connection to database %@ Failed.\n", dbName]]; ! PQfinish(pgconn); pgconn = nil; --- 95,99 ---- [self setErrorDescription:[NSString stringWithFormat:@"%s", PQerrorMessage(pgconn)]]; [self appendSQLLog:[NSMutableString stringWithFormat:@"Connection to database %@ Failed.\n", dbName]]; ! PQfinish(pgconn); pgconn = nil; *************** *** 100,104 **** // set up notification PQsetNoticeProcessor(pgconn, handle_pq_notice, self); ! [self setSQLLog:[NSMutableString stringWithFormat:@"Connected to database %@ on %@.\n", dbName, [[NSCalendarDate calendarDate] description]]]; connected = YES; --- 114,118 ---- // set up notification PQsetNoticeProcessor(pgconn, handle_pq_notice, self); ! [self setSQLLog:[NSMutableString stringWithFormat:@"Connected to database %@ on %@.\n", dbName, [[NSCalendarDate calendarDate] description]]]; connected = YES; *************** *** 106,109 **** --- 120,129 ---- } + - (BOOL)connectUsingString:(NSString *)aConnectionString + { + [self setConnectionString:aConnectionString]; + return [self connect]; + } + - (BOOL)connectToHost:(NSString *)toHost onPort:(NSString *)onPort *************** *** 118,121 **** --- 138,142 ---- [self setDbName:userDB]; + [self setConnectionString:nil]; return [self connect]; } *************** *** 159,162 **** --- 180,184 ---- host = [newHost copy]; } + [self setConnectionString:nil]; } *************** *** 173,176 **** --- 195,199 ---- port = [newPort copy]; } + [self setConnectionString:nil]; } *************** *** 187,190 **** --- 210,214 ---- options = [newOptions copy]; } + [self setConnectionString:nil]; } *************** *** 201,204 **** --- 225,229 ---- tty = [newTty copy]; } + [self setConnectionString:nil]; } *************** *** 215,218 **** --- 240,244 ---- dbName = [newDbName copy]; } + [self setConnectionString:nil]; } *************** *** 229,232 **** --- 255,259 ---- userName = [value copy]; } + [self setConnectionString:nil]; } *************** *** 243,248 **** --- 270,333 ---- password = [value copy]; } + [self setConnectionString:nil]; + } + + - (NSString *)connectionString + { + return connectionString; + } + + - (void)setConnectionString:(NSString *)value + { + if (connectionString != value) + { + [connectionString release]; + connectionString = [value copy]; + } + } + + - (NSString *)sslMode + { + return sslMode; + } + + - (void)setSslMode:(NSString *)value + { + if (sslMode != value) + { + [sslMode release]; + sslMode = [value copy]; + } + } + + - (NSString *)service; + { + return service; + } + + - (void)setService:(NSString *)value; + { + if (service != value) + { + [service release]; + service = [value copy]; + } + } + + - (NSString *)krbsrvName; + { + return krbsrvName; + } + + - (void)setKrbsrvName:(NSString *)value; + { + if (krbsrvName != value) + { + [krbsrvName release]; + krbsrvName = [value copy]; + } } + - (Databases *)databases { *************** *** 533,535 **** --- 618,669 ---- } + -(NSMutableString *)makeConnectionString + { + NSMutableString *connStr = [[[NSMutableString alloc] init] autorelease]; + + if (connectionString) + { + [connStr appendString:connectionString]; + return connStr; + } + if (host) + { + [connStr appendFormat:@" host='%@' ", host]; + } + if (port) + { + [connStr appendFormat:@" port='%@' ", port]; + } + if (options) + { + [connStr appendFormat:@" options='%@' ", options]; + } + if (dbName) + { + [connStr appendFormat:@" dbname='%@' ", dbName]; + } + if (userName) + { + [connStr appendFormat:@" user='%@' ", userName]; + } + if (password) + { + [connStr appendFormat:@" password='%@' ", password]; + } + if (sslMode) + { + [connStr appendFormat:@" sslmode='%@' ", sslMode]; + } + if (service) + { + [connStr appendFormat:@" service='%@' ", service]; + } + if (krbsrvName) + { + [connStr appendFormat:@" krbsrvname='%@' ", krbsrvName]; + } + return connStr; + } + + @end Index: Connection.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Connection.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Connection.h 30 Aug 2006 15:48:49 -0000 1.8 --- Connection.h 1 Sep 2006 00:53:35 -0000 1.9 *************** *** 20,27 **** NSString *port; NSString *options; ! NSString *tty; NSString *dbName; NSString *userName; NSString *password; Databases *dbs; --- 20,32 ---- NSString *port; NSString *options; ! NSString *tty; // ignored now NSString *dbName; NSString *userName; NSString *password; + NSString *sslMode; // allow, prefer, require + NSString *service; // service name + NSString *krbsrvName; + + NSMutableString *connectionString; Databases *dbs; *************** *** 34,37 **** --- 39,43 ---- - (BOOL)connect; + - (BOOL)connectUsingString:(NSString *)aConnectionString; - (BOOL)connectToHost:(NSString *)toHost onPort:(NSString *)onPort *************** *** 64,70 **** --- 70,88 ---- - (void)setPassword:(NSString *)value; + - (NSString *)sslMode; + - (void)setSslMode:(NSString *)value; + + - (NSString *)service; + - (void)setService:(NSString *)value; + + - (NSString *)krbsrvName; + - (void)setKrbsrvName:(NSString *)value; + - (NSString *)errorDescription; - (void)setErrorDescription:(NSString *)ed; + - (NSString *)connectionString; + - (void)setConnectionString:(NSString *)ed; + - (NSMutableString *)sqlLog; - (void)setSQLLog:(NSString *)value; *************** *** 83,86 **** --- 101,105 ---- - (int)cancelQuery; + - (NSMutableString *)makeConnectionString; @end Index: ExplorerNode.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ExplorerNode.m,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ExplorerNode.m 12 Aug 2006 16:38:16 -0000 1.6 --- ExplorerNode.m 1 Sep 2006 00:53:35 -0000 1.7 *************** *** 81,84 **** --- 81,88 ---- } + -(NSColor *) nameColor + { + return nameColor; + } -(UInt32)oid; *************** *** 95,99 **** -(void)setNameColor:(NSColor *)s { ! ; //TODO } --- 99,105 ---- -(void)setNameColor:(NSColor *)s { ! [s retain]; ! [nameColor release]; ! nameColor = s; } Index: ExplorerModel.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ExplorerModel.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ExplorerModel.h 30 Aug 2006 15:48:49 -0000 1.5 --- ExplorerModel.h 1 Sep 2006 00:53:35 -0000 1.6 *************** *** 18,22 **** { ExplorerNode * rootNode; ! Connection * connection; Schema * schema; bool showInformationSchema; --- 18,23 ---- { ExplorerNode * rootNode; ! NSString * connectionString; ! //Connection *connection; Schema * schema; bool showInformationSchema; *************** *** 30,34 **** } ! - (id)initWithConnection:(Connection *) aConnection; - (void)buildSchema:(id)anObject; --- 31,35 ---- } ! - (id)initWithConnectionString:(NSString *)theConnection; - (void)buildSchema:(id)anObject; Index: ExplorerModel.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ExplorerModel.m,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ExplorerModel.m 30 Aug 2006 21:26:54 -0000 1.14 --- ExplorerModel.m 1 Sep 2006 00:53:35 -0000 1.15 *************** *** 309,320 **** ! - (id)initWithConnection:(Connection *) theConnection { [super init]; ExplorerNode * newNode; ! // TODO clone this connection so we can multi-thread ! connection = theConnection; ! schema = [[Schema alloc] initWithConnection:connection]; explorerThreadStatusLock = [[NSLock alloc] init]; --- 309,318 ---- ! - (id)initWithConnectionString:(NSString *) theConnection { [super init]; ExplorerNode * newNode; ! connectionString = theConnection; explorerThreadStatusLock = [[NSLock alloc] init]; *************** *** 344,348 **** } ! - (void)buildSchema:(id)anOutlineView { --- 342,346 ---- } ! // May be run in a separate thread. - (void)buildSchema:(id)anOutlineView { *************** *** 352,357 **** RecordSet * results; ExplorerNode * realRootNode; ! ! if ((connection == nil) || (schema == nil)) { NSLog(@"Attempted to build Schema without proper init."); --- 350,357 ---- RecordSet * results; ExplorerNode * realRootNode; ! ! schema = [[Schema alloc] initWithConnectionString:connectionString]; ! ! if (schema == nil) { NSLog(@"Attempted to build Schema without proper init."); *************** *** 364,368 **** // set database level realRootNode = [[ExplorerNode alloc] init]; ! [realRootNode setName: [connection currentDatabase]]; [realRootNode setBaseTable: @""]; [realRootNode setExplorerType:@"Database"]; --- 364,368 ---- // set database level realRootNode = [[ExplorerNode alloc] init]; ! [realRootNode setName: [[schema connection] currentDatabase]]; [realRootNode setBaseTable: @""]; [realRootNode setExplorerType:@"Database"]; *************** *** 460,463 **** --- 460,465 ---- [self setExplorerThreadStatus:3]; [(NSOutlineView *)anOutlineView reloadData]; + [schema release]; + schema = nil; [pool release]; return; Index: ExplorerNode.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ExplorerNode.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ExplorerNode.h 30 Aug 2006 15:48:49 -0000 1.4 --- ExplorerNode.h 1 Sep 2006 00:53:35 -0000 1.5 *************** *** 23,26 **** --- 23,27 ---- // for display as a tool tip NSString *baseSchema; + NSColor *nameColor; } |
From: Neil T. <nt...@us...> - 2006-09-01 00:53:38
|
Update of /cvsroot/pgsqlformac/pgCocoaDB/UnitTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11899/UnitTest Modified Files: pgCocoaDBSchemaTest.m Log Message: Fix for PGconn not being thread safe. Migrate to new PQconnectdb API. Index: pgCocoaDBSchemaTest.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/UnitTest/pgCocoaDBSchemaTest.m,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** pgCocoaDBSchemaTest.m 30 Aug 2006 21:26:54 -0000 1.17 --- pgCocoaDBSchemaTest.m 1 Sep 2006 00:53:35 -0000 1.18 *************** *** 296,300 **** STAssertTrue([conn isConnected], @"Failed to connect to database %@.", [conn dbName]); ! testSchema = [[Schema alloc] initWithConnection:conn]; STAssertNotNil(testSchema, @"Failed to init testSchema object."); } --- 296,301 ---- STAssertTrue([conn isConnected], @"Failed to connect to database %@.", [conn dbName]); ! //testSchema = [[Schema alloc] initWithConnection:conn]; ! testSchema = [[Schema alloc] initWithConnectionString:[conn makeConnectionString]]; STAssertNotNil(testSchema, @"Failed to init testSchema object."); } *************** *** 971,975 **** -(void)testExplorer { ! ExplorerModel *explorer = [[ExplorerModel alloc] initWithConnection:conn]; [explorer buildSchema:nil]; --- 972,977 ---- -(void)testExplorer { ! ExplorerModel *explorer =[[ExplorerModel alloc] initWithConnectionString: [conn makeConnectionString]]; ! //ExplorerModel *explorer = [[ExplorerModel alloc] initWithConnection:conn]; [explorer buildSchema:nil]; |
From: Neil T. <nt...@us...> - 2006-08-30 21:26:57
|
Update of /cvsroot/pgsqlformac/pgCocoaDB/UnitTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15828/UnitTest Modified Files: pgCocoaDBSchemaTest.m Log Message: Fix constraints, columns, triggers. Index: pgCocoaDBSchemaTest.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/UnitTest/pgCocoaDBSchemaTest.m,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** pgCocoaDBSchemaTest.m 30 Aug 2006 15:48:49 -0000 1.16 --- pgCocoaDBSchemaTest.m 30 Aug 2006 21:26:54 -0000 1.17 *************** *** 134,137 **** --- 134,141 ---- STAssertTrue([conn errorDescription] == nil, @"Error executing SQL: %@. %@", sql, [conn errorDescription]); + sql = [NSString stringWithFormat:@"ALTER TABLE %@.name ADD CONSTRAINT name_age_check CHECK ((0 < age) AND (age < 150));", PGCocoaTestSchema]; + [conn execQuery:sql]; + STAssertTrue([conn errorDescription] == nil, @"Error executing SQL: %@. %@", sql, [conn errorDescription]); + sql = [NSString stringWithFormat:@"%s%@.%@.%s", "CREATE or REPLACE FUNCTION ", PGCocoaTestDatabase, PGCocoaTestSchema, "create_time_stamp() RETURNS trigger AS $time_stamp$\n\ |
From: Neil T. <nt...@us...> - 2006-08-30 21:26:56
|
Update of /cvsroot/pgsqlformac/pgCocoaDB In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15828 Modified Files: ChangeLog ExplorerModel.m Schema.h Schema.m Log Message: Fix constraints, columns, triggers. Index: Schema.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Schema.m,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Schema.m 30 Aug 2006 15:48:49 -0000 1.20 --- Schema.m 30 Aug 2006 21:26:54 -0000 1.21 *************** *** 87,95 **** } ! -(RecordSet *)getConstraintNamesFromSchema:(NSString *)schemaName fromTableName:(NSString *) tableName { ! // TODO ! return nil; } --- 87,109 ---- } ! /* ! select n.nspname, c.conname, t.relname, c.contype ! from pg_constraint c, pg_namespace n, pg_class t ! where c.connamespace = n.oid ! AND t.oid = c.conrelid; ! */ -(RecordSet *)getConstraintNamesFromSchema:(NSString *)schemaName fromTableName:(NSString *) tableName { ! NSString * sql; ! ! sql = [NSString stringWithFormat:@"SELECT c.conname \ ! FROM pg_constraint c, pg_namespace n, pg_class t \ ! WHERE n.nspname = '%@' AND t.relname = '%@' AND n.oid = c.connamespace AND t.oid = c.conrelid;", schemaName, tableName ]; ! ! #if PGCOCOA_LOG_SQL ! NSLog(sql); ! #endif ! ! return [connection execQueryLogInfoLogSQL:sql];; } *************** *** 263,272 **** sqlFormat = @"SELECT format_type(a.atttypid, a.atttypmod) AS \"type\", \ CASE \ ! WHEN a.attnotnull = TRUE THEN ' NOT NULL' \ ! ELSE NULL \ END as \"notnull\", \ CASE \ ! WHEN a.atthasdef = '1' THEN ' DEFAULT ' || cast(pg_catalog.pg_get_expr(d.adbin, attrelid) AS varchar(100)) \ ! ELSE NULL \ END as \"default\" \ FROM ((pg_class c FULL OUTER JOIN pg_attribute a ON a.attrelid = c.oid) \ --- 277,286 ---- sqlFormat = @"SELECT format_type(a.atttypid, a.atttypmod) AS \"type\", \ CASE \ ! WHEN a.attnotnull = TRUE THEN ' NOT NULL ' \ ! ELSE ' ' \ END as \"notnull\", \ CASE \ ! WHEN a.atthasdef = TRUE THEN 'DEFAULT ' || cast(pg_catalog.pg_get_expr(d.adbin, attrelid) AS varchar(200)) \ ! ELSE ' ' \ END as \"default\" \ FROM ((pg_class c FULL OUTER JOIN pg_attribute a ON a.attrelid = c.oid) \ *************** *** 359,362 **** --- 373,407 ---- // generate SQL + /* + select pg_get_constraintdef(c.oid, false) + from pg_constraint c, pg_namespace n, pg_class t + where c.connamespace = n.oid + AND t.oid = c.conrelid; + */ + -(NSString *)getConstraintSQLFromSchema:(NSString *)schemaName fromTable:(NSString *)tableName fromConstraint:(NSString *)constraintName pretty:(int)pretty; + { + NSString *sql; + RecordSet * results; + + // TODO pretty print? + sql = [NSString stringWithFormat:@"SELECT pg_get_constraintdef(c.oid, false) \ + FROM pg_constraint c, pg_namespace n, pg_class t \ + WHERE n.nspname = '%@' AND t.relname = '%@' AND c.conname = '%@' AND n.oid = c.connamespace AND t.oid = c.conrelid;", schemaName, tableName, constraintName ]; + + #if PGCOCOA_LOG_SQL + NSLog(sql); + #endif + + results = [connection execQueryNoLog:sql]; + if ([results count] == 1) + { + sql = [[NSString alloc] initWithFormat:@"%@\n", [[[[results itemAtIndex: 0] fields] itemAtIndex:0] value]]; + [sql autorelease]; + return sql; + } + return nil; + } + + -(NSString *)getFunctionSQLFromSchema:(NSString *)schemaName fromFunctionName: (NSString *) functionName pretty:(int)pretty { *************** *** 390,393 **** --- 435,439 ---- FROM pg_catalog.pg_proc p, pg_catalog.pg_namespace n \ WHERE n.oid = p.pronamespace AND p.proname = '%@' AND n.nspname = '%@'", functionName, schemaName]; + #if PGCOCOA_LOG_SQL NSLog(sql); *************** *** 612,617 **** } ! -(NSString *)getTriggerSQLFromSchema:(NSString *)schemaName fromTriggerName:(NSString *)triggerName { NSString * sql; --- 658,669 ---- } + /* + select pg_get_triggerdef(tr.oid) + from pg_trigger tr, pg_namespace n, pg_class ta + where ta.relnamespace = n.oid + AND ta.oid = tr.tgrelid; + */ ! -(NSString *)getTriggerSQLFromSchema:(NSString *)schemaName fromTableName:(NSString*)tableName fromTriggerName:(NSString *)triggerName { NSString * sql; *************** *** 619,626 **** // TODO handle schema ! sql = [NSString stringWithFormat:@"%s%@%s", ! "SELECT pg_catalog.pg_get_triggerdef(t.oid) \ ! FROM pg_catalog.pg_trigger t \ ! WHERE t.tgname = ", triggerName]; #if PGCOCOA_LOG_SQL NSLog(sql); --- 671,677 ---- // TODO handle schema ! sql = [NSString stringWithFormat:@"SELECT pg_get_triggerdef(tr.oid) \ ! FROM pg_trigger tr, pg_namespace n, pg_class ta \ ! WHERE n.nspname = '%@' AND ta.relname = '%@' AND tr.tgname = '%@' AND n.oid = ta.relnamespace AND ta.oid = tr.tgrelid;", schemaName, tableName, triggerName ]; #if PGCOCOA_LOG_SQL NSLog(sql); Index: ChangeLog =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ChangeLog,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ChangeLog 30 Aug 2006 15:48:49 -0000 1.18 --- ChangeLog 30 Aug 2006 21:26:54 -0000 1.19 *************** *** 1,2 **** --- 1,11 ---- + 2006-08-30 10:48 ntiffin + + * ChangeLog, Connection.h, Connection.m, DataSource.h, Database.h, + Databases.h, ExplorerModel.h, ExplorerModel.m, ExplorerNode.h, + Field.h, Fields.h, PGCocoaDB.h, Record.h, RecordSet.h, Schema.h, + Schema.m, Table.h, UnitTest-Info.plist, + UnitTest/pgCocoaDBSchemaTest.h, UnitTest/pgCocoaDBSchemaTest.m: + Restructure for schema threaded processing. + 2006-08-26 07:25 ntiffin Index: ExplorerModel.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ExplorerModel.m,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ExplorerModel.m 30 Aug 2006 15:48:49 -0000 1.13 --- ExplorerModel.m 30 Aug 2006 21:26:54 -0000 1.14 *************** *** 69,73 **** ExplorerNode * newNode; NSString * columnName; - NSString * columnInfoString; int i; ExplorerNode *titleNode; --- 69,72 ---- *************** *** 96,100 **** if (columnInfoSet != nil) { ! columnInfoString = [[[[columnInfoSet itemAtIndex: 0] fields] itemAtIndex:0] value]; //NSLog(@"Processing %@ - %@ - %@ - %@", schemaName, tableName, columnName, columnInfoString); //NSLog(@"results count = %d", [results count]); --- 95,105 ---- if (columnInfoSet != nil) { ! int ii; ! NSMutableString *columnInfoString= [[NSMutableString alloc] init]; ! // interate to find NOT NULL and DEFAULT ! for (ii = 0; ii < [[[columnInfoSet itemAtIndex: 0] fields] count]; ii++) ! { ! [columnInfoString appendString:[[[[columnInfoSet itemAtIndex: 0] fields] itemAtIndex:ii] value]]; ! } //NSLog(@"Processing %@ - %@ - %@ - %@", schemaName, tableName, columnName, columnInfoString); //NSLog(@"results count = %d", [results count]); *************** *** 106,109 **** --- 111,115 ---- [newNode setBaseSchema:schemaName]; [titleNode addChild:newNode]; + [columnInfoString autorelease]; } [newNode release]; *************** *** 167,171 **** [newNode setBaseTable:tableName]; [newNode setBaseSchema:schemaName]; ! //[newNode setDisplayColumn2:[schema getTriggerSQLFromSchema:schemaName fromTriggerName:triggerName]]; [titleNode addChild:newNode]; --- 173,177 ---- [newNode setBaseTable:tableName]; [newNode setBaseSchema:schemaName]; ! [newNode setDisplayColumn2:[schema getTriggerSQLFromSchema:schemaName fromTableName:tableName fromTriggerName:triggerName]]; [titleNode addChild:newNode]; *************** *** 198,207 **** [newNode setExplorerType:@"Constraint Name"]; [newNode setParent:titleNode]; ! [newNode setDisplayColumn2:@""]; [newNode setBaseTable:tableName]; [newNode setBaseSchema:schemaName]; [titleNode addChild:newNode]; ! //TODO get constraints info ! [newNode release]; } --- 204,213 ---- [newNode setExplorerType:@"Constraint Name"]; [newNode setParent:titleNode]; ! [newNode setDisplayColumn2:[schema getConstraintSQLFromSchema:schemaName fromTable:tableName fromConstraint:constraintName pretty:0]]; [newNode setBaseTable:tableName]; [newNode setBaseSchema:schemaName]; [titleNode addChild:newNode]; ! //TODO get constraints info? ! [newNode release]; } Index: Schema.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Schema.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Schema.h 30 Aug 2006 15:48:49 -0000 1.12 --- Schema.h 30 Aug 2006 21:26:54 -0000 1.13 *************** *** 30,38 **** // generate SQL -(NSString *)getFunctionSQLFromSchema:(NSString *)schemaName fromFunctionName: (NSString *) functionName pretty:(int)pretty; -(NSString *)getIndexSQLFromSchema:(NSString *)schemaName fromTableName:(NSString *) tableName fromIndexName:(NSString *) indexName; -(NSString *)getRuleSQLFromSchema:(NSString *)schemaName fromRuleName:(NSString *)ruleName pretty:(int)pretty; -(NSString *)getTableSQLFromSchema:(NSString *)schemaName fromTableName:(NSString *) tableName pretty:(int)pretty; ! -(NSString *)getTriggerSQLFromSchema:(NSString *)schemaName fromTriggerName:(NSString *)triggerName; -(NSString *)getViewSQLFromSchema:(NSString *)schemaName fromView:(NSString *)viewName pretty:(int)pretty; --- 30,39 ---- // generate SQL + -(NSString *)getConstraintSQLFromSchema:(NSString *)schemaName fromTable:(NSString *)tableName fromConstraint:(NSString *)constraintName pretty:(int)pretty; -(NSString *)getFunctionSQLFromSchema:(NSString *)schemaName fromFunctionName: (NSString *) functionName pretty:(int)pretty; -(NSString *)getIndexSQLFromSchema:(NSString *)schemaName fromTableName:(NSString *) tableName fromIndexName:(NSString *) indexName; -(NSString *)getRuleSQLFromSchema:(NSString *)schemaName fromRuleName:(NSString *)ruleName pretty:(int)pretty; -(NSString *)getTableSQLFromSchema:(NSString *)schemaName fromTableName:(NSString *) tableName pretty:(int)pretty; ! -(NSString *)getTriggerSQLFromSchema:(NSString *)schemaName fromTableName:(NSString*)tableName fromTriggerName:(NSString *)triggerName; -(NSString *)getViewSQLFromSchema:(NSString *)schemaName fromView:(NSString *)viewName pretty:(int)pretty; |
From: Neil T. <nt...@us...> - 2006-08-30 21:25:52
|
Update of /cvsroot/pgsqlformac/QueryTool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15451 Modified Files: MyOutlineView.m TODO.txt Log Message: Improve wording of menu items. Index: TODO.txt =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/TODO.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TODO.txt 30 Aug 2006 01:06:53 -0000 1.7 --- TODO.txt 30 Aug 2006 21:25:49 -0000 1.8 *************** *** 4,14 **** TODO - Features, Functions and Warnings (in priority order) ======================================= ! - 2006-06-02 Trigger SQL not complete. ! ! - 2006-06-16 Use new function to attempt to cancel a query in pgCocoaDB. Need to change to async queries. ! - 2006-08-13 Move Schema reading to another thread. Make it load in parallel. ! - 2006-08-18 Message during schema load is misleading. - 2006-08-26 Add save log function. --- 4,12 ---- TODO - Features, Functions and Warnings (in priority order) ======================================= ! - 2006_08-30 Sequence SQL not complete. ! - 2006-08-30 Constraints not tested in unit test pgCocoaDB. ! - 2006-06-16 Use function to attempt to cancel a query in pgCocoaDB. Need to change to async queries. - 2006-08-26 Add save log function. *************** *** 35,38 **** --- 33,46 ---- Completed ========= + - 2006-08-30 Column definitions only show type, not constraints (NOT NULL, UNIQUE, etc). (8/30/2006) + + - 2006-08-30 Constraints not in schema. (8/30/2006) + + - 2006-06-02 Trigger SQL not complete. (8/30/2006) + + - 2006-08-18 Message during schema load is misleading. Not relevant with threaded schema load. (8/30/2006) + + - 2006-08-13 Move Schema reading to another thread. Make it load in parallel. (8/30/2006) + - 2006-08-13 SQL Log does not contain enough information. (8/24/2006) *************** *** 41,47 **** - 2006-08-13 Fix bug with incorrect release of explorer while display was still using it. ! - 2006-08-13 Restructure ExplorerModel initWithConnection to respect display user defaults (ie setShowPGCatalog). ! - 2006-07-16 Fix TODO for autoincrementing index names - 2006-07-16 Use color to separate tables names and other database structure names from actual meta data. --- 49,55 ---- - 2006-08-13 Fix bug with incorrect release of explorer while display was still using it. ! - 2006-08-13 Restructure ExplorerModel initWithConnection to respect display user defaults (i.e. setShowPGCatalog). ! - 2006-07-16 Fix TODO for auto incrementing index names - 2006-07-16 Use color to separate tables names and other database structure names from actual meta data. *************** *** 63,67 **** See /usr/include/servers/bootstrap_defs.h for the error codes. 2006-06-22 17:27:23.422 Query Tool for Postgres[5640] CFLog (99): CFMessagePortCreateLocal(): failed to name Mach port (com.druware.postgres.QueryTool.ServiceProvider) ! (not sure what caused this, is not occuring any longer.) - 2006-05-27 Query tool connect box does not receive focus when first opened. (2006-06-22) Appears to be fixed since connect box is filled in with the results from the last connection. --- 71,75 ---- See /usr/include/servers/bootstrap_defs.h for the error codes. 2006-06-22 17:27:23.422 Query Tool for Postgres[5640] CFLog (99): CFMessagePortCreateLocal(): failed to name Mach port (com.druware.postgres.QueryTool.ServiceProvider) ! (not sure what caused this, is not occurring any longer.) - 2006-05-27 Query tool connect box does not receive focus when first opened. (2006-06-22) Appears to be fixed since connect box is filled in with the results from the last connection. *************** *** 77,81 **** - 2006-06-20 Does not save last connection parameters for reuse when re-launched. Added NSUserDefaults to connection pane. (2006-06-21) ! - 2006-06-20 separating sql statements by ";" does not correctly handle $$ quoted text required by functions. Fixed by removeing the parse of entered data. (2006-06-21) - 2006-06-02 First column of schema view default width is too small. (2006-06-20) --- 85,89 ---- - 2006-06-20 Does not save last connection parameters for reuse when re-launched. Added NSUserDefaults to connection pane. (2006-06-21) ! - 2006-06-20 separating sql statements by ";" does not correctly handle $$ quoted text required by functions. Fixed by removing the parse of entered data. (2006-06-21) - 2006-06-02 First column of schema view default width is too small. (2006-06-20) Index: MyOutlineView.m =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/MyOutlineView.m,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MyOutlineView.m 18 Aug 2006 17:46:01 -0000 1.7 --- MyOutlineView.m 30 Aug 2006 21:25:49 -0000 1.8 *************** *** 187,191 **** newItem = [[NSMenuItem alloc] init]; ! [newItem setTitle:@"SELECT * FROM <tab>"]; [newItem setTarget: menuActionTarget]; [newItem setAction: @selector(onSelectSelectTableMenuItem:)]; --- 187,191 ---- newItem = [[NSMenuItem alloc] init]; ! [newItem setTitle:@"SELECT * FROM <view>"]; [newItem setTarget: menuActionTarget]; [newItem setAction: @selector(onSelectSelectTableMenuItem:)]; *************** *** 193,197 **** newItem = [[NSMenuItem alloc] init]; ! [newItem setTitle:@"CREATE VIEW <tab> as <query>"]; [newItem setTarget: menuActionTarget]; [newItem setAction: @selector(onSelectCreateViewMenuItem:)]; --- 193,197 ---- newItem = [[NSMenuItem alloc] init]; ! [newItem setTitle:@"CREATE VIEW <name> as <query>"]; [newItem setTarget: menuActionTarget]; [newItem setAction: @selector(onSelectCreateViewMenuItem:)]; *************** *** 199,203 **** newItem = [[NSMenuItem alloc] init]; ! [newItem setTitle:@"CREATE VIEW template"]; [newItem setTarget: menuActionTarget]; [newItem setAction: @selector(onSelectCreateViewTemplateMenuItem:)]; --- 199,203 ---- newItem = [[NSMenuItem alloc] init]; ! [newItem setTitle:@"CREATE VIEW from template"]; [newItem setTarget: menuActionTarget]; [newItem setAction: @selector(onSelectCreateViewTemplateMenuItem:)]; |
From: Neil T. <nt...@us...> - 2006-08-30 21:25:52
|
Update of /cvsroot/pgsqlformac/QueryTool/English.lproj/Preferences.nib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15451/English.lproj/Preferences.nib Modified Files: classes.nib keyedobjects.nib Log Message: Improve wording of menu items. Index: classes.nib =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/English.lproj/Preferences.nib/classes.nib,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** classes.nib 30 Aug 2006 01:06:53 -0000 1.1 --- classes.nib 30 Aug 2006 21:25:49 -0000 1.2 *************** *** 1,5 **** { IBClasses = ( ! {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, { ACTIONS = {cancelPreferences = id; defaultPreferences = id; savePreferences = id; }; --- 1,10 ---- { IBClasses = ( ! { ! ACTIONS = {"" = id; }; ! CLASS = FirstResponder; ! LANGUAGE = ObjC; ! SUPERCLASS = NSObject; ! }, { ACTIONS = {cancelPreferences = id; defaultPreferences = id; savePreferences = id; }; Index: keyedobjects.nib =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/English.lproj/Preferences.nib/keyedobjects.nib,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsDqX5p2 and /tmp/cvsl4j5QT differ |
From: Neil T. <nt...@us...> - 2006-08-30 15:51:19
|
Update of /cvsroot/pgsqlformac/QueryTool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22673 Modified Files: AppController.h ChangeLog DataSource.m MyOutlineView.h MyResultsView.h PreferenceController.h SqlDocument.h SqlDocument.m SqlMenuCategory.h SqlToolbarCategory.h Log Message: Restructure for schema threading. Index: ChangeLog =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/ChangeLog,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ChangeLog 30 Aug 2006 01:06:53 -0000 1.14 --- ChangeLog 30 Aug 2006 15:51:15 -0000 1.15 *************** *** 1,2 **** --- 1,14 ---- + 2006-08-29 20:06 ntiffin + + * AppController.h, AppController.m, ChangeLog, + PreferenceController.h, PreferenceController.m, SqlDocument.h, + SqlDocument.m, TODO.txt, English.lproj/MainMenu.nib/classes.nib, + English.lproj/MainMenu.nib/info.nib, + English.lproj/MainMenu.nib/objects.nib, + English.lproj/Preferences.nib/classes.nib, + English.lproj/Preferences.nib/info.nib, + English.lproj/Preferences.nib/keyedobjects.nib, + English.lproj/SqlDocument.nib/keyedobjects.nib: Add preferences. + 2006-08-18 12:46 ntiffin Index: MyResultsView.h =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/MyResultsView.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MyResultsView.h 16 Jul 2006 23:17:39 -0000 1.1 --- MyResultsView.h 30 Aug 2006 15:51:15 -0000 1.2 *************** *** 8,12 **** #import <Cocoa/Cocoa.h> ! @interface MyResultsView : NSTableView { --- 8,12 ---- #import <Cocoa/Cocoa.h> ! #import "QueryTool.h" @interface MyResultsView : NSTableView { Index: PreferenceController.h =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/PreferenceController.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PreferenceController.h 30 Aug 2006 01:06:53 -0000 1.1 --- PreferenceController.h 30 Aug 2006 15:51:15 -0000 1.2 *************** *** 8,12 **** #import <Cocoa/Cocoa.h> ! @interface PreferenceController : NSWindowController { --- 8,12 ---- #import <Cocoa/Cocoa.h> ! #import "QueryTool.h" @interface PreferenceController : NSWindowController { Index: AppController.h =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/AppController.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AppController.h 30 Aug 2006 01:06:53 -0000 1.1 --- AppController.h 30 Aug 2006 15:51:15 -0000 1.2 *************** *** 8,11 **** --- 8,13 ---- #import <Cocoa/Cocoa.h> + #import "QueryTool.h" + @class PreferenceController; Index: MyOutlineView.h =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/MyOutlineView.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MyOutlineView.h 16 Jul 2006 23:17:39 -0000 1.4 --- MyOutlineView.h 30 Aug 2006 15:51:15 -0000 1.5 *************** *** 3,6 **** --- 3,7 ---- #import <Cocoa/Cocoa.h> #import "ExplorerNode.h" + #import "QueryTool.h" @interface MyOutlineView : NSOutlineView Index: SqlMenuCategory.h =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/SqlMenuCategory.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SqlMenuCategory.h 8 Mar 2005 21:50:09 -0000 1.1.1.1 --- SqlMenuCategory.h 30 Aug 2006 15:51:15 -0000 1.2 *************** *** 9,12 **** --- 9,13 ---- #import <Foundation/Foundation.h> #import "SqlDocument.h" + #import "QueryTool.h" @interface SqlDocument (SqlMenuCategory) Index: DataSource.m =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/DataSource.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DataSource.m 12 Aug 2006 16:39:04 -0000 1.2 --- DataSource.m 30 Aug 2006 15:51:15 -0000 1.3 *************** *** 8,11 **** --- 8,12 ---- #import <Cocoa/Cocoa.h> #import "DataSource.h" + #import "QueryTool.h" @implementation DataSource Index: SqlDocument.m =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/SqlDocument.m,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** SqlDocument.m 30 Aug 2006 01:06:53 -0000 1.20 --- SqlDocument.m 30 Aug 2006 15:51:15 -0000 1.21 *************** *** 181,189 **** -(void)setNewExplorerConn { - ExplorerModel *newExplorer = [[ExplorerModel alloc] initRebuilding]; - [schemaView setDataSource:newExplorer]; [explorer autorelease]; ! // change the schema explorer explorer =[[ExplorerModel alloc] initWithConnection: conn]; // set explorer display defaults from NSUserDefaults --- 181,187 ---- -(void)setNewExplorerConn { [explorer autorelease]; ! // create the new schema explorer explorer =[[ExplorerModel alloc] initWithConnection: conn]; // set explorer display defaults from NSUserDefaults *************** *** 193,202 **** [explorer setShowPGToast:[userDefaults boolForKey:@"PGSqlForMac_QueryTool_ShowPGToastSchema"]]; [explorer setShowPGTemps:[userDefaults boolForKey:@"PGSqlForMac_QueryTool_ShowPGTempsSchema"]]; ! [explorer buildSchema]; [schemaView setDataSource:explorer]; // explorer does the work. [schemaView setMenuActionTarget:self]; - [newExplorer autorelease]; - //[explorer printLog]; } --- 191,200 ---- [explorer setShowPGToast:[userDefaults boolForKey:@"PGSqlForMac_QueryTool_ShowPGToastSchema"]]; [explorer setShowPGTemps:[userDefaults boolForKey:@"PGSqlForMac_QueryTool_ShowPGTempsSchema"]]; + [explorer setShowPublic:[userDefaults boolForKey:@"PGSqlForMac_QueryTool_ShowPGPublicSchema"]]; ! [NSThread detachNewThreadSelector:@selector(buildSchema:) toTarget:explorer withObject:schemaView]; ! [schemaView setDataSource:explorer]; // explorer does the work. [schemaView setMenuActionTarget:self]; } Index: SqlToolbarCategory.h =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/SqlToolbarCategory.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SqlToolbarCategory.h 8 Mar 2005 21:50:09 -0000 1.1.1.1 --- SqlToolbarCategory.h 30 Aug 2006 15:51:15 -0000 1.2 *************** *** 9,12 **** --- 9,13 ---- #import <Foundation/Foundation.h> #import "SqlDocument.h" + #import "QueryTool.h" @interface SqlDocument (SqlToolbarCategory) Index: SqlDocument.h =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/SqlDocument.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** SqlDocument.h 30 Aug 2006 01:06:53 -0000 1.13 --- SqlDocument.h 30 Aug 2006 15:51:15 -0000 1.14 *************** *** 14,17 **** --- 14,18 ---- #import "MyOutlineView.h" #import "MyResultsView.h" + #import "QueryTool.h" @class PreferenceController; *************** *** 121,125 **** - (void)colorRange:(NSRange)rangeToColor; - #define UNUSED_PARAMETER(x) (void)(x) - @end --- 122,124 ---- |
Update of /cvsroot/pgsqlformac/pgCocoaDB In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21466 Modified Files: ChangeLog Connection.h Connection.m DataSource.h Database.h Databases.h ExplorerModel.h ExplorerModel.m ExplorerNode.h Field.h Fields.h Record.h RecordSet.h Schema.h Schema.m Table.h Added Files: PGCocoaDB.h UnitTest-Info.plist Log Message: Restructure for schema threaded processing. Index: ChangeLog =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ChangeLog,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ChangeLog 26 Aug 2006 12:25:33 -0000 1.17 --- ChangeLog 30 Aug 2006 15:48:49 -0000 1.18 *************** *** 1,2 **** --- 1,8 ---- + 2006-08-26 07:25 ntiffin + + * ChangeLog, Connection.m, ExplorerModel.m, Schema.m, + UnitTest/pgCocoaDBSchemaTest.m: Add some comments and reformat + functions. + 2006-08-19 07:06 ntiffin Index: Table.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Table.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Table.h 8 Mar 2005 15:45:10 -0000 1.1.1.1 --- Table.h 30 Aug 2006 15:48:49 -0000 1.2 *************** *** 8,12 **** #import <Foundation/Foundation.h> ! @interface Table : NSObject --- 8,12 ---- #import <Foundation/Foundation.h> ! #import "PGCocoaDB.h" @interface Table : NSObject Index: RecordSet.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/RecordSet.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** RecordSet.h 8 Mar 2005 15:45:10 -0000 1.1.1.1 --- RecordSet.h 30 Aug 2006 15:48:49 -0000 1.2 *************** *** 8,11 **** --- 8,12 ---- #import <Foundation/Foundation.h> #import "Record.h" + #import "PGCocoaDB.h" @interface RecordSet : NSObject Index: Record.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Record.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Record.h 11 Aug 2006 18:01:25 -0000 1.2 --- Record.h 30 Aug 2006 15:48:49 -0000 1.3 *************** *** 9,12 **** --- 9,13 ---- #import <Foundation/Foundation.h> #import "Fields.h" + #import "PGCocoaDB.h" @interface Record : NSObject Index: Fields.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Fields.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Fields.h 8 Mar 2006 16:14:39 -0000 1.2 --- Fields.h 30 Aug 2006 15:48:49 -0000 1.3 *************** *** 8,11 **** --- 8,12 ---- #import <Foundation/Foundation.h> #import "Field.h" + #import "PGCocoaDB.h" @interface Fields : NSObject Index: Schema.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Schema.m,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Schema.m 26 Aug 2006 12:25:33 -0000 1.19 --- Schema.m 30 Aug 2006 15:48:49 -0000 1.20 *************** *** 35,38 **** --- 35,39 ---- pgVersionFound = [[NSString alloc] initWithString: [versionField value]]; + // TODO add user default to bypass versions check //PostgreSQL 8.1.2 on powerpc-apple-darwin8.5.0, compiled by GCC powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5250) if ([pgVersionFound rangeOfString:@"PostgreSQL 8.1"].location == NSNotFound) Index: Database.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Database.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Database.h 8 Mar 2005 15:45:10 -0000 1.1.1.1 --- Database.h 30 Aug 2006 15:48:49 -0000 1.2 *************** *** 8,12 **** #import <Foundation/Foundation.h> ! @interface Database : NSObject --- 8,12 ---- #import <Foundation/Foundation.h> ! #import "PGCocoaDB.h" @interface Database : NSObject Index: DataSource.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/DataSource.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** DataSource.h 8 Mar 2005 15:45:10 -0000 1.1.1.1 --- DataSource.h 30 Aug 2006 15:48:49 -0000 1.2 *************** *** 7,10 **** --- 7,11 ---- #import <Foundation/Foundation.h> + #import "PGCocoaDB.h" @interface DataSource : NSObject Index: Schema.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Schema.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Schema.h 19 Aug 2006 12:06:48 -0000 1.11 --- Schema.h 30 Aug 2006 15:48:49 -0000 1.12 *************** *** 11,14 **** --- 11,15 ---- #import "Recordset.h" #import "Connection.h" + #import "PGCocoaDB.h" @interface Schema : NSObject { Index: Connection.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Connection.m,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Connection.m 26 Aug 2006 12:25:33 -0000 1.14 --- Connection.m 30 Aug 2006 15:48:49 -0000 1.15 *************** *** 28,32 **** pgconn = nil; ! connected = NO; --- 28,32 ---- pgconn = nil; ! dbs = nil; connected = NO; *************** *** 37,42 **** dbName = [[NSString alloc] initWithString:@"template1"]; - dbs = nil; - errorDescription = nil; sqlLog = [[NSMutableString alloc] init]; --- 37,40 ---- *************** *** 47,54 **** -(void)dealloc { ! if (connected) ! { ! [self disconnect]; ! } [host release]; [port release]; --- 45,51 ---- -(void)dealloc { ! ! [self disconnect]; ! [host release]; [port release]; *************** *** 67,76 **** - (BOOL)connect { ! // connect to the server (attempt) /// should use PQsetdbLogin() ! if (dbs != nil) { ! [dbs release]; ! dbs = nil; ! } pgconn = (PGconn *)PQsetdbLogin([host cString], [port cString], [options cString], NULL, --- 64,70 ---- - (BOOL)connect { ! [self disconnect]; + // connect to the server (attempt) // TODO should use PQconnectdb() pgconn = (PGconn *)PQsetdbLogin([host cString], [port cString], [options cString], NULL, *************** *** 89,92 **** --- 83,87 ---- PQfinish(pgconn); + pgconn = nil; connected = NO; return NO; *************** *** 106,110 **** PQsetNoticeProcessor(pgconn, handle_pq_notice, self); ! [self setSQLLog:[NSMutableString stringWithFormat:@"Connected to database %@.\n", dbName]]; connected = YES; return YES; --- 101,105 ---- PQsetNoticeProcessor(pgconn, handle_pq_notice, self); ! [self setSQLLog:[NSMutableString stringWithFormat:@"Connected to database %@ on %@.\n", dbName, [[NSCalendarDate calendarDate] description]]]; connected = YES; return YES; *************** *** 138,141 **** --- 133,137 ---- [self appendSQLLog:[NSMutableString stringWithString:@"Disconnected from database.\n"]]; PQfinish(pgconn); + pgconn = nil; connected = NO; return YES; *************** *** 146,149 **** --- 142,147 ---- - (BOOL)isConnected { + // TODO check to make sure connection is still alive + // TODO if not alive then should make use PQreset to attempt to re-establish return connected; } *************** *** 261,264 **** --- 259,263 ---- NSString *sql = @"select * from pg_database where datallowconn = 't' order by datname asc"; + // TODO restructure to use [self execQueryNoLog]; res = PQexec(pgconn, [sql cString]); if (PQresultStatus(res) != PGRES_TUPLES_OK) *************** *** 365,370 **** } ! - (RecordSet *)execQueryLog:(NSString *)sql { return [self execQuery:sql logInfo:1 logSQL:0]; --- 364,374 ---- } + - (RecordSet *)execQueryNoLog:(NSString *)sql + { + return [self execQuery:sql logInfo:0 logSQL:0]; + } ! ! - (RecordSet *)execQueryLogInfo:(NSString *)sql { return [self execQuery:sql logInfo:1 logSQL:0]; *************** *** 372,378 **** ! - (RecordSet *)execQueryNoLog:(NSString *)sql { ! return [self execQuery:sql logInfo:0 logSQL:0]; } --- 376,382 ---- ! - (RecordSet *)execQueryLogInfoLogSQL:(NSString *)sql { ! return [self execQuery:sql logInfo:1 logSQL:1]; } *************** *** 390,395 **** if (pgconn == nil) { ! [self setErrorDescription:@"Object is not Connected."]; return nil; } gettimeofday(&start, 0); --- 394,404 ---- if (pgconn == nil) { ! [self setErrorDescription:@"Object is not Connected."]; ! [self appendSQLLog:@"Object is not Connected.\n"]; return nil; + } + if (logSQL) + { + [self appendSQLLog: [NSString stringWithFormat:@"%@\n", [sql stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]]]; } gettimeofday(&start, 0); *************** *** 434,438 **** if (logInfo) { ! [self appendSQLLog:[NSString stringWithFormat: @"%d rows affected.\n", nRecords]]; } PQclear(res); --- 443,447 ---- if (logInfo) { ! [self appendSQLLog:[NSString stringWithFormat: @"%d rows affected.\n\n", nRecords]]; } PQclear(res); *************** *** 443,453 **** case PGRES_COMMAND_OK: { ! if (strlen(PQcmdStatus(res))) ! { ! [self appendSQLLog:[NSString stringWithFormat:@"%s\n", PQcmdStatus(res)]]; ! } ! if ((strlen(PQcmdTuples(res)) > 0) && (logInfo)) { ! [self appendSQLLog:[NSString stringWithFormat: @"%s rows affected.\n", PQcmdTuples(res)]]; } PQclear(res); --- 452,468 ---- case PGRES_COMMAND_OK: { ! if (logInfo) { ! [self appendSQLLog:@"Query ran successfully.\n"]; ! /* these do not return valuable info. ! if (strlen(PQcmdStatus(res))) ! { ! [self appendSQLLog:[NSString stringWithFormat:@"Command Status: %s\n", PQcmdStatus(res)]]; ! } ! if (PQcmdTuples(res)) ! { ! [self appendSQLLog:[NSString stringWithFormat: @"%d rows affected.\n", PQcmdTuples(res)]]; ! } ! */ } PQclear(res); *************** *** 458,465 **** case PGRES_EMPTY_QUERY: { ! if (logInfo) ! { ! [self appendSQLLog:@"Postgres reported Empty Query\n"]; ! } PQclear(res); return nil; --- 473,477 ---- case PGRES_EMPTY_QUERY: { ! [self appendSQLLog:@"Postgres reported Empty Query\n"]; PQclear(res); return nil; *************** *** 475,483 **** { [self setErrorDescription:[NSString stringWithFormat:@"PostgreSQL Error: %s", PQresultErrorMessage(res)]]; PQclear(res); return nil; } } - } --- 487,495 ---- { [self setErrorDescription:[NSString stringWithFormat:@"PostgreSQL Error: %s", PQresultErrorMessage(res)]]; + [self appendSQLLog:[NSString stringWithFormat:@"PostgreSQL Error: %s\n", PQresultErrorMessage(res)]]; PQclear(res); return nil; } } } Index: ExplorerModel.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ExplorerModel.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ExplorerModel.h 13 Aug 2006 23:50:24 -0000 1.4 --- ExplorerModel.h 30 Aug 2006 15:48:49 -0000 1.5 *************** *** 12,15 **** --- 12,17 ---- #import "Connection.h" #import "Schema.h" + #import "PGCocoaDB.h" + @interface ExplorerModel : NSObject *************** *** 22,32 **** bool showPGToast; bool showPGTemps; } - (id)initWithConnection:(Connection *) aConnection; ! - (id)initRebuilding; ! - (void)buildSchema; ! -(void)setSchema:(Schema *)newSchema; - (Schema *)schema; - (bool)showInformationSchema; --- 24,37 ---- bool showPGToast; bool showPGTemps; + bool showPublic; + + NSLock *explorerThreadStatusLock; + unsigned int explorerThreadStatus; // 0 = not inited, 1 = running, 2 = error, 3 = done, } - (id)initWithConnection:(Connection *) aConnection; ! - (void)buildSchema:(id)anObject; ! - (void)setSchema:(Schema *)newSchema; - (Schema *)schema; - (bool)showInformationSchema; *************** *** 34,37 **** --- 39,44 ---- - (bool)showPGToast; - (bool)showPGTemps; + - (bool)showPublic; + - (unsigned int)explorerThreadStatus; - (void)setShowInformationSchema:(bool)newValue; *************** *** 39,42 **** --- 46,51 ---- - (void)setShowPGToast:(bool)newValue; - (void)setShowPGTemps:(bool)newValue; + - (void)setShowPublic:(bool)newValue; + - (void)setExplorerThreadStatus:(unsigned int)newValue; // These methods get called because I am the datasource of the outline view. Index: Connection.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Connection.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Connection.h 11 Aug 2006 18:01:25 -0000 1.7 --- Connection.h 30 Aug 2006 15:48:49 -0000 1.8 *************** *** 11,14 **** --- 11,15 ---- #import "Recordset.h" #import "Databases.h" + #import "PGCocoaDB.h" @interface Connection : NSObject *************** *** 71,76 **** - (RecordSet *)execQuery:(NSString *)sql; - (RecordSet *)execQueryNoLog:(NSString *)sql; - - (RecordSet *)execQueryLog:(NSString *)sql; - (RecordSet *)execQuery:(NSString *)sql logInfo:(bool)logInfo logSQL:(bool)logSQL; - (NSString *)execCommand:(NSString *)sql; --- 72,78 ---- - (RecordSet *)execQuery:(NSString *)sql; + - (RecordSet *)execQueryLogInfo:(NSString *)sql; + - (RecordSet *)execQueryLogInfoLogSQL:(NSString *)sql; - (RecordSet *)execQueryNoLog:(NSString *)sql; - (RecordSet *)execQuery:(NSString *)sql logInfo:(bool)logInfo logSQL:(bool)logSQL; - (NSString *)execCommand:(NSString *)sql; --- NEW FILE: PGCocoaDB.h --- /* * PGCocoaDB.h * pgCocoaDBn * * Created by Neil Tiffin on 8/30/06. * Copyright 2006 Performance Champions, Inc.. All rights reserved. * */ // To tell other that parpameters are purposesly not used and remove compiler warning. #define UNUSED_PARAMETER(x) (void)(x) // Global Project Definitions Index: Field.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Field.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Field.h 8 Mar 2005 15:45:10 -0000 1.1.1.1 --- Field.h 30 Aug 2006 15:48:49 -0000 1.2 *************** *** 8,12 **** #import <Foundation/Foundation.h> ! @interface Field : NSObject --- 8,12 ---- #import <Foundation/Foundation.h> ! #import "PGCocoaDB.h" @interface Field : NSObject Index: ExplorerModel.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ExplorerModel.m,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ExplorerModel.m 26 Aug 2006 12:25:33 -0000 1.12 --- ExplorerModel.m 30 Aug 2006 15:48:49 -0000 1.13 *************** *** 302,356 **** } - - (id)initRebuilding - { - [super init]; - - schema = nil; - connection = nil; - rootNode = [[ExplorerNode alloc] init]; - [rootNode setName: @"Rebuilding"]; - [rootNode setBaseTable: @""]; - [rootNode setExplorerType:@"Database"]; - [rootNode setParent:nil]; - [rootNode setOID:0]; - - return self; - } - - (id)initWithConnection:(Connection *) theConnection { [super init]; // TODO clone this connection so we can multi-thread connection = theConnection; schema = [[Schema alloc] initWithConnection:connection]; showInformationSchema = TRUE; showPGCatalog = TRUE; showPGToast = FALSE; showPGTemps = FALSE; return self; } ! - (void)buildSchema { ExplorerNode * newNode; ExplorerNode * newChild; RecordSet * results; ! if ((connection == nil) || (schema == nil)) { ! NSLog(@"Attempted to buildSchema without proper init."); return; } // set database level ! rootNode = [[ExplorerNode alloc] init]; ! [rootNode setName: [connection currentDatabase]]; ! [rootNode setBaseTable: @""]; ! [rootNode setExplorerType:@"Database"]; ! [rootNode setParent:nil]; ! [rootNode setOID:0]; // set schema level --- 302,366 ---- } - (id)initWithConnection:(Connection *) theConnection { [super init]; + ExplorerNode * newNode; // TODO clone this connection so we can multi-thread connection = theConnection; schema = [[Schema alloc] initWithConnection:connection]; + + explorerThreadStatusLock = [[NSLock alloc] init]; + explorerThreadStatus = 0; + showInformationSchema = TRUE; showPGCatalog = TRUE; showPGToast = FALSE; showPGTemps = FALSE; + + // set temporary root node for display + rootNode = [[ExplorerNode alloc] init]; + [rootNode setName: @"Rebuilding"]; + [rootNode setBaseTable: @"Rebuilding"]; + [rootNode setExplorerType:@"Rebuilding"]; + [rootNode setParent:nil]; + [rootNode setOID:0]; + + newNode = [[ExplorerNode alloc] init]; + [newNode setName: @"Rebuilding"]; + [newNode setExplorerType:@"Rebuilding"]; + [newNode setParent:rootNode]; + [rootNode addChild: newNode]; + [newNode release]; + return self; } ! - (void)buildSchema:(id)anOutlineView { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; ExplorerNode * newNode; ExplorerNode * newChild; RecordSet * results; ! ExplorerNode * realRootNode; ! if ((connection == nil) || (schema == nil)) { ! NSLog(@"Attempted to build Schema without proper init."); return; } + + [self setExplorerThreadStatus:1]; + // set database level ! realRootNode = [[ExplorerNode alloc] init]; ! [realRootNode setName: [connection currentDatabase]]; ! [realRootNode setBaseTable: @""]; ! [realRootNode setExplorerType:@"Database"]; ! [realRootNode setParent:nil]; ! [realRootNode setOID:0]; // set schema level *************** *** 390,398 **** } } newNode = [[ExplorerNode alloc] init]; [newNode setName: schemaName]; [newNode setExplorerType:@"Schema"]; ! [newNode setParent:rootNode]; // for each schema add children --- 400,415 ---- } } + else if ([schemaName isCaseInsensitiveLike:@"public*"]) + { + if (!showPublic) + { + continue; //skip this one + } + } newNode = [[ExplorerNode alloc] init]; [newNode setName: schemaName]; [newNode setExplorerType:@"Schema"]; ! [newNode setParent:realRootNode]; // for each schema add children *************** *** 430,436 **** // add to the root node ! [rootNode addChild: newNode]; [newNode release]; } return; } --- 447,458 ---- // add to the root node ! [realRootNode addChild: newNode]; [newNode release]; } + [rootNode autorelease]; + rootNode = realRootNode; + [self setExplorerThreadStatus:3]; + [(NSOutlineView *)anOutlineView reloadData]; + [pool release]; return; } *************** *** 439,442 **** --- 461,466 ---- { // todo release all ExplorerNodes + [explorerThreadStatusLock release]; + [rootNode release]; [schema release]; *************** *** 477,480 **** --- 501,519 ---- } + - (bool)showPublic + { + return showPublic; + } + + - (unsigned int)explorerThreadStatus + { + unsigned int status; + + [explorerThreadStatusLock lock]; + status = explorerThreadStatus; + [explorerThreadStatusLock unlock]; + return status; + } + - (void)setShowInformationSchema:(bool)newValue { *************** *** 497,510 **** } // These methods get called because I am the datasource of the outline view. - (id)outlineView:(NSOutlineView *)outlineView child:(int)i ofItem:(id)item { ! if (item) ! // Return the child ! return [item childAtIndex:i]; ! else ! // Else return the root ! return [rootNode childAtIndex:i]; } --- 536,565 ---- } + - (void)setShowPublic:(bool)newValue + { + showPublic = newValue; + } + + - (void)setExplorerThreadStatus:(unsigned int)newValue + { + [explorerThreadStatusLock lock]; + explorerThreadStatus = newValue; + [explorerThreadStatusLock unlock]; + } // These methods get called because I am the datasource of the outline view. - (id)outlineView:(NSOutlineView *)outlineView child:(int)i ofItem:(id)item { ! UNUSED_PARAMETER(outlineView); ! ! if (item == nil) ! { ! return [rootNode childAtIndex:i]; ! } ! if([self explorerThreadStatus] != 3) ! { ! return 0; ! } ! return [item childAtIndex:i]; } *************** *** 512,516 **** - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item { ! // Returns YES if the node has children return [item expandable]; } --- 567,577 ---- - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item { ! UNUSED_PARAMETER(outlineView); ! ! // Returns YES if the node has children ! if([self explorerThreadStatus] != 3) ! { ! return NO; ! } return [item expandable]; } *************** *** 519,526 **** - (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item { ! if (item == nil) { // The root object; return [rootNode childrenCount]; } return [item childrenCount]; } --- 580,593 ---- - (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item { ! UNUSED_PARAMETER(outlineView); ! ! if (item == nil) { // The root object; return [rootNode childrenCount]; } + if([self explorerThreadStatus] != 3) + { + return 0; + } return [item childrenCount]; } *************** *** 531,535 **** // Set the identifier of the columns in IB's inspector NSString *identifier = [tableColumn identifier]; ! // What is returned depends upon which column it is going to appear. if ([identifier isEqual:@"col1"]) --- 598,603 ---- // Set the identifier of the columns in IB's inspector NSString *identifier = [tableColumn identifier]; ! UNUSED_PARAMETER(outlineView); ! // What is returned depends upon which column it is going to appear. if ([identifier isEqual:@"col1"]) *************** *** 556,560 **** - (void)printLog { ! [rootNode printLog:0]; } --- 624,632 ---- - (void)printLog { ! if([self explorerThreadStatus] == 3) ! { ! [rootNode printLog:0];; ! } ! NSLog(@"Explorer still Loading."); } Index: ExplorerNode.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ExplorerNode.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ExplorerNode.h 16 Jul 2006 23:13:06 -0000 1.3 --- ExplorerNode.h 30 Aug 2006 15:48:49 -0000 1.4 *************** *** 8,11 **** --- 8,12 ---- #import <Cocoa/Cocoa.h> + #import "PGCocoaDB.h" @interface ExplorerNode : NSObject { --- NEW FILE: UnitTest-Info.plist --- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>English</string> <key>CFBundleExecutable</key> <string>${EXECUTABLE_NAME}</string> <key>CFBundleIdentifier</key> <string>com.yourcompany.UnitTest</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundlePackageType</key> <string>BNDL</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> <string>1.0</string> </dict> </plist> Index: Databases.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Databases.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Databases.h 8 Mar 2005 15:45:10 -0000 1.1.1.1 --- Databases.h 30 Aug 2006 15:48:49 -0000 1.2 *************** *** 8,11 **** --- 8,12 ---- #import <Foundation/Foundation.h> #import "Database.h" + #import "PGCocoaDB.h" @interface Databases : NSObject |
From: Neil T. <nt...@us...> - 2006-08-30 15:48:51
|
Update of /cvsroot/pgsqlformac/pgCocoaDB/UnitTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21466/UnitTest Modified Files: pgCocoaDBSchemaTest.h pgCocoaDBSchemaTest.m Log Message: Restructure for schema threaded processing. Index: pgCocoaDBSchemaTest.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/UnitTest/pgCocoaDBSchemaTest.m,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** pgCocoaDBSchemaTest.m 26 Aug 2006 12:25:33 -0000 1.15 --- pgCocoaDBSchemaTest.m 30 Aug 2006 15:48:49 -0000 1.16 *************** *** 21,25 **** NSString* const PGCocoaTestPassword = @""; NSString* const PGCocoaTestHost = @"localhost"; ! NSString* const PGCocoaTestPort = @"5433"; // Uncomment the following line to automatically drop and recreate the test database. --- 21,25 ---- NSString* const PGCocoaTestPassword = @""; NSString* const PGCocoaTestHost = @"localhost"; ! NSString* const PGCocoaTestPort = @"5432"; // Uncomment the following line to automatically drop and recreate the test database. *************** *** 968,972 **** { ExplorerModel *explorer = [[ExplorerModel alloc] initWithConnection:conn]; ! [explorer buildSchema]; [explorer printLog]; --- 968,972 ---- { ExplorerModel *explorer = [[ExplorerModel alloc] initWithConnection:conn]; ! [explorer buildSchema:nil]; [explorer printLog]; Index: pgCocoaDBSchemaTest.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/UnitTest/pgCocoaDBSchemaTest.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pgCocoaDBSchemaTest.h 6 Mar 2006 00:59:00 -0000 1.2 --- pgCocoaDBSchemaTest.h 30 Aug 2006 15:48:49 -0000 1.3 *************** *** 10,13 **** --- 10,14 ---- #import "Connection.h" #import "Schema.h" + #import "PGCocoaDB.h" @interface pgCocoaDBSchemaTest : SenTestCase { |
Update of /cvsroot/pgsqlformac/QueryTool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22407 Modified Files: ChangeLog SqlDocument.h SqlDocument.m TODO.txt Added Files: AppController.h AppController.m PreferenceController.h PreferenceController.m Log Message: Add preferences. Index: TODO.txt =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/TODO.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TODO.txt 13 Aug 2006 23:54:30 -0000 1.6 --- TODO.txt 30 Aug 2006 01:06:53 -0000 1.7 *************** *** 4,18 **** TODO - Features, Functions and Warnings (in priority order) ======================================= - - 2006-06-02 Column SQL not complete. - - 2006-06-02 Trigger SQL not complete. - 2006-06-16 Use new function to attempt to cancel a query in pgCocoaDB. Need to change to async queries. ! - 2006-06-24 Add command to clear SQL Log. ! - 2006-08-13 SQL Log does not contain enough information. - - 2006-08-13 Move Schema reading to another thread. Make it load in parallel. FIXME (Known Errors) --- 4,21 ---- TODO - Features, Functions and Warnings (in priority order) ======================================= - 2006-06-02 Trigger SQL not complete. - 2006-06-16 Use new function to attempt to cancel a query in pgCocoaDB. Need to change to async queries. ! - 2006-08-13 Move Schema reading to another thread. Make it load in parallel. ! - 2006-08-18 Message during schema load is misleading. ! ! - 2006-08-26 Add save log function. ! ! - 2006-08-26 Add buttons to log to window to clear log and control sql and info display. ! ! - 2006-08-26 Add explain query button. FIXME (Known Errors) *************** *** 21,28 **** 2006-06-22 13:20:17.480 Query Tool for Postgres[5590] Exception raised during posting of notification. Ignored. exception: *** -[NSBigMutableString characterAtIndex:]: Range or index out of bounds Completed ========= ! - 2006-08-13 Fix bug with incorrect release of explorer whil display was still using it. - 2006-08-13 Restructure ExplorerModel initWithConnection to respect display user defaults (ie setShowPGCatalog). --- 24,43 ---- 2006-06-22 13:20:17.480 Query Tool for Postgres[5590] Exception raised during posting of notification. Ignored. exception: *** -[NSBigMutableString characterAtIndex:]: Range or index out of bounds + 2006-08-26 Function return parameters not correctly determined, see below: + + CREATE or REPLACE FUNCTION pgcocoa_test_schema.create_time_stamp AS $$ + BEGIN + NEW.create_time := current_timestamp; + RETURN NEW; + END; + $$ LANGUAGE plpgsql; Completed ========= ! - 2006-08-13 SQL Log does not contain enough information. (8/24/2006) ! ! - 2006-08-24 SLQ log windows is not updating correctly. (8/24/2006) ! ! - 2006-08-13 Fix bug with incorrect release of explorer while display was still using it. - 2006-08-13 Restructure ExplorerModel initWithConnection to respect display user defaults (ie setShowPGCatalog). Index: ChangeLog =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/ChangeLog,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ChangeLog 18 Aug 2006 17:46:01 -0000 1.13 --- ChangeLog 30 Aug 2006 01:06:53 -0000 1.14 *************** *** 1,2 **** --- 1,7 ---- + 2006-08-18 12:46 ntiffin + + * ChangeLog, MyOutlineView.m, SqlDocument.h, SqlDocument.m: Add + missing SQL formation routines. + 2006-08-13 18:54 ntiffin --- NEW FILE: AppController.m --- // // AppController.m // Query Tool for PostgresN // // Created by Neil Tiffin on 8/26/06. // Copyright 2006 Performance Champions, Inc.. All rights reserved. // #import "AppController.h" #import "PreferenceController.h" @implementation AppController -(IBAction)showPreferencePanel:(id)sender { if(!preferenceController) { preferenceController = [[PreferenceController alloc] init]; } [[preferenceController window] makeKeyAndOrderFront:self]; } -(void)dealloc { [preferenceController release]; [super dealloc]; } @end --- NEW FILE: PreferenceController.h --- // // PreferenceController.h // Query Tool for PostgresN // // Created by Neil Tiffin on 8/26/06. // Copyright 2006 Performance Champions, Inc.. All rights reserved. // #import <Cocoa/Cocoa.h> @interface PreferenceController : NSWindowController { IBOutlet NSButton *prefShowPGInfoSchema; IBOutlet NSButton *prefShowPGCatalogSchema; IBOutlet NSButton *prefShowPGToastSchema; IBOutlet NSButton *prefShowPGTempSchema; IBOutlet NSButton *prefShowPGPublicSchema; IBOutlet NSButton *prefLogAllSQL; IBOutlet NSButton *prefLogInfoMessages; IBOutlet NSTextField *prefPostgresqlHelpURL; IBOutlet NSTextField *prefPostgresqlSQLURL; } -(IBAction)defaultPreferences:(id)sender; -(IBAction)savePreferences:(id)sender; -(IBAction)cancelPreferences:(id)sender; @end --- NEW FILE: AppController.h --- // // AppController.h // Query Tool for PostgresN // // Created by Neil Tiffin on 8/26/06. // Copyright 2006 Performance Champions, Inc.. All rights reserved. // #import <Cocoa/Cocoa.h> @class PreferenceController; @interface AppController : NSObject { PreferenceController *preferenceController; } -(IBAction)showPreferencePanel:(id)sender; @end --- NEW FILE: PreferenceController.m --- // // PreferenceController.m // Query Tool for PostgresN // // Created by Neil Tiffin on 8/26/06. // Copyright 2006 Performance Champions, Inc.. All rights reserved. // #import "PreferenceController.h" @implementation PreferenceController -(id)init { self = [super initWithWindowNibName:@"Preferences"]; return self; } -(void)loadUserDefaults { NSUserDefaults * userDefaults = [NSUserDefaults standardUserDefaults]; if ([userDefaults boolForKey:@"PGSqlForMac_QueryTool_ShowInformationSchema"]) { [prefShowPGInfoSchema setState:NSOnState]; } else { [prefShowPGInfoSchema setState:NSOffState]; } if ([userDefaults boolForKey:@"PGSqlForMac_QueryTool_ShowPGCatalogSchema"]) { [prefShowPGCatalogSchema setState:NSOnState]; } else { [prefShowPGCatalogSchema setState:NSOffState]; } if ([userDefaults boolForKey:@"PGSqlForMac_QueryTool_ShowPGToastSchema"]) { [prefShowPGToastSchema setState:NSOnState]; } else { [prefShowPGToastSchema setState:NSOffState]; } if ([userDefaults boolForKey:@"PGSqlForMac_QueryTool_ShowPGTempsSchema"]) { [prefShowPGTempSchema setState:NSOnState]; } else { [prefShowPGTempSchema setState:NSOffState]; } if ([userDefaults boolForKey:@"PGSqlForMac_QueryTool_ShowPGPublicSchema"]) { [prefShowPGPublicSchema setState:NSOnState]; } else { [prefShowPGPublicSchema setState:NSOffState]; } if ([userDefaults boolForKey:@"PGSqlForMac_QueryTool_LogSQL"]) { [prefLogAllSQL setState:NSOnState]; } else { [prefLogAllSQL setState:NSOffState]; } if ([userDefaults boolForKey:@"PGSqlForMac_QueryTool_LogQueryInfo"]) { [prefLogInfoMessages setState:NSOnState]; } else { [prefLogInfoMessages setState:NSOffState]; } [prefPostgresqlHelpURL setStringValue:[userDefaults stringForKey:@"PGSqlForMac_QueryTool_ShowPostgreSQLHelp"]]; [prefPostgresqlSQLURL setStringValue:[userDefaults stringForKey:@"PGSqlForMac_QueryTool_ShowSQLCommandHelp"]]; } -(void)windowDidLoad { [self loadUserDefaults]; } -(IBAction)defaultPreferences:(id)sender { [prefShowPGInfoSchema setState:NSOnState]; [prefShowPGCatalogSchema setState:NSOnState]; [prefShowPGToastSchema setState:NSOffState]; [prefShowPGTempSchema setState:NSOffState]; [prefShowPGPublicSchema setState:NSOnState]; [prefLogAllSQL setState:NSOnState]; [prefLogInfoMessages setState:NSOnState]; [prefPostgresqlHelpURL setStringValue:@"file:///sw/share/doc/postgresql81/html/index.html"]; [prefPostgresqlSQLURL setStringValue:@"file:///sw/share/doc/postgresql81/html/sql-commands.html"]; } -(IBAction)savePreferences:(id)sender; { NSUserDefaults * userDefaults = [NSUserDefaults standardUserDefaults]; if ([prefShowPGInfoSchema state]) { [userDefaults setObject:@"yes" forKey:@"PGSqlForMac_QueryTool_ShowInformationSchema"]; } else { [userDefaults setObject:@"no" forKey:@"PGSqlForMac_QueryTool_ShowInformationSchema"]; } if ([prefShowPGCatalogSchema state]) { [userDefaults setObject:@"yes" forKey:@"PGSqlForMac_QueryTool_ShowPGCatalogSchema"]; } else { [userDefaults setObject:@"no" forKey:@"PGSqlForMac_QueryTool_ShowPGCatalogSchema"]; } if ([prefShowPGToastSchema state]) { [userDefaults setObject:@"yes" forKey:@"PGSqlForMac_QueryTool_ShowPGToastSchema"]; } else { [userDefaults setObject:@"no" forKey:@"PGSqlForMac_QueryTool_ShowPGToastSchema"]; } if ([prefShowPGTempSchema state]) { [userDefaults setObject:@"yes" forKey:@"PGSqlForMac_QueryTool_ShowPGTempsSchema"]; } else { [userDefaults setObject:@"no" forKey:@"PGSqlForMac_QueryTool_ShowPGTempsSchema"]; } if ([prefShowPGPublicSchema state]) { [userDefaults setObject:@"yes" forKey:@"PGSqlForMac_QueryTool_ShowPGPublicSchema"]; } else { [userDefaults setObject:@"no" forKey:@"PGSqlForMac_QueryTool_ShowPGPublicSchema"]; } if ([prefLogAllSQL state]) { [userDefaults setObject:@"yes" forKey:@"PGSqlForMac_QueryTool_LogSQL"]; } else { [userDefaults setObject:@"no" forKey:@"PGSqlForMac_QueryTool_LogSQL"]; } if ([prefLogInfoMessages state]) { [userDefaults setObject:@"yes" forKey:@"PGSqlForMac_QueryTool_LogQueryInfo"]; } else { [userDefaults setObject:@"no" forKey:@"PGSqlForMac_QueryTool_LogQueryInfo"]; } [userDefaults setObject:[prefPostgresqlHelpURL stringValue] forKey:@"PGSqlForMac_QueryTool_ShowPostgreSQLHelp"]; [userDefaults setObject:[prefPostgresqlSQLURL stringValue] forKey:@"PGSqlForMac_QueryTool_ShowSQLCommandHelp"]; [[NSUserDefaults standardUserDefaults] synchronize]; [[self window] close]; } -(IBAction)cancelPreferences:(id)sender; { [self loadUserDefaults]; [[self window] close]; } @end Index: SqlDocument.m =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/SqlDocument.m,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** SqlDocument.m 18 Aug 2006 17:46:01 -0000 1.19 --- SqlDocument.m 30 Aug 2006 01:06:53 -0000 1.20 *************** *** 32,36 **** [userDefaults setObject:@"no" forKey:@"PGSqlForMac_QueryTool_ShowPGTempsSchema"]; } ! if ([userDefaults stringForKey:@"PGSqlForMac_QueryTool_SchemaTableFontName"] == nil) { --- 32,49 ---- [userDefaults setObject:@"no" forKey:@"PGSqlForMac_QueryTool_ShowPGTempsSchema"]; } ! if ([userDefaults stringForKey:@"PGSqlForMac_QueryTool_ShowPGPublicSchema"] == nil) ! { ! [userDefaults setObject:@"yes" forKey:@"PGSqlForMac_QueryTool_ShowPGPublicSchema"]; ! } ! if ([userDefaults stringForKey:@"PGSqlForMac_QueryTool_LogSQL"] == nil) ! { ! [userDefaults setObject:@"yes" forKey:@"PGSqlForMac_QueryTool_LogSQL"]; ! } ! if ([userDefaults stringForKey:@"PGSqlForMac_QueryTool_LogQueryInfo"] == nil) ! { ! [userDefaults setObject:@"yes" forKey:@"PGSqlForMac_QueryTool_LogQueryInfo"]; ! } ! ! if ([userDefaults stringForKey:@"PGSqlForMac_QueryTool_SchemaTableFontName"] == nil) { *************** *** 192,195 **** --- 205,209 ---- /* read the preferences and add them to the drop downs */ NSString * aDefault; + UNUSED_PARAMETER(sender); [status setStringValue:[NSString stringWithString:@"Waiting for connection information"]]; *************** *** 234,237 **** --- 248,252 ---- { // make sure we have a connection object + UNUSED_PARAMETER(sender); if (conn != nil) { *************** *** 302,305 **** --- 317,321 ---- - (IBAction)onShowPostgreSQLHTML:(id) sender { + UNUSED_PARAMETER(sender); NSUserDefaults * userDefaults = [NSUserDefaults standardUserDefaults]; [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[userDefaults stringForKey:@"PGSqlForMac_QueryTool_ShowPostgreSQLHelp"]]]; *************** *** 309,312 **** --- 325,329 ---- - (IBAction)onShowSQLHTML:(id) sender { + UNUSED_PARAMETER(sender); NSUserDefaults * userDefaults = [NSUserDefaults standardUserDefaults]; [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[userDefaults stringForKey:@"PGSqlForMac_QueryTool_ShowSQLCommandHelp"]]]; *************** *** 316,319 **** --- 333,337 ---- -(IBAction) setSchemaViewFont:(id) sender { + UNUSED_PARAMETER(sender); NSFontPanel *myFontPanel =[NSFontPanel sharedFontPanel]; *************** *** 328,331 **** --- 346,350 ---- -(IBAction) setDataOutputViewFont:(id) sender { + UNUSED_PARAMETER(sender); NSFontPanel *myFontPanel =[NSFontPanel sharedFontPanel]; *************** *** 340,343 **** --- 359,363 ---- -(IBAction) setSQLLogViewFont:(id) sender { + UNUSED_PARAMETER(sender); NSFontPanel *myFontPanel =[NSFontPanel sharedFontPanel]; [sqlLogPanelTextView setUsesFontPanel:YES]; *************** *** 354,357 **** --- 374,378 ---- - (IBAction)onConnectCancel:(id)sender { + UNUSED_PARAMETER(sender); [NSApp stopModal]; [NSApp endSheet:panelConnect]; *************** *** 363,366 **** --- 384,388 ---- - (IBAction)onDisconnect:(id)sender { + UNUSED_PARAMETER(sender); if ([conn isConnected]) *************** *** 419,427 **** //NSString *sql = [arrQuery objectAtIndex:x]; //RecordSet *rs = [conn execQuery:sql]; ! RecordSet *rs = [conn execQuery:toBeRun]; if ([conn sqlLog] != nil) { //[[[textView textStorage] mutableString] appendString: string]; ! NSRange myRange = NSMakeRange([[sqlLogPanelTextView textStorage] length], 0); [[sqlLogPanelTextView textStorage] replaceCharactersInRange:myRange withString:[conn sqlLog]]; } --- 441,449 ---- //NSString *sql = [arrQuery objectAtIndex:x]; //RecordSet *rs = [conn execQuery:sql]; ! RecordSet *rs = [conn execQueryLogInfoLogSQL:toBeRun]; if ([conn sqlLog] != nil) { //[[[textView textStorage] mutableString] appendString: string]; ! NSRange myRange = NSMakeRange(0, [[sqlLogPanelTextView textStorage] length]); [[sqlLogPanelTextView textStorage] replaceCharactersInRange:myRange withString:[conn sqlLog]]; } *************** *** 498,501 **** --- 520,524 ---- - (IBAction)onSetDatabase:(id)sender { + UNUSED_PARAMETER(sender); //NSLog(@"Enter onSetDatabase"); if ([conn isConnected]) *************** *** 536,539 **** --- 559,563 ---- - (IBAction)onShowSQLLog:(id)sender { + UNUSED_PARAMETER(sender); if ([sqlLogPanel isVisible] != 0) { *************** *** 547,550 **** --- 571,575 ---- - (void)onSelectSelectTableMenuItem:(id)sender { + UNUSED_PARAMETER(sender); NSIndexSet *theRows =[schemaView selectedRowIndexes]; unsigned int currentRow =[theRows firstIndex]; *************** *** 559,562 **** --- 584,588 ---- - (void)onSelectCreateTableMenuItem:(id)sender { + UNUSED_PARAMETER(sender); NSIndexSet *theRows =[schemaView selectedRowIndexes]; unsigned int currentRow =[theRows firstIndex]; *************** *** 571,574 **** --- 597,601 ---- - (void)onSelectCreateBakTableMenuItem:(id)sender { + UNUSED_PARAMETER(sender); NSIndexSet *theRows =[schemaView selectedRowIndexes]; unsigned int currentRow =[theRows firstIndex]; *************** *** 586,589 **** --- 613,617 ---- - (void)onSelectAlterTableRenameMenuItem:(id)sender { + UNUSED_PARAMETER(sender); NSIndexSet *theRows =[schemaView selectedRowIndexes]; unsigned int currentRow =[theRows firstIndex]; *************** *** 598,601 **** --- 626,630 ---- - (void)onSelectVacuumTableMenuItem:(id)sender { + UNUSED_PARAMETER(sender); NSIndexSet *theRows =[schemaView selectedRowIndexes]; unsigned int currentRow =[theRows firstIndex]; *************** *** 610,613 **** --- 639,643 ---- - (void)onSelectTruncateTableMenuItem:(id)sender { + UNUSED_PARAMETER(sender); NSIndexSet *theRows =[schemaView selectedRowIndexes]; unsigned int currentRow =[theRows firstIndex]; *************** *** 622,625 **** --- 652,656 ---- - (void)onSelectDropTableMenuItem:(id)sender { + UNUSED_PARAMETER(sender); NSIndexSet *theRows =[schemaView selectedRowIndexes]; unsigned int currentRow =[theRows firstIndex]; *************** *** 636,639 **** --- 667,671 ---- - (void)onSelectColSelectMenuItem:(id)sender { + UNUSED_PARAMETER(sender); NSIndexSet *theRows =[schemaView selectedRowIndexes]; unsigned currentIndex = [theRows firstIndex]; *************** *** 661,664 **** --- 693,697 ---- - (void)onSelectColsMenuItem:(id)sender { + UNUSED_PARAMETER(sender); NSIndexSet *theRows =[schemaView selectedRowIndexes]; bool first = true; *************** *** 680,683 **** --- 713,717 ---- - (void)onSelectCreateIndexOnColsMenuItem:(id)sender { + UNUSED_PARAMETER(sender); NSIndexSet *theRows =[schemaView selectedRowIndexes]; unsigned currentIndex = [theRows firstIndex]; *************** *** 706,709 **** --- 740,744 ---- - (void)onSelectCreateUniqIndexOnColsMenuItem:(id)sender { + UNUSED_PARAMETER(sender); NSIndexSet *theRows =[schemaView selectedRowIndexes]; unsigned currentIndex = [theRows firstIndex]; *************** *** 735,738 **** --- 770,774 ---- - (void)onSelectAlterTabAlterColMenuItem:(id)sender { + UNUSED_PARAMETER(sender); BOOL first = true; NSIndexSet *theRows =[schemaView selectedRowIndexes]; *************** *** 761,764 **** --- 797,801 ---- - (void)onSelectAlterAddColMenuItem:(id)sender { + UNUSED_PARAMETER(sender); BOOL first = true; NSIndexSet *theRows =[schemaView selectedRowIndexes]; *************** *** 787,790 **** --- 824,828 ---- - (void)onSelectAlterRenameColMenuItem:(id)sender { + UNUSED_PARAMETER(sender); BOOL first = true; NSIndexSet *theRows =[schemaView selectedRowIndexes]; *************** *** 812,815 **** --- 850,854 ---- - (void)onSelectCreateTabColsMenuItem:(id)sender { + UNUSED_PARAMETER(sender); NSIndexSet *theRows =[schemaView selectedRowIndexes]; unsigned currentIndex = [theRows firstIndex]; *************** *** 839,842 **** --- 878,882 ---- - (void)onSelectDropColMenuItem:(id)sender { + UNUSED_PARAMETER(sender); BOOL first = true; NSIndexSet *theRows =[schemaView selectedRowIndexes]; *************** *** 865,868 **** --- 905,909 ---- - (void)onSelectCreateViewMenuItem:(id)sender { + UNUSED_PARAMETER(sender); NSIndexSet *theRows =[schemaView selectedRowIndexes]; unsigned int currentRow =[theRows firstIndex]; *************** *** 878,881 **** --- 919,923 ---- - (void)onSelectCreateViewTemplateMenuItem:(id)sender { + UNUSED_PARAMETER(sender); NSIndexSet *theRows =[schemaView selectedRowIndexes]; unsigned int currentRow =[theRows firstIndex]; *************** *** 889,897 **** - (void)onSelectDropViewMenuItem:(id)sender { NSIndexSet *theRows =[schemaView selectedRowIndexes]; unsigned int currentRow =[theRows firstIndex]; NSString *tableName = [[schemaView itemAtRow:currentRow] baseTable]; NSString *schemaName = [[schemaView itemAtRow:currentRow] baseSchema]; ! NSString *sql = [NSString stringWithFormat:@"DROP VIEW %@.%@;\n", schemaName, tableName]; [query insertText:sql]; --- 931,941 ---- - (void)onSelectDropViewMenuItem:(id)sender { + UNUSED_PARAMETER(sender); NSIndexSet *theRows =[schemaView selectedRowIndexes]; unsigned int currentRow =[theRows firstIndex]; NSString *tableName = [[schemaView itemAtRow:currentRow] baseTable]; NSString *schemaName = [[schemaView itemAtRow:currentRow] baseSchema]; ! //UNUSED_PARAMETER(sender); ! NSString *sql = [NSString stringWithFormat:@"DROP VIEW %@.%@;\n", schemaName, tableName]; [query insertText:sql]; *************** *** 901,904 **** --- 945,949 ---- - (void)onSelectCreateFunctionMenuItem:(id)sender { + UNUSED_PARAMETER(sender); NSIndexSet *theRows =[schemaView selectedRowIndexes]; unsigned int currentRow =[theRows firstIndex]; *************** *** 914,917 **** --- 959,963 ---- - (void)onSelectCreateFunctionTemplateMenuItem:(id)sender { + UNUSED_PARAMETER(sender); NSIndexSet *theRows =[schemaView selectedRowIndexes]; unsigned int currentRow =[theRows firstIndex]; *************** *** 937,940 **** --- 983,987 ---- - (void)onSelectDropFunctionMenuItem:(id)sender { + UNUSED_PARAMETER(sender); NSIndexSet *theRows =[schemaView selectedRowIndexes]; unsigned int currentRow =[theRows firstIndex]; *************** *** 951,954 **** --- 998,1002 ---- - (void)onSelectDropIndexMenuItem:(id)sender { + UNUSED_PARAMETER(sender); NSIndexSet *theRows =[schemaView selectedRowIndexes]; unsigned int currentRow =[theRows firstIndex]; *************** *** 1070,1072 **** --- 1118,1121 ---- } + @end Index: SqlDocument.h =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/SqlDocument.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** SqlDocument.h 18 Aug 2006 17:46:01 -0000 1.12 --- SqlDocument.h 30 Aug 2006 01:06:53 -0000 1.13 *************** *** 15,18 **** --- 15,20 ---- #import "MyResultsView.h" + @class PreferenceController; + @interface SqlDocument : NSDocument { *************** *** 48,51 **** --- 50,54 ---- ExplorerModel *explorer; // ref to schema outline view data source + // Non-Gui NSString *fileContent; NSData *fileData; *************** *** 118,120 **** --- 121,125 ---- - (void)colorRange:(NSRange)rangeToColor; + #define UNUSED_PARAMETER(x) (void)(x) + @end |
From: Neil T. <nt...@us...> - 2006-08-30 01:06:57
|
Update of /cvsroot/pgsqlformac/QueryTool/English.lproj/SqlDocument.nib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22407/English.lproj/SqlDocument.nib Modified Files: keyedobjects.nib Log Message: Add preferences. Index: keyedobjects.nib =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/English.lproj/SqlDocument.nib/keyedobjects.nib,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 Binary files /tmp/cvsJNkVML and /tmp/cvsjfyKYm differ |
From: Neil T. <nt...@us...> - 2006-08-30 01:06:56
|
Update of /cvsroot/pgsqlformac/QueryTool/English.lproj/Preferences.nib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22407/English.lproj/Preferences.nib Added Files: classes.nib info.nib keyedobjects.nib Log Message: Add preferences. --- NEW FILE: info.nib --- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>IBDocumentLocation</key> <string>47 245 356 240 0 0 1440 878 </string> <key>IBFramework Version</key> <string>446.1</string> <key>IBOpenObjects</key> <array> <integer>5</integer> </array> <key>IBSystem Version</key> <string>8J135</string> </dict> </plist> --- NEW FILE: classes.nib --- { IBClasses = ( {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, { ACTIONS = {cancelPreferences = id; defaultPreferences = id; savePreferences = id; }; CLASS = PreferenceController; LANGUAGE = ObjC; OUTLETS = { prefLogAllSQL = NSButton; prefLogInfoMessages = NSButton; prefPostgresqlHelpURL = NSTextField; prefPostgresqlSQLURL = NSTextField; prefShowPGCatalogSchema = NSButton; prefShowPGInfoSchema = NSButton; prefShowPGPublicSchema = NSButton; prefShowPGTempSchema = NSButton; prefShowPGToastSchema = NSButton; }; SUPERCLASS = NSWindowController; } ); IBVersion = 1; } --- NEW FILE: keyedobjects.nib --- (This appears to be a binary file; contents omitted.) |
From: Neil T. <nt...@us...> - 2006-08-30 01:06:55
|
Update of /cvsroot/pgsqlformac/QueryTool/English.lproj/MainMenu.nib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22407/English.lproj/MainMenu.nib Modified Files: classes.nib info.nib objects.nib Log Message: Add preferences. Index: info.nib =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/English.lproj/MainMenu.nib/info.nib,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** info.nib 16 Jul 2006 23:17:40 -0000 1.4 --- info.nib 30 Aug 2006 01:06:53 -0000 1.5 *************** *** 4,12 **** <dict> <key>IBDocumentLocation</key> ! <string>102 69 635 412 0 0 1440 878 </string> <key>IBEditorPositions</key> <dict> <key>29</key> ! <string>86 558 477 44 0 0 1440 878 </string> </dict> <key>IBFramework Version</key> --- 4,12 ---- <dict> <key>IBDocumentLocation</key> ! <string>91 69 635 412 0 0 1440 878 </string> <key>IBEditorPositions</key> <dict> <key>29</key> ! <string>100 688 477 44 0 0 1440 878 </string> </dict> <key>IBFramework Version</key> Index: objects.nib =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/English.lproj/MainMenu.nib/objects.nib,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 Binary files /tmp/cvsSbn19B and /tmp/cvsUAQF5c differ Index: classes.nib =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/English.lproj/MainMenu.nib/classes.nib,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** classes.nib 16 Jul 2006 23:17:40 -0000 1.3 --- classes.nib 30 Aug 2006 01:06:53 -0000 1.4 *************** *** 2,5 **** --- 2,11 ---- IBClasses = ( { + ACTIONS = {showPreferencePanel = id; }; + CLASS = AppController; + LANGUAGE = ObjC; + SUPERCLASS = NSObject; + }, + { ACTIONS = { onConnect = id; |
From: Neil T. <nt...@us...> - 2006-08-30 00:58:20
|
Update of /cvsroot/pgsqlformac/QueryTool/English.lproj/Preferences.nib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19381/English.lproj/Preferences.nib Log Message: Directory /cvsroot/pgsqlformac/QueryTool/English.lproj/Preferences.nib added to the repository |
From: Neil T. <nt...@us...> - 2006-08-26 12:25:37
|
Update of /cvsroot/pgsqlformac/pgCocoaDB/UnitTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28029/UnitTest Modified Files: pgCocoaDBSchemaTest.m Log Message: Add some comments and reformat functions. Index: pgCocoaDBSchemaTest.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/UnitTest/pgCocoaDBSchemaTest.m,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** pgCocoaDBSchemaTest.m 19 Aug 2006 12:06:48 -0000 1.14 --- pgCocoaDBSchemaTest.m 26 Aug 2006 12:25:33 -0000 1.15 *************** *** 134,155 **** STAssertTrue([conn errorDescription] == nil, @"Error executing SQL: %@. %@", sql, [conn errorDescription]); ! // TODO check if function exists ! sql = [NSString stringWithFormat:@"%s%@.%@.%s", "CREATE or REPLACE FUNCTION ", PGCocoaTestDatabase, PGCocoaTestSchema, "create_time_stamp() RETURNS trigger AS $time_stamp$ \ ! BEGIN \ ! NEW.create_time := current_timestamp; \ ! RETURN NEW; \ ! END; \ ! $time_stamp$ LANGUAGE plpgsql; "]; [conn execQuery:sql]; STAssertTrue([conn errorDescription] == nil, @"Error executing SQL: %@. %@", sql, [conn errorDescription]); - // TODO check if function exists sql = [NSString stringWithFormat:@"%s%@.%@.%s", "CREATE or REPLACE FUNCTION ", PGCocoaTestDatabase, PGCocoaTestSchema, ! "update_time_stamp() RETURNS trigger AS $time_stamp$ \ ! BEGIN \ ! NEW.update_time := current_timestamp; \ ! RETURN NEW; \ ! END; \ ! $time_stamp$ LANGUAGE plpgsql; "]; [conn execQuery:sql]; STAssertTrue([conn errorDescription] == nil, @"Error executing SQL: %@. %@", sql, [conn errorDescription]); --- 134,154 ---- STAssertTrue([conn errorDescription] == nil, @"Error executing SQL: %@. %@", sql, [conn errorDescription]); ! sql = [NSString stringWithFormat:@"%s%@.%@.%s", "CREATE or REPLACE FUNCTION ", PGCocoaTestDatabase, PGCocoaTestSchema, ! "create_time_stamp() RETURNS trigger AS $time_stamp$\n\ ! BEGIN\n\ ! NEW.create_time := current_timestamp;\n\ ! RETURN NEW;\n\ ! END;\n\ ! $time_stamp$ LANGUAGE plpgsql;\n"]; [conn execQuery:sql]; STAssertTrue([conn errorDescription] == nil, @"Error executing SQL: %@. %@", sql, [conn errorDescription]); sql = [NSString stringWithFormat:@"%s%@.%@.%s", "CREATE or REPLACE FUNCTION ", PGCocoaTestDatabase, PGCocoaTestSchema, ! "update_time_stamp() RETURNS trigger AS $time_stamp$\n\ ! BEGIN\n\ ! NEW.update_time := current_timestamp;\n\ ! RETURN NEW;\n\ ! END;\n\ ! $time_stamp$ LANGUAGE plpgsql;\n"]; [conn execQuery:sql]; STAssertTrue([conn errorDescription] == nil, @"Error executing SQL: %@. %@", sql, [conn errorDescription]); *************** *** 157,161 **** // for testing query tool sql = [NSString stringWithFormat:@"%s%@.%@.%s", "CREATE or REPLACE FUNCTION ", PGCocoaTestDatabase, PGCocoaTestSchema, ! "sum_n_product(x int, y int, OUT sum int, OUT prod int) AS $$\nBEGIN\n sum := x + y;\n prod := x * y;\nEND; $$ LANGUAGE plpgsql; "]; [conn execQuery:sql]; STAssertTrue([conn errorDescription] == nil, @"Error executing SQL: %@. %@", sql, [conn errorDescription]); --- 156,160 ---- // for testing query tool sql = [NSString stringWithFormat:@"%s%@.%@.%s", "CREATE or REPLACE FUNCTION ", PGCocoaTestDatabase, PGCocoaTestSchema, ! "sum_n_product(x int, y int, OUT sum int, OUT prod int) AS $$\nBEGIN\n sum := x + y;\n prod := x * y;\nEND;\n$$ LANGUAGE plpgsql;\n"]; [conn execQuery:sql]; STAssertTrue([conn errorDescription] == nil, @"Error executing SQL: %@. %@", sql, [conn errorDescription]); |
From: Neil T. <nt...@us...> - 2006-08-26 12:25:37
|
Update of /cvsroot/pgsqlformac/pgCocoaDB In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28029 Modified Files: ChangeLog Connection.m ExplorerModel.m Schema.m Log Message: Add some comments and reformat functions. Index: Schema.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Schema.m,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Schema.m 19 Aug 2006 12:06:48 -0000 1.18 --- Schema.m 26 Aug 2006 12:25:33 -0000 1.19 *************** *** 40,44 **** // TODO not found raise error? ! NSLog(@"Did not find PostgreSQL version 8.1"); NSLog(sql); NSLog(pgVersionFound); --- 40,44 ---- // TODO not found raise error? ! NSLog(@"Did not find PostgreSQL version 8.1: %@", pgVersionFound); NSLog(sql); NSLog(pgVersionFound); Index: Connection.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Connection.m,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Connection.m 12 Aug 2006 16:38:16 -0000 1.13 --- Connection.m 26 Aug 2006 12:25:33 -0000 1.14 *************** *** 93,100 **** } if (errorDescription) [errorDescription release]; ! errorDescription = nil; ! // set up notification PQsetNoticeProcessor(pgconn, handle_pq_notice, self); --- 93,106 ---- } + // TODO if good connection should we remove password from memory + // or should it be encrypted? + + // TODO password should be asked for in dialog used and then erased? + if (errorDescription) + { [errorDescription release]; ! errorDescription = nil; ! } // set up notification PQsetNoticeProcessor(pgconn, handle_pq_notice, self); Index: ExplorerModel.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ExplorerModel.m,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ExplorerModel.m 19 Aug 2006 12:06:48 -0000 1.11 --- ExplorerModel.m 26 Aug 2006 12:25:33 -0000 1.12 *************** *** 134,138 **** [self createColumnNodes:newNode fromSchemaName:schemaName fromTableName:viewName]; ! // TODO get indexes and other ?? [aParent addChild:newNode]; --- 134,138 ---- [self createColumnNodes:newNode fromSchemaName:schemaName fromTableName:viewName]; ! // TODO get indexes and other for views? [aParent addChild:newNode]; *************** *** 257,261 **** [newNode setBaseTable:tableName]; [newNode setBaseSchema:schemaName]; - // TODO this should only display column names. [newNode setDisplayColumn2:[schema getIndexSQLFromSchema:schemaName fromTableName:tableName fromIndexName:indexName]]; [titleNode addChild:newNode]; --- 257,260 ---- *************** *** 324,327 **** --- 323,327 ---- [super init]; + // TODO clone this connection so we can multi-thread connection = theConnection; schema = [[Schema alloc] initWithConnection:connection]; Index: ChangeLog =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ChangeLog,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ChangeLog 19 Aug 2006 12:06:48 -0000 1.16 --- ChangeLog 26 Aug 2006 12:25:33 -0000 1.17 *************** *** 1,2 **** --- 1,8 ---- + 2006-08-19 07:06 ntiffin + + * ChangeLog, ExplorerModel.m, Schema.h, Schema.m, + UnitTest/pgCocoaDBSchemaTest.m: Add display of index column + names. + 2006-08-13 18:50 ntiffin |
From: Neil T. <nt...@us...> - 2006-08-19 12:06:52
|
Update of /cvsroot/pgsqlformac/pgCocoaDB In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10405 Modified Files: ChangeLog ExplorerModel.m Schema.h Schema.m Log Message: Add display of index column names. Index: Schema.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Schema.m,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Schema.m 12 Aug 2006 16:38:16 -0000 1.17 --- Schema.m 19 Aug 2006 12:06:48 -0000 1.18 *************** *** 286,289 **** --- 286,313 ---- } + //select indexname from pg_indexes where schemaname = 'public' AND tablename = 'file_monitor_names'; + //SELECT attname FROM pg_catalog.pg_attribute, pg_catalog.pg_class + //where pg_attribute.attrelid = pg_class.oid + //AND relname LIKE 'file_monitor_names_file_set_name_key'; + + -(RecordSet *)getIndexColumnNamesFromSchema:(NSString *)schemaName fromTableName:(NSString *)tableName fromIndexName:(NSString *)indexName + { + NSString *sql; + sql = [NSString stringWithFormat:@"SELECT attname \ + FROM pg_index x \ + JOIN pg_class c ON c.oid = x.indrelid \ + JOIN pg_class i ON i.oid = x.indexrelid \ + JOIN pg_attribute a ON a. attrelid = i.oid \ + JOIN pg_namespace n ON n.oid = c.relnamespace \ + WHERE c.relkind = 'r'::\"char\" AND i.relkind = 'i'::\"char\" \ + AND c.relname = '%@' \ + AND n.nspname = '%@' \ + AND i.relname = '%@'", tableName, schemaName, indexName]; + #if PGCOCOA_LOG_SQL + NSLog(sql); + #endif + + return [connection execQueryNoLog:sql]; + } -(RecordSet *)getTableColumnNamesFromSchema:(NSString *)schemaName fromTableName:(NSString *) tableName; Index: ChangeLog =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ChangeLog,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ChangeLog 13 Aug 2006 23:50:24 -0000 1.15 --- ChangeLog 19 Aug 2006 12:06:48 -0000 1.16 *************** *** 1,2 **** --- 1,8 ---- + 2006-08-13 18:50 ntiffin + + * ChangeLog, ExplorerModel.h, ExplorerModel.m, + UnitTest/pgCocoaDBSchemaTest.m: Explorer API change to accomodate + preferences. + 2006-08-12 11:38 ntiffin Index: ExplorerModel.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ExplorerModel.m,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ExplorerModel.m 13 Aug 2006 23:50:24 -0000 1.10 --- ExplorerModel.m 19 Aug 2006 12:06:48 -0000 1.11 *************** *** 209,212 **** --- 209,235 ---- + - (void)createIndexColumnNodes:(ExplorerNode *)aParent fromSchemaName:(NSString *)schemaName fromTableName:(NSString *)tableName fromIndexName:(NSString *)indexName + { + RecordSet * results; + ExplorerNode * newNode; + NSString * colName; + int i; + + results = [schema getIndexColumnNamesFromSchema:schemaName fromTableName:tableName fromIndexName:indexName]; + for (i = 0; i < [results count]; i++) + { + newNode = [[ExplorerNode alloc] init]; + colName = [[[[results itemAtIndex: i] fields] itemAtIndex:0] value]; + [newNode setName:colName]; + [newNode setExplorerType:@"Index Column"]; + [newNode setParent:aParent]; + [newNode setBaseTable:tableName]; + [newNode setBaseSchema:schemaName]; + [aParent addChild:newNode]; + + [newNode release]; + } + } + - (void)createIndexNodes:(ExplorerNode *)aParent fromSchemaName:(NSString *)schemaName fromTableName:(NSString *)tableName { *************** *** 234,240 **** [newNode setBaseTable:tableName]; [newNode setBaseSchema:schemaName]; ! //[newNode setDisplayColumn2:[schema getIndexSQLFromSchema:schemaName fromTableName:tableName fromIndexName:indexName]]; [titleNode addChild:newNode]; [newNode release]; } --- 257,265 ---- [newNode setBaseTable:tableName]; [newNode setBaseSchema:schemaName]; ! // TODO this should only display column names. ! [newNode setDisplayColumn2:[schema getIndexSQLFromSchema:schemaName fromTableName:tableName fromIndexName:indexName]]; [titleNode addChild:newNode]; + [self createIndexColumnNodes:newNode fromSchemaName:schemaName fromTableName:tableName fromIndexName:indexName]; [newNode release]; } Index: Schema.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Schema.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Schema.h 16 Jul 2006 23:13:06 -0000 1.10 --- Schema.h 19 Aug 2006 12:06:48 -0000 1.11 *************** *** 41,44 **** --- 41,45 ---- -(RecordSet *)getFunctionNamesFromSchema:(NSString *)schemaName; -(RecordSet *)getIndexNamesFromSchema:(NSString *)schemaName fromTableName:(NSString *) tableName; + -(RecordSet *)getIndexColumnNamesFromSchema:(NSString *)schemaName fromTableName:(NSString *)tableName fromIndexName:(NSString *)indexName; -(RecordSet *)getSchemaNames; -(RecordSet *)getSequenceColumnNamesFromSchema:(NSString *)schemaName fromSequence:(NSString *)sequenceName; |
From: Neil T. <nt...@us...> - 2006-08-19 12:06:52
|
Update of /cvsroot/pgsqlformac/pgCocoaDB/UnitTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10405/UnitTest Modified Files: pgCocoaDBSchemaTest.m Log Message: Add display of index column names. Index: pgCocoaDBSchemaTest.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/UnitTest/pgCocoaDBSchemaTest.m,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** pgCocoaDBSchemaTest.m 13 Aug 2006 23:50:24 -0000 1.13 --- pgCocoaDBSchemaTest.m 19 Aug 2006 12:06:48 -0000 1.14 *************** *** 21,25 **** NSString* const PGCocoaTestPassword = @""; NSString* const PGCocoaTestHost = @"localhost"; ! NSString* const PGCocoaTestPort = @"5432"; // Uncomment the following line to automatically drop and recreate the test database. --- 21,25 ---- NSString* const PGCocoaTestPassword = @""; NSString* const PGCocoaTestHost = @"localhost"; ! NSString* const PGCocoaTestPort = @"5433"; // Uncomment the following line to automatically drop and recreate the test database. *************** *** 993,996 **** --- 993,1032 ---- } + -(void)testIndexColumns + { + RecordSet * results; + unsigned int i; + NSNumber *aFoundCount = [NSNumber numberWithInt:0]; + NSArray * columnCount = [NSArray arrayWithObjects: aFoundCount, nil]; + NSArray * columnNames = [NSArray arrayWithObjects: @"address_id", nil]; + NSMutableDictionary * columnLookup = [[NSMutableDictionary alloc] initWithObjects:columnCount forKeys:columnNames]; + NSString* aColumnName; + NSNumber *newValue; + + results = [testSchema getIndexColumnNamesFromSchema:PGCocoaTestSchema fromTableName:@"address" fromIndexName:@"address_pkey"]; + STAssertTrue([results count] == 1, @"Too many columns for index address_pkey on table address."); + for (i = 0; i < [results count]; i++) + { + aColumnName = [[[[results itemAtIndex: i] fields] itemAtIndex:0] value]; + aFoundCount = [columnLookup objectForKey: aColumnName]; + if (aFoundCount != nil) + { + newValue = [NSNumber numberWithInt:[aFoundCount intValue]+1]; + [columnLookup setObject:newValue forKey:aColumnName]; + } + else + { + STFail(@"Found extra column name (%@) in index %@.", aColumnName, @"address_pkey"); + } + } + + NSLog(@"Checking columns in index %@:", @"address_pkey"); + NSEnumerator *enumerator = [columnLookup keyEnumerator]; + while ((aColumnName = [enumerator nextObject])) { + aFoundCount = [columnLookup objectForKey: aColumnName]; + NSLog(@" %@ count = %d.", aColumnName, [aFoundCount intValue]); + STAssertTrue([aFoundCount intValue] == 1, @"Problem finding column name (%@) in index %@.", aColumnName, @"address_pkey"); + } + } @end |
From: Neil T. <nt...@us...> - 2006-08-18 17:46:09
|
Update of /cvsroot/pgsqlformac/QueryTool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31926 Modified Files: ChangeLog MyOutlineView.m SqlDocument.h SqlDocument.m Log Message: Add missing SQL formation routines. Index: SqlDocument.m =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/SqlDocument.m,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** SqlDocument.m 13 Aug 2006 23:54:30 -0000 1.18 --- SqlDocument.m 18 Aug 2006 17:46:01 -0000 1.19 *************** *** 712,716 **** NSAssert(tableName,@"onSelectCreateUniqIndexOnColsMenuItem: no table name."); NSAssert(schemaName, @"onSelectCreateUniqIndexOnColsMenuItem: no schema name."); ! bool first = true; int indexCount = [[explorer schema] getIndexCountFromSchema:schemaName fromTableName:tableName] + 1; --- 712,716 ---- NSAssert(tableName,@"onSelectCreateUniqIndexOnColsMenuItem: no table name."); NSAssert(schemaName, @"onSelectCreateUniqIndexOnColsMenuItem: no schema name."); ! BOOL first = true; int indexCount = [[explorer schema] getIndexCountFromSchema:schemaName fromTableName:tableName] + 1; *************** *** 730,735 **** --- 730,765 ---- } + // ALTER TABLE distributors + // ALTER COLUMN address TYPE varchar(80), + // ALTER COLUMN name TYPE varchar(100); + - (void)onSelectAlterTabAlterColMenuItem:(id)sender + { + BOOL first = true; + NSIndexSet *theRows =[schemaView selectedRowIndexes]; + unsigned int currentRow =[theRows firstIndex]; + NSString *tableName = [[schemaView itemAtRow:currentRow] baseTable]; + NSString *schemaName = [[schemaView itemAtRow:currentRow] baseSchema]; + NSAssert(tableName,@"onSelectCreateViewMenuItem: no table name."); + NSAssert(schemaName, @"onSelectCreateViewMenuItem: no schema name."); + + NSMutableString *sql = [[[NSMutableString alloc] init] autorelease]; + [sql appendFormat:@"ALTER TABLE %@.%@\n", schemaName, tableName]; + while (currentRow != NSNotFound) { + if (!first) + { + [sql appendString:@", \n"]; + } + [sql appendFormat:@" ALTER COLUMN %@ TYPE %@", [[schemaView itemAtRow:currentRow] name], [[schemaView itemAtRow:currentRow] displayColumn2]]; + currentRow = [theRows indexGreaterThanIndex: currentRow]; + first = false; + } + [sql appendString:@";\n"]; + [query insertText:sql]; + } + + //ALTER TABLE distributors ADD COLUMN address varchar(30); - (void)onSelectAlterAddColMenuItem:(id)sender { + BOOL first = true; NSIndexSet *theRows =[schemaView selectedRowIndexes]; unsigned int currentRow =[theRows firstIndex]; *************** *** 739,748 **** NSAssert(schemaName, @"onSelectCreateViewMenuItem: no schema name."); ! NSString *sql = [NSString stringWithFormat:@"TODO %@ %@\n", schemaName, tableName]; [query insertText:sql]; } - (void)onSelectAlterRenameColMenuItem:(id)sender { NSIndexSet *theRows =[schemaView selectedRowIndexes]; unsigned int currentRow =[theRows firstIndex]; --- 769,791 ---- NSAssert(schemaName, @"onSelectCreateViewMenuItem: no schema name."); ! NSMutableString *sql = [[[NSMutableString alloc] init] autorelease]; ! [sql appendFormat:@"ALTER TABLE %@.%@\n", schemaName, tableName]; ! while (currentRow != NSNotFound) { ! if (!first) ! { ! [sql appendString:@", \n"]; ! } ! [sql appendFormat:@" ADD COLUMN %@ %@", [[schemaView itemAtRow:currentRow] name], [[schemaView itemAtRow:currentRow] displayColumn2]]; ! currentRow = [theRows indexGreaterThanIndex: currentRow]; ! first = false; ! } ! [sql appendString:@";\n"]; [query insertText:sql]; } + //ALTER TABLE distributors RENAME COLUMN address TO city; - (void)onSelectAlterRenameColMenuItem:(id)sender { + BOOL first = true; NSIndexSet *theRows =[schemaView selectedRowIndexes]; unsigned int currentRow =[theRows firstIndex]; *************** *** 752,756 **** NSAssert(schemaName, @"onSelectCreateViewMenuItem: no schema name."); ! NSString *sql = [NSString stringWithFormat:@"TODO %@ %@\n", schemaName, tableName]; [query insertText:sql]; } --- 795,810 ---- NSAssert(schemaName, @"onSelectCreateViewMenuItem: no schema name."); ! NSMutableString *sql = [[[NSMutableString alloc] init] autorelease]; ! [sql appendFormat:@"ALTER TABLE %@.%@\n", schemaName, tableName]; ! while (currentRow != NSNotFound) { ! if (!first) ! { ! [sql appendString:@", \n"]; ! } ! [sql appendFormat:@" RENAME COLUMN %@ TO <New Name>", [[schemaView itemAtRow:currentRow] name]]; ! currentRow = [theRows indexGreaterThanIndex: currentRow]; ! first = false; ! } ! [sql appendString:@";\n"]; [query insertText:sql]; } *************** *** 785,788 **** --- 839,843 ---- - (void)onSelectDropColMenuItem:(id)sender { + BOOL first = true; NSIndexSet *theRows =[schemaView selectedRowIndexes]; unsigned int currentRow =[theRows firstIndex]; *************** *** 792,796 **** NSAssert(schemaName, @"onSelectCreateViewMenuItem: no schema name."); ! NSString *sql = [NSString stringWithFormat:@"TODO %@ %@\n", schemaName, tableName]; [query insertText:sql]; } --- 847,862 ---- NSAssert(schemaName, @"onSelectCreateViewMenuItem: no schema name."); ! NSMutableString *sql = [[[NSMutableString alloc] init] autorelease]; ! [sql appendFormat:@"ALTER TABLE %@.%@\n", schemaName, tableName]; ! while (currentRow != NSNotFound) { ! if (!first) ! { ! [sql appendString:@", \n"]; ! } ! [sql appendFormat:@" DROP COLUMN %@", [[schemaView itemAtRow:currentRow] name]]; ! currentRow = [theRows indexGreaterThanIndex: currentRow]; ! first = false; ! } ! [sql appendString:@";\n"]; [query insertText:sql]; } Index: ChangeLog =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/ChangeLog,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ChangeLog 13 Aug 2006 23:54:30 -0000 1.12 --- ChangeLog 18 Aug 2006 17:46:01 -0000 1.13 *************** *** 1,2 **** --- 1,7 ---- + 2006-08-13 18:54 ntiffin + + * ChangeLog, SqlDocument.m, TODO.txt: Fix bug associated with + releaseing explorer too early. + 2006-08-12 11:39 ntiffin Index: MyOutlineView.m =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/MyOutlineView.m,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** MyOutlineView.m 16 Jul 2006 23:17:39 -0000 1.6 --- MyOutlineView.m 18 Aug 2006 17:46:01 -0000 1.7 *************** *** 98,101 **** --- 98,107 ---- newItem = [[NSMenuItem alloc] init]; + [newItem setTitle:@"ALTER TABLE <tab> ALTER COLUMN <col> TYPE <type>"]; + [newItem setTarget: menuActionTarget]; + [newItem setAction: @selector(onSelectAlterTabAlterColMenuItem:)]; + [columnMenu addItem: newItem]; + + newItem = [[NSMenuItem alloc] init]; [newItem setTitle:@"ALTER TABLE <tab> ADD COLUMN <col> <type>"]; [newItem setTarget: menuActionTarget]; Index: SqlDocument.h =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/SqlDocument.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** SqlDocument.h 16 Jul 2006 23:17:39 -0000 1.11 --- SqlDocument.h 18 Aug 2006 17:46:01 -0000 1.12 *************** *** 101,104 **** --- 101,105 ---- - (void)onSelectCreateTabColsMenuItem:(id)sender; - (void)onSelectDropColMenuItem:(id)sender; + - (void)onSelectAlterTabAlterColMenuItem:(id)sender; // Views |
From: Neil T. <nt...@us...> - 2006-08-13 23:54:32
|
Update of /cvsroot/pgsqlformac/QueryTool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29417 Modified Files: ChangeLog SqlDocument.m TODO.txt Log Message: Fix bug associated with releaseing explorer too early. Index: SqlDocument.m =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/SqlDocument.m,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** SqlDocument.m 12 Aug 2006 16:39:04 -0000 1.17 --- SqlDocument.m 13 Aug 2006 23:54:30 -0000 1.18 *************** *** 168,178 **** -(void)setNewExplorerConn { ! // create the schema explorer ! [explorer release]; explorer =[[ExplorerModel alloc] initWithConnection: conn]; - [schemaView setDataSource:explorer]; // explorer does the work. - [schemaView setMenuActionTarget:self]; - //[explorer printLog]; - // set explorer display defaults from NSUserDefaults NSUserDefaults * userDefaults = [NSUserDefaults standardUserDefaults]; --- 168,177 ---- -(void)setNewExplorerConn { ! ExplorerModel *newExplorer = [[ExplorerModel alloc] initRebuilding]; ! [schemaView setDataSource:newExplorer]; ! [explorer autorelease]; ! ! // change the schema explorer explorer =[[ExplorerModel alloc] initWithConnection: conn]; // set explorer display defaults from NSUserDefaults NSUserDefaults * userDefaults = [NSUserDefaults standardUserDefaults]; *************** *** 181,184 **** --- 180,189 ---- [explorer setShowPGToast:[userDefaults boolForKey:@"PGSqlForMac_QueryTool_ShowPGToastSchema"]]; [explorer setShowPGTemps:[userDefaults boolForKey:@"PGSqlForMac_QueryTool_ShowPGTempsSchema"]]; + + [explorer buildSchema]; + [schemaView setDataSource:explorer]; // explorer does the work. + [schemaView setMenuActionTarget:self]; + [newExplorer autorelease]; + //[explorer printLog]; } Index: TODO.txt =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/TODO.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TODO.txt 16 Jul 2006 23:17:39 -0000 1.5 --- TODO.txt 13 Aug 2006 23:54:30 -0000 1.6 *************** *** 12,16 **** --- 12,18 ---- - 2006-06-24 Add command to clear SQL Log. + - 2006-08-13 SQL Log does not contain enough information. + - 2006-08-13 Move Schema reading to another thread. Make it load in parallel. FIXME (Known Errors) *************** *** 22,25 **** --- 24,31 ---- Completed ========= + - 2006-08-13 Fix bug with incorrect release of explorer whil display was still using it. + + - 2006-08-13 Restructure ExplorerModel initWithConnection to respect display user defaults (ie setShowPGCatalog). + - 2006-07-16 Fix TODO for autoincrementing index names Index: ChangeLog =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/ChangeLog,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ChangeLog 12 Aug 2006 16:39:04 -0000 1.11 --- ChangeLog 13 Aug 2006 23:54:30 -0000 1.12 *************** *** 1,2 **** --- 1,6 ---- + 2006-08-12 11:39 ntiffin + + * ChangeLog, DataSource.m, SqlDocument.m: More memory cleanup. + 2006-08-11 13:03 ntiffin |
From: Neil T. <nt...@us...> - 2006-08-13 23:50:27
|
Update of /cvsroot/pgsqlformac/pgCocoaDB In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28044 Modified Files: ChangeLog ExplorerModel.h ExplorerModel.m Log Message: Explorer API change to accomodate preferences. Index: ExplorerModel.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ExplorerModel.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ExplorerModel.h 13 May 2006 18:04:00 -0000 1.3 --- ExplorerModel.h 13 Aug 2006 23:50:24 -0000 1.4 *************** *** 18,28 **** Connection * connection; Schema * schema; ! bool showInformationSchema; //TODO ! bool showPGCatalog; //TODO ! bool showPGToast; //TODO ! bool showPGTemps; //TODO } - (id)initWithConnection:(Connection *) aConnection; - (Schema *)schema; - (bool)showInformationSchema; --- 18,32 ---- Connection * connection; Schema * schema; ! bool showInformationSchema; ! bool showPGCatalog; ! bool showPGToast; ! bool showPGTemps; } - (id)initWithConnection:(Connection *) aConnection; + - (id)initRebuilding; + - (void)buildSchema; + + -(void)setSchema:(Schema *)newSchema; - (Schema *)schema; - (bool)showInformationSchema; Index: ExplorerModel.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ExplorerModel.m,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ExplorerModel.m 12 Aug 2006 16:38:16 -0000 1.9 --- ExplorerModel.m 13 Aug 2006 23:50:24 -0000 1.10 *************** *** 278,281 **** --- 278,297 ---- } + - (id)initRebuilding + { + [super init]; + + schema = nil; + connection = nil; + rootNode = [[ExplorerNode alloc] init]; + [rootNode setName: @"Rebuilding"]; + [rootNode setBaseTable: @""]; + [rootNode setExplorerType:@"Database"]; + [rootNode setParent:nil]; + [rootNode setOID:0]; + + return self; + } + - (id)initWithConnection:(Connection *) theConnection *************** *** 283,300 **** [super init]; showInformationSchema = TRUE; showPGCatalog = TRUE; showPGToast = FALSE; showPGTemps = FALSE; ! ExplorerNode * newNode; ExplorerNode * newChild; RecordSet * results; ! schema = [[Schema alloc] initWithConnection:theConnection]; // set database level rootNode = [[ExplorerNode alloc] init]; ! [rootNode setName: [theConnection currentDatabase]]; [rootNode setBaseTable: @""]; [rootNode setExplorerType:@"Database"]; --- 299,327 ---- [super init]; + connection = theConnection; + schema = [[Schema alloc] initWithConnection:connection]; showInformationSchema = TRUE; showPGCatalog = TRUE; showPGToast = FALSE; showPGTemps = FALSE; ! return self; ! } ! ! ! - (void)buildSchema ! { ExplorerNode * newNode; ExplorerNode * newChild; RecordSet * results; ! if ((connection == nil) || (schema == nil)) ! { ! NSLog(@"Attempted to buildSchema without proper init."); ! return; ! } // set database level rootNode = [[ExplorerNode alloc] init]; ! [rootNode setName: [connection currentDatabase]]; [rootNode setBaseTable: @""]; [rootNode setExplorerType:@"Database"]; *************** *** 381,385 **** [newNode release]; } ! return self; } --- 408,412 ---- [newNode release]; } ! return; } *************** *** 392,395 **** --- 419,429 ---- } + -(void)setSchema:(Schema *)newSchema + { + [schema release]; + schema = newSchema; + [schema retain]; + } + // accessor methods - (Schema *)schema Index: ChangeLog =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ChangeLog,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ChangeLog 12 Aug 2006 16:38:16 -0000 1.14 --- ChangeLog 13 Aug 2006 23:50:24 -0000 1.15 *************** *** 1,2 **** --- 1,8 ---- + 2006-08-12 11:38 ntiffin + + * ChangeLog, Connection.m, Databases.m, ExplorerModel.m, + ExplorerNode.m, Field.m, Fields.m, RecordSet.m, Schema.m, + Table.m: More memory cleanup. + 2006-08-11 13:01 ntiffin |
From: Neil T. <nt...@us...> - 2006-08-13 23:50:27
|
Update of /cvsroot/pgsqlformac/pgCocoaDB/UnitTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28044/UnitTest Modified Files: pgCocoaDBSchemaTest.m Log Message: Explorer API change to accomodate preferences. Index: pgCocoaDBSchemaTest.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/UnitTest/pgCocoaDBSchemaTest.m,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** pgCocoaDBSchemaTest.m 16 Jul 2006 23:13:06 -0000 1.12 --- pgCocoaDBSchemaTest.m 13 Aug 2006 23:50:24 -0000 1.13 *************** *** 969,976 **** { ExplorerModel *explorer = [[ExplorerModel alloc] initWithConnection:conn]; [explorer printLog]; ! ! [explorer release]; } --- 969,976 ---- { ExplorerModel *explorer = [[ExplorerModel alloc] initWithConnection:conn]; + [explorer buildSchema]; [explorer printLog]; ! [explorer autorelease]; } |
From: Neil T. <nt...@us...> - 2006-08-12 16:39:06
|
Update of /cvsroot/pgsqlformac/QueryTool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26779 Modified Files: ChangeLog DataSource.m SqlDocument.m Log Message: More memory cleanup. Index: DataSource.m =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/DataSource.m,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** DataSource.m 8 Mar 2005 21:50:04 -0000 1.1.1.1 --- DataSource.m 12 Aug 2006 16:39:04 -0000 1.2 *************** *** 14,20 **** { [super init]; - items = [[NSMutableArray alloc] init]; - [items retain]; return self; --- 14,18 ---- *************** *** 26,30 **** { NSMutableDictionary *newItem = [[NSMutableDictionary alloc] init]; - [newItem retain]; [items addObject: newItem]; --- 24,27 ---- Index: SqlDocument.m =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/SqlDocument.m,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** SqlDocument.m 11 Aug 2006 18:03:09 -0000 1.16 --- SqlDocument.m 12 Aug 2006 16:39:04 -0000 1.17 *************** *** 169,187 **** { // create the schema explorer ! if (explorer) // we have already come through ! { ! ExplorerModel *tmp = explorer; ! ! explorer =[[ExplorerModel alloc] initWithConnection: conn]; ! [schemaView setDataSource:explorer]; // explorer does the work. ! [schemaView setMenuActionTarget:self]; ! [tmp release]; ! } ! else ! { ! explorer =[[ExplorerModel alloc] initWithConnection: conn]; ! [schemaView setDataSource:explorer]; // explorer does the work. ! [schemaView setMenuActionTarget:self]; ! } //[explorer printLog]; --- 169,176 ---- { // create the schema explorer ! [explorer release]; ! explorer =[[ExplorerModel alloc] initWithConnection: conn]; ! [schemaView setDataSource:explorer]; // explorer does the work. ! [schemaView setMenuActionTarget:self]; //[explorer printLog]; Index: ChangeLog =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/ChangeLog,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ChangeLog 11 Aug 2006 18:03:09 -0000 1.10 --- ChangeLog 12 Aug 2006 16:39:04 -0000 1.11 *************** *** 1,2 **** --- 1,6 ---- + 2006-08-11 13:03 ntiffin + + * ChangeLog, SqlDocument.m: Fix some compiler warnings. + 2006-07-16 18:17 ntiffin |
Update of /cvsroot/pgsqlformac/pgCocoaDB In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26506 Modified Files: ChangeLog Connection.m Databases.m ExplorerModel.m ExplorerNode.m Field.m Fields.m RecordSet.m Schema.m Table.m Log Message: More memory cleanup. Index: RecordSet.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/RecordSet.m,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RecordSet.m 11 Aug 2006 18:01:26 -0000 1.4 --- RecordSet.m 12 Aug 2006 16:38:16 -0000 1.5 *************** *** 14,20 **** { [super init]; - items = [[NSMutableArray alloc] init]; - [items retain]; return self; --- 14,18 ---- Index: Table.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Table.m,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Table.m 11 Aug 2006 18:01:26 -0000 1.3 --- Table.m 12 Aug 2006 16:38:16 -0000 1.4 *************** *** 12,15 **** --- 12,22 ---- @implementation Table + -(id)init + { + [super init]; + NSLog(@"Created Table.h"); + return self; + } + -(void)dealloc { Index: ChangeLog =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ChangeLog,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ChangeLog 11 Aug 2006 18:01:25 -0000 1.13 --- ChangeLog 12 Aug 2006 16:38:16 -0000 1.14 *************** *** 1,2 **** --- 1,9 ---- + 2006-08-11 13:01 ntiffin + + * 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: Fix a number of memory + issues. + 2006-07-16 18:13 ntiffin Index: ExplorerModel.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ExplorerModel.m,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ExplorerModel.m 11 Aug 2006 18:01:25 -0000 1.8 --- ExplorerModel.m 12 Aug 2006 16:38:16 -0000 1.9 *************** *** 106,112 **** [newNode setBaseSchema:schemaName]; [titleNode addChild:newNode]; - - [newNode release]; } } } --- 106,111 ---- [newNode setBaseSchema:schemaName]; [titleNode addChild:newNode]; } + [newNode release]; } } Index: Schema.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Schema.m,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Schema.m 16 Jul 2006 23:13:06 -0000 1.16 --- Schema.m 12 Aug 2006 16:38:16 -0000 1.17 *************** *** 23,26 **** --- 23,27 ---- [super init]; + [connection release]; connection = theConnection; [connection retain]; *************** *** 39,43 **** // TODO not found raise error? ! NSLog(@"Did not find PostgreSQL version 8"); NSLog(sql); NSLog(pgVersionFound); --- 40,44 ---- // TODO not found raise error? ! NSLog(@"Did not find PostgreSQL version 8.1"); NSLog(sql); NSLog(pgVersionFound); *************** *** 525,529 **** RecordSet *results; int i; ! NSMutableString * sqlOutput = [[NSMutableString alloc] init]; [sqlOutput appendFormat:@"CREATE TABLE %@.%@ ( ", schemaName, tableName]; if (pretty) --- 526,530 ---- RecordSet *results; int i; ! NSMutableString * sqlOutput = [[[NSMutableString alloc] init] autorelease]; [sqlOutput appendFormat:@"CREATE TABLE %@.%@ ( ", schemaName, tableName]; if (pretty) *************** *** 583,587 **** [sqlOutput appendString:@" );"]; } - [sqlOutput autorelease]; return sqlOutput; } --- 584,587 ---- Index: Fields.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Fields.m,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Fields.m 11 Aug 2006 18:01:25 -0000 1.5 --- Fields.m 12 Aug 2006 16:38:16 -0000 1.6 *************** *** 15,21 **** { [super init]; - items = [[NSMutableArray alloc] init]; - [items retain]; return self; --- 15,19 ---- Index: Connection.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Connection.m,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Connection.m 11 Aug 2006 18:01:25 -0000 1.12 --- Connection.m 12 Aug 2006 16:38:16 -0000 1.13 *************** *** 33,38 **** host = [[NSString alloc] initWithString:@"localhost"]; port = [[NSString alloc] initWithString:@"5432"]; ! options = [[NSString alloc] init]; ! tty = [[NSString alloc] init]; dbName = [[NSString alloc] initWithString:@"template1"]; --- 33,38 ---- host = [[NSString alloc] initWithString:@"localhost"]; port = [[NSString alloc] initWithString:@"5432"]; ! options = nil; ! tty = nil; dbName = [[NSString alloc] initWithString:@"template1"]; *************** *** 85,91 **** NSLog(@"Connection to database '%@' failed.", dbName); NSLog(@"\t%s", PQerrorMessage(pgconn)); ! [errorDescription release]; ! errorDescription = [[NSString alloc] initWithFormat:@"%s", PQerrorMessage(pgconn)]; ! [[errorDescription retain] autorelease]; [self appendSQLLog:[NSMutableString stringWithFormat:@"Connection to database %@ Failed.\n", dbName]]; --- 85,89 ---- NSLog(@"Connection to database '%@' failed.", dbName); NSLog(@"\t%s", PQerrorMessage(pgconn)); ! [self setErrorDescription:[NSString stringWithFormat:@"%s", PQerrorMessage(pgconn)]]; [self appendSQLLog:[NSMutableString stringWithFormat:@"Connection to database %@ Failed.\n", dbName]]; *************** *** 260,266 **** if (PQresultStatus(res) != PGRES_TUPLES_OK) { ! [errorDescription release]; ! errorDescription = [[NSString alloc] initWithString:@"Command did not return any data."]; ! [[errorDescription retain] autorelease]; PQclear(res); return nil; --- 258,262 ---- if (PQresultStatus(res) != PGRES_TUPLES_OK) { ! [self setErrorDescription:[NSString stringWithString:@"Command did not return any data."]]; PQclear(res); return nil; *************** *** 268,272 **** // build the collection ! dbs = [[[[Databases alloc] init] retain] autorelease]; long nFields = PQnfields(res); long nRecords = PQntuples(res); --- 264,269 ---- // build the collection ! [dbs release]; ! dbs = [[Databases alloc] init]; long nFields = PQnfields(res); long nRecords = PQntuples(res); *************** *** 281,285 **** for ( x = 0; x < nFields; x++) { ! NSString *fValue = [[NSString alloc] initWithCString:PQgetvalue(res, i, x)]; switch (x) --- 278,282 ---- for ( x = 0; x < nFields; x++) { ! NSString *fValue = [[[NSString alloc] initWithCString:PQgetvalue(res, i, x)] autorelease]; switch (x) *************** *** 320,326 **** - (void)setErrorDescription:(NSString *)ed; { [errorDescription release]; errorDescription = ed; - [errorDescription retain]; } --- 317,323 ---- - (void)setErrorDescription:(NSString *)ed; { + [ed retain]; [errorDescription release]; errorDescription = ed; } *************** *** 335,340 **** { [sqlLog release]; ! sqlLog = [NSMutableString stringWithString:value]; ! [sqlLog retain]; } --- 332,336 ---- { [sqlLog release]; ! sqlLog = [[NSMutableString alloc] initWithString:value]; } *************** *** 343,348 **** if (sqlLog == nil) { ! sqlLog = [NSMutableString stringWithString:value]; ! [sqlLog retain]; } else --- 339,343 ---- if (sqlLog == nil) { ! sqlLog = [[NSMutableString alloc] initWithString:value]; } else *************** *** 501,507 **** if (strlen(PQcmdStatus(res))) { ! [self appendSQLLog:[[NSString alloc] initWithFormat:@"%s\n", PQcmdStatus(res)]]; } ! results = [[[[NSString alloc] initWithCString:PQcmdTuples(res)] retain] autorelease]; PQclear(res); return results; --- 496,502 ---- if (strlen(PQcmdStatus(res))) { ! [self appendSQLLog:[NSString stringWithFormat:@"%s\n", PQcmdStatus(res)]]; } ! results = [[[NSString alloc] initWithCString:PQcmdTuples(res)] autorelease]; PQclear(res); return results; Index: ExplorerNode.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ExplorerNode.m,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ExplorerNode.m 11 Aug 2006 18:01:25 -0000 1.5 --- ExplorerNode.m 12 Aug 2006 16:38:16 -0000 1.6 *************** *** 91,95 **** [name release]; name = [[NSAttributedString alloc] initWithString:s]; - [name retain]; } --- 91,94 ---- Index: Databases.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Databases.m,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Databases.m 11 Aug 2006 18:01:25 -0000 1.3 --- Databases.m 12 Aug 2006 16:38:16 -0000 1.4 *************** *** 17,21 **** items = [[NSMutableArray alloc] init]; - [items retain]; return self; --- 17,20 ---- Index: Field.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Field.m,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Field.m 11 Aug 2006 18:01:25 -0000 1.3 --- Field.m 12 Aug 2006 16:38:16 -0000 1.4 *************** *** 16,21 **** [super init]; ! name = [[[[NSString alloc] init] retain] autorelease]; ! value = [[[[NSString alloc] init] retain] autorelease]; return self; --- 16,21 ---- [super init]; ! name = nil; ! value = nil; return self; *************** *** 38,42 **** if (name != newName) { [name release]; ! name = [newName copy]; } } --- 38,43 ---- if (name != newName) { [name release]; ! name = newName; ! [name retain]; } } *************** *** 49,53 **** if (value != newValue) { [value release]; ! value = [newValue copy]; } } --- 50,55 ---- if (value != newValue) { [value release]; ! value = newValue; ! [value retain]; } } |
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]; } |