aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-03-23 09:51:46 +0000
committerBibiko <bibiko@eva.mpg.de>2010-03-23 09:51:46 +0000
commit331d5f6d8a9bbb16089da8522d97d584e9921d73 (patch)
tree3f6186034703520de310b8a1255acddb1eea03f4
parente47a76c457528fb2ef9fb20cf0f02d09a488a8a8 (diff)
downloadsequelpro-331d5f6d8a9bbb16089da8522d97d584e9921d73.tar.gz
sequelpro-331d5f6d8a9bbb16089da8522d97d584e9921d73.tar.bz2
sequelpro-331d5f6d8a9bbb16089da8522d97d584e9921d73.zip
• Navigator
- gather more information - show infos for proc/func - improved error handling - reduced jittering while closing a connection window - still hidden - if navigator is not visible no navigator code will be executed
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m23
-rw-r--r--Interfaces/English.lproj/Navigator.xib12
-rw-r--r--Source/SPNavigatorController.h3
-rw-r--r--Source/SPNavigatorController.m185
-rw-r--r--Source/TableDocument.m7
5 files changed, 181 insertions, 49 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
index 7c7de35f..8c3ffbd4 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
@@ -696,6 +696,7 @@ void pingConnectionTask(void *ptr)
}
if (keepAliveThread != NULL) pthread_cancel(keepAliveThread), keepAliveThread = NULL;
+
if (!keepAliveTimer) return;
[keepAliveTimer invalidate];
[keepAliveTimer release];
@@ -1927,14 +1928,14 @@ void performThreadedKeepAlive(void *ptr)
// Query the desired data
NSString *queryDbString = @""
- @"SELECT TABLE_SCHEMA AS `databases`, TABLE_NAME AS `tables`, COLUMN_NAME AS `fields`, COLUMN_TYPE AS `type`, CHARACTER_SET_NAME AS `charset`, '0' AS `structtype`, `COLUMN_KEY` AS `KEY`, `EXTRA` AS EXTRA, `PRIVILEGES` AS `PRIVILEGES` FROM `information_schema`.`COLUMNS` "
- @"UNION "
- @"SELECT c.TABLE_SCHEMA AS `DATABASES`, c.TABLE_NAME AS `TABLES`, c.COLUMN_NAME AS `fields`, c.COLUMN_TYPE AS `TYPE`, c.CHARACTER_SET_NAME AS `CHARSET`, '1' AS `structtype`, `COLUMN_KEY` AS `KEY`, `EXTRA` AS EXTRA, `PRIVILEGES` AS `PRIVILEGES` FROM `information_schema`.`COLUMNS` AS c, `information_schema`.`VIEWS` AS v WHERE c.TABLE_SCHEMA = v.TABLE_SCHEMA AND c.TABLE_NAME = v.TABLE_NAME "
- @"UNION "
- @"SELECT ROUTINE_SCHEMA AS `DATABASES`, ROUTINE_NAME AS `TABLES`, ROUTINE_NAME AS `fields`, '' AS `TYPE`, '' AS `CHARSET`, '2' AS `structtype`, '' AS `KEY`, '' AS EXTRA, `DEFINER` AS `PRIVILEGES` FROM `information_schema`.`ROUTINES` WHERE ROUTINE_TYPE = 'PROCEDURE' "
- @"UNION "
- @"SELECT ROUTINE_SCHEMA AS `DATABASES`, ROUTINE_NAME AS `TABLES`, ROUTINE_NAME AS `fields`, '' AS `TYPE`, '' AS `CHARSET`, '3' AS `structtype`, '' AS `KEY`, '' AS EXTRA, `DEFINER` AS `PRIVILEGES` FROM `information_schema`.`ROUTINES` WHERE ROUTINE_TYPE = 'FUNCTION' "
- @"ORDER BY `DATABASES`,`TABLES`,`fields`";
+ @"SELECT TABLE_SCHEMA AS `databases`, TABLE_NAME AS `tables`, COLUMN_NAME AS `fields`, COLUMN_TYPE AS `type`, CHARACTER_SET_NAME AS `charset`, '0' AS `structtype`, `COLUMN_KEY` AS `KEY`, `EXTRA` AS EXTRA, `PRIVILEGES` AS `PRIVILEGES`, `COLLATION_NAME` AS `collation`, `COLUMN_DEFAULT` AS `default`, `IS_NULLABLE` AS `is_nullable`, `COLUMN_COMMENT` AS `comment` FROM `information_schema`.`COLUMNS` "
+ @"UNION "
+ @"SELECT c.TABLE_SCHEMA AS `DATABASES`, c.TABLE_NAME AS `TABLES`, c.COLUMN_NAME AS `fields`, c.COLUMN_TYPE AS `TYPE`, c.CHARACTER_SET_NAME AS `CHARSET`, '1' AS `structtype`, `COLUMN_KEY` AS `KEY`, `EXTRA` AS EXTRA, `PRIVILEGES` AS `PRIVILEGES`, `COLLATION_NAME` AS `collation`, `COLUMN_DEFAULT` AS `default`, `IS_NULLABLE` AS `is_nullable`, `COLUMN_COMMENT` AS `comment` FROM `information_schema`.`COLUMNS` AS c, `information_schema`.`VIEWS` AS v WHERE c.TABLE_SCHEMA = v.TABLE_SCHEMA AND c.TABLE_NAME = v.TABLE_NAME "
+ @"UNION "
+ @"SELECT ROUTINE_SCHEMA AS `DATABASES`, ROUTINE_NAME AS `TABLES`, ROUTINE_NAME AS `fields`, `DTD_identifier` AS `TYPE`, '' AS `CHARSET`, '2' AS `structtype`, `IS_DETERMINISTIC` AS `KEY`, `SECURITY_TYPE` AS EXTRA, `DEFINER` AS `PRIVILEGES`, '' AS `collation`, '' AS `DEFAULT`, `SQL_DATA_ACCESS` AS `is_nullable`, '' AS `COMMENT` FROM `information_schema`.`ROUTINES` WHERE ROUTINE_TYPE = 'PROCEDURE' "
+ @"UNION "
+ @"SELECT ROUTINE_SCHEMA AS `DATABASES`, ROUTINE_NAME AS `TABLES`, ROUTINE_NAME AS `fields`, `DTD_identifier` AS `TYPE`, '' AS `CHARSET`, '3' AS `structtype`, `IS_DETERMINISTIC` AS `KEY`, `SECURITY_TYPE` AS EXTRA, `DEFINER` AS `PRIVILEGES`, '' AS `collation`, '' AS `DEFAULT`, `SQL_DATA_ACCESS` AS `is_nullable`, '' AS `COMMENT` FROM `information_schema`.`ROUTINES` WHERE ROUTINE_TYPE = 'FUNCTION' "
+ @"ORDER BY `DATABASES`,`TABLES`,`fields`";
NSData *encodedQueryData = NSStringDataUsingLossyEncoding(queryDbString, theConnectionEncoding, 1);
const char *queryCString = [encodedQueryData bytes];
@@ -1973,6 +1974,10 @@ void performThreadedKeepAlive(void *ptr)
NSString *key = [self stringWithUTF8CString:row[6]];
NSString *extra = [self stringWithUTF8CString:row[7]];
NSString *priv = [self stringWithUTF8CString:row[8]];
+ NSString *coll = [self stringWithUTF8CString:row[9]];
+ NSString *def = [self stringWithUTF8CString:row[10]];
+ NSString *isnull = [self stringWithUTF8CString:row[11]];
+ NSString *comment = [self stringWithUTF8CString:row[12]];
[namesSet addObject:[db lowercaseString]];
[namesSet addObject:[table lowercaseString]];
@@ -1987,7 +1992,7 @@ void performThreadedKeepAlive(void *ptr)
[[[structure valueForKey:connectionID] valueForKey:db_id] setObject:[NSMutableDictionary dictionary] forKey:table_id];
}
- [[[[structure valueForKey:connectionID] valueForKey:db_id] valueForKey:table_id] setObject:[NSArray arrayWithObjects:type, charset, key, extra, priv, [NSNumber numberWithUnsignedLongLong:cnt], nil] forKey:field_id];
+ [[[[structure valueForKey:connectionID] valueForKey:db_id] valueForKey:table_id] setObject:[NSArray arrayWithObjects:type, def, isnull, charset, coll, key, extra, priv, comment, [NSNumber numberWithUnsignedLongLong:cnt], nil] forKey:field_id];
[[[[structure valueForKey:connectionID] valueForKey:db_id] valueForKey:table_id] setObject:structtype forKey:@" struct_type "];
}
diff --git a/Interfaces/English.lproj/Navigator.xib b/Interfaces/English.lproj/Navigator.xib
index 974f8160..f22aa2e6 100644
--- a/Interfaces/English.lproj/Navigator.xib
+++ b/Interfaces/English.lproj/Navigator.xib
@@ -21,7 +21,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="43"/>
+ <integer value="89"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -52,7 +52,7 @@
<int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{131, 70}, {395, 359}}</string>
- <int key="NSWTFlags">-1535638528</int>
+ <int key="NSWTFlags">-1535630336</int>
<string key="NSWindowTitle">Navigator</string>
<string key="NSWindowClass">NSPanel</string>
<nil key="NSViewClass"/>
@@ -702,7 +702,7 @@
</object>
</object>
<reference key="NSGridColor" ref="1022465183"/>
- <double key="NSRowHeight">17</double>
+ <double key="NSRowHeight">18</double>
<int key="NSTvFlags">1379926016</int>
<reference key="NSDelegate"/>
<reference key="NSDataSource"/>
@@ -766,7 +766,7 @@
<reference key="NSContentView" ref="412284187"/>
<reference key="NSHeaderClipView" ref="886487259"/>
<reference key="NSCornerView" ref="276696960"/>
- <bytes key="NSScrollAmts">QSAAAEEgAABBmAAAQZgAAA</bytes>
+ <bytes key="NSScrollAmts">QSAAAEEgAABBoAAAQaAAAA</bytes>
</object>
</object>
<string key="NSFrameSize">{395, 50}</string>
@@ -1783,9 +1783,9 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>ImageAndTextCell</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{72, 342}, {395, 359}}</string>
+ <string>{{91, 357}, {395, 359}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{72, 342}, {395, 359}}</string>
+ <string>{{91, 357}, {395, 359}}</string>
<boolean value="NO"/>
<boolean value="YES"/>
<string>{200, 200}</string>
diff --git a/Source/SPNavigatorController.h b/Source/SPNavigatorController.h
index 6895a9f2..def32cba 100644
--- a/Source/SPNavigatorController.h
+++ b/Source/SPNavigatorController.h
@@ -59,11 +59,12 @@
- (IBAction)filterTree:(id)sender;
- (IBAction)syncButtonAction:(id)sender;
-- (NSString*)tableInfoLabelForIndex:(NSInteger)index;
+- (NSString*)tableInfoLabelForIndex:(NSInteger)index ofType:(NSInteger)type;
- (void)restoreSelectedItems;
- (void)setIgnoreUpdate:(BOOL)flag;
- (void)selectPath:(NSString*)schemaPath;
- (BOOL)syncMode;
+- (void)removeConnection:(NSString*)connectionID;
@end
diff --git a/Source/SPNavigatorController.m b/Source/SPNavigatorController.m
index 56c51438..21389757 100644
--- a/Source/SPNavigatorController.m
+++ b/Source/SPNavigatorController.m
@@ -29,6 +29,7 @@
#import "ImageAndTextCell.h"
#import "TableDocument.h"
#import "SPArrayAdditions.h"
+#import "SPLogger.h"
static SPNavigatorController *sharedNavigatorController = nil;
@@ -187,6 +188,7 @@ static SPNavigatorController *sharedNavigatorController = nil;
id item = schemaData;
NSArray *pathArray = [schemaPath componentsSeparatedByString:SPUniqueSchemaDelimiter];
+ if(!pathArray || [pathArray count] == 0) return;
NSMutableString *aKey = [NSMutableString string];
[outlineSchema2 collapseItem:[item objectForKey:[pathArray objectAtIndex:0]] collapseChildren:YES];
for(NSInteger i=0; i < [pathArray count]; i++) {
@@ -200,6 +202,7 @@ static SPNavigatorController *sharedNavigatorController = nil;
NSInteger itemIndex = [outlineSchema2 rowForItem:item];
if (itemIndex >= 0) {
[outlineSchema2 selectRowIndexes:[NSIndexSet indexSetWithIndex:itemIndex] byExtendingSelection:NO];
+ if([outlineSchema2 numberOfSelectedRows] != 1) return;
[outlineSchema2 scrollRowToVisible:[outlineSchema2 selectedRow]];
id item = [outlineSchema2 itemAtRow:[outlineSchema2 selectedRow]];
// Try to scroll the view that all children of schemaPath are visible if possible
@@ -271,6 +274,31 @@ static SPNavigatorController *sharedNavigatorController = nil;
ignoreUpdate = flag;
}
+- (void)removeConnection:(NSString*)connectionID
+{
+ if(schemaData && [schemaData objectForKey:connectionID]) {
+
+ NSInteger docCounter = 0;
+
+ if ([[[NSDocumentController sharedDocumentController] documents] count]) {
+ for(id doc in [[NSDocumentController sharedDocumentController] documents]) {
+ if(![[doc valueForKeyPath:@"mySQLConnection"] isConnected]) continue;
+ if([[doc connectionID] isEqualToString:connectionID])
+ docCounter++;
+ if(docCounter > 1) break;
+ }
+ }
+
+ if(docCounter > 1) return;
+
+ [schemaData removeObjectForKey:connectionID];
+ [self saveSelectedItems];
+ [outlineSchema1 reloadData];
+ [outlineSchema2 reloadData];
+ [self restoreSelectedItems];
+ }
+}
+
#pragma mark -
#pragma mark IBActions
@@ -322,6 +350,10 @@ static SPNavigatorController *sharedNavigatorController = nil;
[self restoreSelectedItems];
}
+
+ [self syncButtonAction:self];
+
+
}
- (IBAction)reloadAllStructures:(id)sender
@@ -361,6 +393,9 @@ static SPNavigatorController *sharedNavigatorController = nil;
- (IBAction)syncButtonAction:(id)sender
{
+
+ if(!schemaData) return;
+
if([syncButton state] == NSOnState) {
if ([[[NSDocumentController sharedDocumentController] documents] count]) {
TableDocument *doc = [[NSDocumentController sharedDocumentController] currentDocument];
@@ -389,6 +424,8 @@ static SPNavigatorController *sharedNavigatorController = nil;
id parentObject = [ov parentForItem:item] ? [ov parentForItem:item] : schemaData;
+ if(!parentObject || ![parentObject allKeysForObject:item] || ![[parentObject allKeysForObject:item] count]) return;
+
if(ov == outlineSchema1)
{
[expandStatus1 setObject:@"" forKey:[[parentObject allKeysForObject:item] objectAtIndex:0]];
@@ -405,7 +442,9 @@ static SPNavigatorController *sharedNavigatorController = nil;
id item = [[notification userInfo] objectForKey:@"NSObject"];
id parentObject = [ov parentForItem:item] ? [ov parentForItem:item] : schemaData;
-
+
+ if(!parentObject || ![parentObject allKeysForObject:item] || ![[parentObject allKeysForObject:item] count]) return;
+
if(ov == outlineSchema1)
[expandStatus1 removeObjectForKey:[[parentObject allKeysForObject:item] objectAtIndex:0]];
else if(ov == outlineSchema2)
@@ -463,6 +502,8 @@ static SPNavigatorController *sharedNavigatorController = nil;
id parentObject = [outlineView parentForItem:item] ? [outlineView parentForItem:item] : schemaData;
+ if(!parentObject) return @"…";
+
if ([[tableColumn identifier] isEqualToString:@"field"]) {
// top level is connection
@@ -503,17 +544,23 @@ static SPNavigatorController *sharedNavigatorController = nil;
} else {
[[tableColumn dataCell] setImage:[NSImage imageNamed:@"database-small"]];
}
- return [[[[parentObject allKeysForObject:item] objectAtIndex:0] componentsSeparatedByString:SPUniqueSchemaDelimiter] lastObject];
+ if([[parentObject allKeysForObject:item] count])
+ return [[[[parentObject allKeysForObject:item] objectAtIndex:0] componentsSeparatedByString:SPUniqueSchemaDelimiter] lastObject];
+ else
+ return @"…";
} else {
- // It's a field and use the key " struct_type " to increase the distance between node and first child
- if(![[[parentObject allKeysForObject:item] objectAtIndex:0] hasPrefix:@" "]) {
- [[tableColumn dataCell] setImage:[NSImage imageNamed:@"field-small-square"]];
- return [[[[parentObject allKeysForObject:item] objectAtIndex:0] componentsSeparatedByString:SPUniqueSchemaDelimiter] lastObject];
- } else {
- [[tableColumn dataCell] setImage:[NSImage imageNamed:@"dummy-small"]];
- return nil;
+ if([[parentObject allKeysForObject:item] count]) {
+ // It's a field and use the key " struct_type " to increase the distance between node and first child
+ if(![[[parentObject allKeysForObject:item] objectAtIndex:0] hasPrefix:@" "]) {
+ [[tableColumn dataCell] setImage:[NSImage imageNamed:@"field-small-square"]];
+ return [[[[parentObject allKeysForObject:item] objectAtIndex:0] componentsSeparatedByString:SPUniqueSchemaDelimiter] lastObject];
+ } else {
+ [[tableColumn dataCell] setImage:[NSImage imageNamed:@"dummy-small"]];
+ return nil;
+ }
}
+ return @"…";
}
}
return [item description];
@@ -535,9 +582,9 @@ static SPNavigatorController *sharedNavigatorController = nil;
}
}
- if ([item isKindOfClass:[NSArray class]] && ![[[parentObject allKeysForObject:item] objectAtIndex:0] hasPrefix:@" "])
+ if ([item isKindOfClass:[NSArray class]] && [item count]>5 && [[parentObject allKeysForObject:item] count] && ![[[parentObject allKeysForObject:item] objectAtIndex:0] hasPrefix:@" "])
{
- NSString *typ = [NSString stringWithFormat:@"%@,%@,%@", [[item objectAtIndex:0] stringByReplacingOccurrencesOfRegex:@"\\(.*?,.*?\\)" withString:@"(…)"], [item objectAtIndex:1], [item objectAtIndex:2]];
+ NSString *typ = [NSString stringWithFormat:@"%@,%@,%@", [[item objectAtIndex:0] stringByReplacingOccurrencesOfRegex:@"\\(.*?,.*?\\)" withString:@"(…)"], [item objectAtIndex:3], [item objectAtIndex:5]];
NSTokenFieldCell *b = [[[NSTokenFieldCell alloc] initTextCell:typ] autorelease];
[b setEditable:NO];
[b setAlignment:NSRightTextAlignment];
@@ -618,17 +665,39 @@ static SPNavigatorController *sharedNavigatorController = nil;
if(selectedItem) {
[infoArray removeAllObjects];
+ // First object is used as dummy to increase the distance between first item and header
[infoArray addObject:@""];
+
+ // selected item is a field
if([selectedItem isKindOfClass:[NSArray class]]) {
- [infoTable setRowHeight:18.0];
NSInteger i = 0;
for(id item in selectedItem) {
if([item isKindOfClass:[NSString class]] && [(NSString*)item length]) {
- [infoArray addObject:[NSString stringWithFormat:@"%@: %@", [self tableInfoLabelForIndex:i], [item stringByReplacingOccurrencesOfString:@"," withString:@", "]]];
+ [infoArray addObject:[NSString stringWithFormat:@"%@: %@", [self tableInfoLabelForIndex:i ofType:0], [item stringByReplacingOccurrencesOfString:@"," withString:@", "]]];
}
i++;
}
}
+
+ // check if selected item is a PROCEDURE or FUNCTION
+ else if([selectedItem isKindOfClass:[NSDictionary class]] && [selectedItem objectForKey:@" struct_type "] && [[selectedItem objectForKey:@" struct_type "] intValue] > 1) {
+ NSInteger i = 0;
+ NSInteger type = [[selectedItem objectForKey:@" struct_type "] intValue];
+ NSArray *keys = [selectedItem allKeys];
+ NSInteger keyIndex = 0;
+ if(keys && [keys count] == 2) {
+ // there only are two keys, get that key which doesn't begin with " " due to it's the struct_type key
+ if([[keys objectAtIndex:keyIndex] hasPrefix:@" "]) keyIndex++;
+ if([keys objectAtIndex:keyIndex] && [[selectedItem objectForKey:[keys objectAtIndex:keyIndex]] isKindOfClass:[NSArray class]]) {
+ for(id item in [selectedItem objectForKey:[keys objectAtIndex:keyIndex]]) {
+ if([item isKindOfClass:[NSString class]] && [(NSString*)item length]) {
+ [infoArray addObject:[NSString stringWithFormat:@"%@: %@", [self tableInfoLabelForIndex:i ofType:type], item]];
+ }
+ i++;
+ }
+ }
+ }
+ }
}
[infoTable reloadData];
}
@@ -672,7 +741,7 @@ static SPNavigatorController *sharedNavigatorController = nil;
- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView
{
- if(aTableView == infoTable)
+ if(aTableView == infoTable && infoArray)
return [infoArray count];
return 0;
@@ -687,7 +756,7 @@ static SPNavigatorController *sharedNavigatorController = nil;
- (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(NSInteger)rowIndex
{
- if(aTableView == infoTable)
+ if(aTableView == infoTable && infoArray)
return NO;
return YES;
@@ -711,27 +780,83 @@ static SPNavigatorController *sharedNavigatorController = nil;
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
- if(aTableView == infoTable) {
+ if(aTableView == infoTable && infoArray && rowIndex < [infoArray count]) {
return [infoArray objectAtIndex:rowIndex];
}
return nil;
}
-- (NSString*)tableInfoLabelForIndex:(NSInteger)index
-{
- switch(index) {
- case 0:
- return NSLocalizedString(@"Type", @"type label");
- case 1:
- return NSLocalizedString(@"Encoding", @"encoding label");
- case 2:
- return NSLocalizedString(@"Key", @"key label");
- case 3:
- return NSLocalizedString(@"Extra", @"extra label");
- case 4:
- return NSLocalizedString(@"Privileges", @"Privileges label");
- }
+#pragma mark -
+#pragma mark others
+
+- (NSString*)tableInfoLabelForIndex:(NSInteger)index ofType:(NSInteger)type
+{
+
+ if(type == 0 || type == 1) // TABLE / VIEW
+ switch(index) {
+ case 0:
+ return NSLocalizedString(@"Type", @"type label");
+ case 1:
+ return NSLocalizedString(@"Default", @"default label");
+ case 2:
+ return NSLocalizedString(@"Is Nullable", @"is nullable label");
+ case 3:
+ return NSLocalizedString(@"Encoding", @"encoding label");
+ case 4:
+ return NSLocalizedString(@"Collation", @"collation label");
+ case 5:
+ return NSLocalizedString(@"Key", @"key label");
+ case 6:
+ return NSLocalizedString(@"Extra", @"extra label");
+ case 7:
+ return NSLocalizedString(@"Privileges", @"privileges label");
+ case 8:
+ return NSLocalizedString(@"Comment", @"comment label");
+ }
+
+ if(type == 2) // PROCEDURE
+ switch(index) {
+ case 0:
+ return @"DTD Identifier";
+ case 1:
+ return NSLocalizedString(@"Default", @"default label");
+ case 2:
+ return @"SQL Data Access";
+ case 3:
+ return NSLocalizedString(@"Encoding", @"encoding label");
+ case 4:
+ return NSLocalizedString(@"Collation", @"collation label");
+ case 5:
+ return @"Is Deterministic";
+ case 6:
+ return @"Security Type";
+ case 7:
+ return @"Definer";
+ case 8:
+ return NSLocalizedString(@"Comment", @"comment label");
+ }
+ if(type == 3) // FUNCTION
+ switch(index) {
+ case 0:
+ return NSLocalizedString(@"Return Type", @"return type label");
+ case 1:
+ return NSLocalizedString(@"Default", @"default label");
+ case 2:
+ return @"SQL Data Access";
+ case 3:
+ return NSLocalizedString(@"Encoding", @"encoding label");
+ case 4:
+ return NSLocalizedString(@"Collation", @"collation label");
+ case 5:
+ return @"Is Deterministic";
+ case 6:
+ return NSLocalizedString(@"Execution Privilege", @"execution privilege label");
+ case 7:
+ return @"Definer";
+ case 8:
+ return NSLocalizedString(@"Comment", @"comment label");
+ }
return @"";
}
@end
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 4580e392..797631e3 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -1176,8 +1176,6 @@
{
BOOL isNavigatorVisible = [[[SPNavigatorController sharedNavigatorController] window] isVisible];
- // If the Console window is not visible data are not reloaded (for speed).
- // Due to that update list if user opens the Console window.
if(!isNavigatorVisible) {
[[SPNavigatorController sharedNavigatorController] updateEntries:self];
}
@@ -3668,11 +3666,14 @@
*/
- (void)windowWillClose:(NSNotification *)aNotification
{
+ if ([[[SPNavigatorController sharedNavigatorController] window] isVisible]) {
+ [[SPNavigatorController sharedNavigatorController] removeConnection:[self connectionID]];
+ }
+
[mySQLConnection setDelegate:nil];
if (_isConnected) [self closeConnection];
else [connectionController cancelConnection];
if ([[[SPQueryController sharedQueryController] window] isVisible]) [self toggleConsole:self];
- if ([[[SPNavigatorController sharedNavigatorController] window] isVisible]) [self updateNavigator:self];
[createTableSyntaxWindow orderOut:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self];
}