From f5edb22564ec1c3e834f20fd080a84ce581acfe4 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Fri, 26 Mar 2010 19:23:18 +0000 Subject: =?UTF-8?q?=E2=80=A2=20navigator=20-=20fixed=20issue=20if=20differ?= =?UTF-8?q?ent=20connection=20windows=20are=20connected=20to=20the=20same?= =?UTF-8?q?=20connection=20-=20prepared=20structure=20querying=20method=20?= =?UTF-8?q?to=20be=20able=20to=20add=20user=20info=20containing=20which=20?= =?UTF-8?q?table/db=20was=20changed=20if=20we=20know=20it=20to=20reduce=20?= =?UTF-8?q?the=20future=20parsing=20cost?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h | 2 +- Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'Frameworks') diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h index 352f152b..c105691f 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h @@ -266,7 +266,7 @@ void performThreadedKeepAlive(void *ptr); - (MCPResult *)listTablesFromDB:(NSString *)dbName like:(NSString *)tablesName; - (MCPResult *)listFieldsFromTable:(NSString *)tableName; - (MCPResult *)listFieldsFromTable:(NSString *)tableName like:(NSString *)fieldsName; -- (void)queryDbStructureAndForceUpdate:(NSNumber*)forceUpdate; +- (void)queryDbStructureWithUserInfo:(NSDictionary*)userInfo; - (NSDictionary *)getDbStructure; - (NSInteger)getUniqueDbIdentifierFor:(NSString*)term; - (NSArray *)getAllKeysOfDbStructure; diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m index e2a2930f..7b6fa0b8 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m @@ -1834,7 +1834,7 @@ void performThreadedKeepAlive(void *ptr) * Updates the dict containing the structure of all available databases (mainly for completion/navigator) * executed on a new connection. */ -- (void)queryDbStructureAndForceUpdate:(NSNumber*)forceUpdate +- (void)queryDbStructureWithUserInfo:(NSDictionary*)userInfo { NSAutoreleasePool *queryPool = [[NSAutoreleasePool alloc] init]; @@ -1842,6 +1842,8 @@ void performThreadedKeepAlive(void *ptr) NSString *SPUniqueSchemaDelimiter = @"￸"; + + NSString *connectionID; if([delegate respondsToSelector:@selector(connectionID)]) connectionID = [NSString stringWithString:[[self delegate] connectionID]]; @@ -1858,9 +1860,8 @@ void performThreadedKeepAlive(void *ptr) [[[self delegate] allDatabaseNames] componentsJoinedByString:SPUniqueSchemaDelimiter]] componentsSeparatedByString:SPUniqueSchemaDelimiter]; for(id db in dbs) { - NSString *db_id = [NSString stringWithFormat:@"%@%@%@", connectionID, SPUniqueSchemaDelimiter, db]; - if(![[structure valueForKey:connectionID] valueForKey:db_id]) { - [[structure valueForKey:connectionID] setObject:db forKey:db_id]; + if(![[self delegate] navigatorSchemaPathExistsForDatabase:db]) { + [[structure valueForKey:connectionID] setObject:db forKey:[NSString stringWithFormat:@"%@%@%@", connectionID, SPUniqueSchemaDelimiter, db]]; } } @@ -1907,7 +1908,7 @@ void performThreadedKeepAlive(void *ptr) } } - if(forceUpdate == nil) { + if(userInfo == nil || ![userInfo objectForKey:@"forceUpdate"]) { if([[self delegate] navigatorSchemaPathExistsForDatabase:currentDatabase]) { if(removeFlag) [[NSNotificationCenter defaultCenter] postNotificationName:@"SPDBStructureWasUpdated" object:delegate]; -- cgit v1.2.3