diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-03-19 16:21:10 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-03-19 16:21:10 +0000 |
commit | 8a7621ee68c7de9a08bbd1552c6006e4fa3aaaa9 (patch) | |
tree | 469e94974d25ebbccb1d174d2fb921e063809be9 /Frameworks/MCPKit | |
parent | e1e725ef1c285f28cbbb6f4b4e8ef86b011aa34e (diff) | |
download | sequelpro-8a7621ee68c7de9a08bbd1552c6006e4fa3aaaa9.tar.gz sequelpro-8a7621ee68c7de9a08bbd1552c6006e4fa3aaaa9.tar.bz2 sequelpro-8a7621ee68c7de9a08bbd1552c6006e4fa3aaaa9.zip |
• further work on Navigator (not yet active but workable -> unHide menu item)
Diffstat (limited to 'Frameworks/MCPKit')
-rw-r--r-- | Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h | 2 | ||||
-rw-r--r-- | Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m | 34 |
2 files changed, 28 insertions, 8 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h index 8e5a60f9..45491884 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h @@ -67,6 +67,8 @@ static inline NSData* NSStringDataUsingLossyEncoding(NSString* self, NSInteger e - (NSString *)onReconnectShouldUseEncoding:(id)connection; - (void)noConnectionAvailable:(id)connection; - (MCPConnectionCheck)connectionLost:(id)connection; +- (void)updateNavigator:(id)sender; +- (NSString *)connectionID; @end diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m index 3223964c..6dac15b3 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m @@ -1849,7 +1849,7 @@ void performThreadedKeepAlive(void *ptr) } /** - * Updates the dict containing the structure of all available databases (mainly for completion) + * Updates the dict containing the structure of all available databases (mainly for completion/navigator) * executed on a new connection. */ - (void)queryDbStructure @@ -1888,7 +1888,7 @@ void performThreadedKeepAlive(void *ptr) } else { thePass = [self cStringFromString:connectionPassword]; } - + // Connect connectionSetupStatus = mysql_real_connect(structConnection, theHost, theLogin, thePass, NULL, connectionPort, theSocket, mConnectionFlags); thePass = NULL; @@ -1931,10 +1931,23 @@ void performThreadedKeepAlive(void *ptr) NSMutableArray *allDbNames = [NSMutableArray array]; NSMutableArray *allTableNames = [NSMutableArray array]; + NSString *connectionID; + if([delegate respondsToSelector:@selector(connectionID)]) + connectionID = [NSString stringWithString:[[self delegate] connectionID]]; + else + connectionID = @"_"; + + NSString *SPUniqueSchemaDelimiter = @""; + + [structure setObject:[NSMutableDictionary dictionary] forKey:connectionID]; + while(row = mysql_fetch_row(theResult)) { NSString *db = [self stringWithUTF8CString:row[0]]; + NSString *db_id = [NSString stringWithFormat:@"%@%@%@", connectionID, SPUniqueSchemaDelimiter, db]; NSString *table = [self stringWithUTF8CString:row[1]]; + NSString *table_id = [NSString stringWithFormat:@"%@%@%@", db_id, SPUniqueSchemaDelimiter, table]; NSString *field = [self stringWithUTF8CString:row[2]]; + NSString *field_id = [NSString stringWithFormat:@"%@%@%@", table_id, SPUniqueSchemaDelimiter, field]; NSString *type = [self stringWithUTF8CString:row[3]]; NSString *charset = (row[4]) ? [self stringWithUTF8CString:row[4]] : @""; NSString *structtype = [self stringWithUTF8CString:row[5]]; @@ -1947,19 +1960,20 @@ void performThreadedKeepAlive(void *ptr) [allDbNames addObject:[db lowercaseString]]; [allTableNames addObject:[table lowercaseString]]; - if(![structure valueForKey:db]) { - [structure setObject:[NSMutableDictionary dictionary] forKey:db]; + if(![[structure valueForKey:connectionID] valueForKey:db_id]) { + [[structure valueForKey:connectionID] setObject:[NSMutableDictionary dictionary] forKey:db_id]; } - if(![[structure valueForKey:db] valueForKey:table]) { - [[structure valueForKey:db] setObject:[NSMutableDictionary dictionary] forKey:table]; + if(![[[structure valueForKey:connectionID] valueForKey:db_id] valueForKey:table_id]) { + [[[structure valueForKey:connectionID] valueForKey:db_id] setObject:[NSMutableDictionary dictionary] forKey:table_id]; } - [[[structure valueForKey:db] valueForKey:table] setObject:[NSArray arrayWithObjects:type, charset, key, extra, priv, nil] forKey:field]; - [[[structure valueForKey:db] valueForKey:table] setObject:structtype forKey:@" struct_type "]; + [[[[structure valueForKey:connectionID] valueForKey:db_id] valueForKey:table_id] setObject:[NSArray arrayWithObjects:type, charset, key, extra, priv, nil] forKey:field_id]; + [[[[structure valueForKey:connectionID] valueForKey:db_id] valueForKey:table_id] setObject:structtype forKey:@" struct_type "]; } + mysql_free_result(theResult); mysql_close(structConnection); @@ -1987,6 +2001,10 @@ void performThreadedKeepAlive(void *ptr) } uniqueDbIdentifier = [[NSDictionary dictionaryWithDictionary:uniqueIdentifier] retain]; + + if(delegate && [delegate respondsToSelector:@selector(updateNavigator:)]) + [[self delegate] updateNavigator:self]; + isQueryingDbStructure = NO; [queryPool release]; return; |