From: Neil T. <nt...@us...> - 2006-06-24 16:20:42
|
Update of /cvsroot/pgsqlformac/QueryTool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3759 Modified Files: SqlDocument.h SqlDocument.m TODO.txt Log Message: Add SQL Log window. Index: SqlDocument.m =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/SqlDocument.m,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** SqlDocument.m 21 Jun 2006 13:42:01 -0000 1.13 --- SqlDocument.m 24 Jun 2006 16:20:39 -0000 1.14 *************** *** 15,18 **** --- 15,36 ---- self = [super init]; + NSUserDefaults * userDefaults = [NSUserDefaults standardUserDefaults]; + if ([userDefaults stringForKey:@"PGSqlForMac_QueryTool_ShowInformationSchema"] == nil) + { + [userDefaults setObject:@"yes" forKey:@"PGSqlForMac_QueryTool_ShowInformationSchema"]; + } + if ([userDefaults stringForKey:@"PGSqlForMac_QueryTool_ShowPGCatalogSchema"] == nil) + { + [userDefaults setObject:@"yes" forKey:@"PGSqlForMac_QueryTool_ShowPGCatalogSchema"]; + } + if ([userDefaults stringForKey:@"PGSqlForMac_QueryTool_ShowPGToastSchema"] == nil) + { + [userDefaults setObject:@"no" forKey:@"PGSqlForMac_QueryTool_ShowPGToastSchema"]; + } + if ([userDefaults stringForKey:@"PGSqlForMac_QueryTool_ShowPGTempsSchema"] == nil) + { + [userDefaults setObject:@"no" forKey:@"PGSqlForMac_QueryTool_ShowPGTempsSchema"]; + } + return self; } *************** *** 79,82 **** --- 97,101 ---- [query setSelectedRange:NSMakeRange(0,0)]; [self performSelector:@selector(onConnect:) withObject:self afterDelay:0.0]; + } *************** *** 112,115 **** --- 131,141 ---- } //[explorer printLog]; + + // set explorer display defaults from NSUserDefaults + NSUserDefaults * userDefaults = [NSUserDefaults standardUserDefaults]; + [explorer setShowInformationSchema:[userDefaults boolForKey:@"PGSqlForMac_QueryTool_ShowInformationSchema"]]; + [explorer setShowPGCatalog:[userDefaults boolForKey:@"PGSqlForMac_QueryTool_ShowPGCatalogSchema"]]; + [explorer setShowPGToast:[userDefaults boolForKey:@"PGSqlForMac_QueryTool_ShowPGToastSchema"]]; + [explorer setShowPGTemps:[userDefaults boolForKey:@"PGSqlForMac_QueryTool_ShowPGTempsSchema"]]; } *************** *** 121,125 **** [status setStringValue:[NSString stringWithString:@"Waiting for connection information"]]; ! aDefault = [[NSUserDefaults standardUserDefaults] stringForKey:@"PGSqlForMac_DefaultHost"]; if (aDefault) { --- 147,151 ---- [status setStringValue:[NSString stringWithString:@"Waiting for connection information"]]; ! aDefault = [[NSUserDefaults standardUserDefaults] stringForKey:@"PGSqlForMac_QueryTool_DefaultHost"]; if (aDefault) { *************** *** 130,144 **** [host setStringValue:@"localhost"]; } ! aDefault = [[NSUserDefaults standardUserDefaults] stringForKey:@"PGSqlForMac_DefaultUserName"]; if (aDefault) { [userName setStringValue:aDefault]; } ! aDefault = [[NSUserDefaults standardUserDefaults] stringForKey:@"PGSqlForMac_DefaultDatabaseName"]; if (aDefault) { [databaseName setStringValue:aDefault]; } ! aDefault = [[NSUserDefaults standardUserDefaults] stringForKey:@"PGSqlForMac_DefaultPort"]; if (aDefault) { --- 156,170 ---- [host setStringValue:@"localhost"]; } ! aDefault = [[NSUserDefaults standardUserDefaults] stringForKey:@"PGSqlForMac_QueryTool_DefaultUserName"]; if (aDefault) { [userName setStringValue:aDefault]; } ! aDefault = [[NSUserDefaults standardUserDefaults] stringForKey:@"PGSqlForMac_QueryTool_DefaultDatabaseName"]; if (aDefault) { [databaseName setStringValue:aDefault]; } ! aDefault = [[NSUserDefaults standardUserDefaults] stringForKey:@"PGSqlForMac_QueryTool_DefaultPort"]; if (aDefault) { *************** *** 171,185 **** [conn setPassword:[password stringValue]]; [conn setDbName:[databaseName stringValue]]; ! [conn setHost:[host stringValue]]; [conn setPort:[port stringValue]]; ! // update user defaults ! [[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithString:[userName stringValue]] forKey:@"PGSqlForMac_DefaultUserName"]; ! [[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithString:[conn host]] forKey:@"PGSqlForMac_DefaultHost"]; ! [[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithString:[port stringValue]] forKey:@"PGSqlForMac_DefaultPort"]; ! [[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithString:[databaseName stringValue]] forKey:@"PGSqlForMac_DefaultDatabaseName"]; [[NSUserDefaults standardUserDefaults] synchronize]; ! // close the sheet [NSApp stopModal]; --- 197,211 ---- [conn setPassword:[password stringValue]]; [conn setDbName:[databaseName stringValue]]; ! [conn setHost:[host stringValue]]; [conn setPort:[port stringValue]]; ! // update user defaults ! [[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithString:[userName stringValue]] forKey:@"PGSqlForMac_QueryTool_DefaultUserName"]; ! [[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithString:[host stringValue]] forKey:@"PGSqlForMac_QueryTool_DefaultHost"]; ! [[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithString:[port stringValue]] forKey:@"PGSqlForMac_QueryTool_DefaultPort"]; ! [[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithString:[databaseName stringValue]] forKey:@"PGSqlForMac_QueryTool_DefaultDatabaseName"]; [[NSUserDefaults standardUserDefaults] synchronize]; ! // close the sheet [NSApp stopModal]; *************** *** 189,194 **** // perform the connection - [conn connect]; if (![conn isConnected]) { --- 215,221 ---- // perform the connection [conn connect]; + + // if the requested database is not found then try "template1" if (![conn isConnected]) { *************** *** 215,221 **** } else { ! [status setStringValue:@"Connection failed: %@"]; ! // [status setStringValue:[NSString stringWithFormat:@"Connected to %@ as %@", ! // [conn host], [conn userName]]]; } } --- 242,252 ---- } else { ! [status setStringValue:@"Connection failed:"]; ! } ! if ([conn sqlLog] != nil) ! { ! //[[[textView textStorage] mutableString] appendString: string]; ! NSRange myRange = NSMakeRange([[sqlLogPanelTextView textStorage] length], 0); ! [[sqlLogPanelTextView textStorage] replaceCharactersInRange:myRange withString:[conn sqlLog]]; } } *************** *** 280,284 **** */ ! NSArray *arrQuery = [toBeRun componentsSeparatedByString:@";"]; int x; --- 311,315 ---- */ ! //NSArray *arrQuery = [toBeRun componentsSeparatedByString:@";"]; int x; *************** *** 289,292 **** --- 320,329 ---- //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]]; + } if (rs == nil) *************** *** 361,376 **** - (IBAction)onSetDatabase:(id)sender { if ([conn isConnected]) { [conn disconnect]; - [schemaView setDataSource:nil]; - [explorer release]; - explorer = nil; } if ([[[dbList selectedItem] title] length] == 0) { [conn setDbName:@""]; ! } else { [conn setDbName:[[dbList selectedItem] title]]; } --- 398,414 ---- - (IBAction)onSetDatabase:(id)sender { + //NSLog(@"Enter onSetDatabase"); if ([conn isConnected]) { [conn disconnect]; } + //NSLog(@"Disconnect Complete"); if ([[[dbList selectedItem] title] length] == 0) { [conn setDbName:@""]; ! } ! else ! { [conn setDbName:[[dbList selectedItem] title]]; } *************** *** 382,390 **** // create the schema explorer [self setNewExplorerConn]; ! } else { [status setStringValue:@"Connection failed."]; } } - (void)onSelectSelectTableMenuItem:(id)sender { --- 420,448 ---- // create the schema explorer [self setNewExplorerConn]; ! } ! else ! { [status setStringValue:@"Connection failed."]; } + if ([conn sqlLog] != nil) + { + //[[[textView textStorage] mutableString] appendString: string]; + NSRange myRange = NSMakeRange([[sqlLogPanelTextView textStorage] length], 0); + [[sqlLogPanelTextView textStorage] replaceCharactersInRange:myRange withString:[conn sqlLog]]; + } } + + - (IBAction)onShowSQLLog:(id)sender + { + if ([sqlLogPanel isVisible] != 0) + { + [sqlLogPanel center]; + } + [sqlLogPanel makeKeyAndOrderFront: nil]; + [sqlLogPanel setFloatingPanel:0]; + } + + - (void)onSelectSelectTableMenuItem:(id)sender { Index: TODO.txt =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/TODO.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TODO.txt 21 Jun 2006 13:42:01 -0000 1.3 --- TODO.txt 24 Jun 2006 16:20:39 -0000 1.4 *************** *** 2,6 **** - TODO - Features, Functions and Warnings (in priority order) ======================================= --- 2,5 ---- *************** *** 9,27 **** - 2006-06-02 Trigger SQL not complete. ! - 2006-05-27 Query tool connect box does not receive focus when first opened. ! ! - 2006-06-16 When running VACUUM FULL VERBOSE ANALYZE the resulting text is not displayed in the GUI. ! ! - 2006-06-16 Created function to attempt to cancel a query in pgCocoaDB. Need to add button to GUI, create icon, and change to async queries. FIXME (Known Errors) ==================== ! Completed ========= - 2006-06-02 Function create or replace does not fully re-create the function. (2006-06-21) --- 8,39 ---- - 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. FIXME (Known Errors) ==================== ! 2006-06-22 13:20:17.480 Query Tool for Postgres[5590] -[NSBigMutableString characterAtIndex:] called with out-of-bounds index. For apps linked on Tiger this will raise an exception. For earlier apps it will produce this one-time warning and continue with existing behavior (which is undefined). ! 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-06-16 When running VACUUM FULL VERBOSE ANALYZE the resulting text is not displayed in the GUI. (2006-06-24 added SQL Log). + + - 2006-06-22 17:27:23.418 Query Tool for Postgres[5640] CFLog (0): CFMessagePort: bootstrap_register(): failed 1103 (0x44f), port = 0x3103, name = 'com.druware.postgres.QueryTool.ServiceProvider' + 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. + + - 2006-06-22 Added call back notification for server warnings and messages. Not working yet. + + - 2006-06-21 Created temporary icon for cancel script. Needs to be replaced with better one. + + - 2006-06-21 Created function to cancel query. + - 2006-06-02 Function create or replace does not fully re-create the function. (2006-06-21) Index: SqlDocument.h =================================================================== RCS file: /cvsroot/pgsqlformac/QueryTool/SqlDocument.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** SqlDocument.h 2 Jun 2006 17:29:51 -0000 1.9 --- SqlDocument.h 24 Jun 2006 16:20:39 -0000 1.10 *************** *** 38,41 **** --- 38,45 ---- IBOutlet NSPopUpButton *dbList; + // SQL Log Panel + IBOutlet NSPanel *sqlLogPanel; + IBOutlet NSTextView *sqlLogPanelTextView; + // outline schema view IBOutlet MyOutlineView *schemaView; // ref to the schema outline view object *************** *** 68,71 **** --- 72,76 ---- - (IBAction)onDisconnect:(id)sender; - (IBAction)onSetDatabase:(id)sender; + - (IBAction)onShowSQLLog:(id)sender; // Respond to dynamic menus in the object browser. |