From 5fd7c0a6c1f284a261d8e3cabe97db8601e2bd93 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Tue, 30 Mar 2010 09:10:02 +0000 Subject: =?UTF-8?q?=E2=80=A2=20some=20speed=20improvements=20and=20code=20?= =?UTF-8?q?simplifications=20for=20navigator=20=E2=80=A2=20avoid=20making?= =?UTF-8?q?=20the=20completion=20key=20list=20unique=20since=20it's=20poss?= =?UTF-8?q?ible=20to=20insert=20unique=20items=20only=20=E2=80=A2=20added?= =?UTF-8?q?=20trigger=20to=20query=20db=20structure=20after=20SQL=20import?= =?UTF-8?q?=20=E2=80=A2=20some=20work=20to=20avoid=20http://log.sequelpro.?= =?UTF-8?q?com/view/90=20(not=20yet=20ideally=20-=20WIP)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m') diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m index 26f1a9b4..35d07a39 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m @@ -2055,6 +2055,8 @@ void performThreadedKeepAlive(void *ptr) ; } + [allKeysofDbStructure addObject:db_id]; + // Query all tables for(NSString* table in tables) { NSString *query = [NSString stringWithFormat:@"SHOW FULL COLUMNS FROM `%@` FROM `%@`", @@ -2068,7 +2070,11 @@ void performThreadedKeepAlive(void *ptr) continue; } theResult = mysql_use_result(structConnection); + NSString *table_id = [NSString stringWithFormat:@"%@%@%@", db_id, SPUniqueSchemaDelimiter, table]; + + [allKeysofDbStructure addObject:table_id]; + while(row = mysql_fetch_row(theResult)) { NSString *field = [self stringWithUTF8CString:row[0]]; NSString *type = [self stringWithUTF8CString:row[1]]; @@ -2083,8 +2089,6 @@ void performThreadedKeepAlive(void *ptr) NSArray *a = [coll componentsSeparatedByString:@"_"]; charset = ([a count]) ? [a objectAtIndex:0] : @""; - [allKeysofDbStructure addObject:db_id]; - [allKeysofDbStructure addObject:table_id]; [allKeysofDbStructure addObject:field_id]; if(![[structure valueForKey:connectionID] valueForKey:db_id] || [[[structure valueForKey:connectionID] valueForKey:db_id] isKindOfClass:[NSString class]] ) @@ -2112,8 +2116,12 @@ void performThreadedKeepAlive(void *ptr) // NSLog(@"error %@", table); continue; } + theResult = mysql_use_result(structConnection); NSString *table_id = [NSString stringWithFormat:@"%@%@%@", db_id, SPUniqueSchemaDelimiter, table]; + + [allKeysofDbStructure addObject:table_id]; + NSString *charset; while(row = mysql_fetch_row(theResult)) { NSString *field = [self stringWithUTF8CString:row[0]]; @@ -2129,8 +2137,6 @@ void performThreadedKeepAlive(void *ptr) NSArray *a = [coll componentsSeparatedByString:@"_"]; charset = ([a count]) ? [a objectAtIndex:0] : @""; - [allKeysofDbStructure addObject:db_id]; - [allKeysofDbStructure addObject:table_id]; [allKeysofDbStructure addObject:field_id]; if(![[structure valueForKey:connectionID] valueForKey:db_id] || [[[structure valueForKey:connectionID] valueForKey:db_id] isKindOfClass:[NSString class]] ) @@ -2167,7 +2173,6 @@ void performThreadedKeepAlive(void *ptr) NSString *security_type = [self stringWithUTF8CString:row[14]]; NSString *definer = [self stringWithUTF8CString:row[19]]; - [allKeysofDbStructure addObject:db_id]; [allKeysofDbStructure addObject:table_id]; [allKeysofDbStructure addObject:field_id]; @@ -2208,7 +2213,7 @@ void performThreadedKeepAlive(void *ptr) */ - (NSDictionary *)getDbStructure { - return [NSDictionary dictionaryWithDictionary:structure]; + return [structure copy]; } /** @@ -2216,10 +2221,7 @@ void performThreadedKeepAlive(void *ptr) */ - (NSArray *)getAllKeysOfDbStructure { - if(allKeysofDbStructure && [allKeysofDbStructure count]) { - return [NSArray arrayWithArray:allKeysofDbStructure]; - } - return [NSArray array]; + return [allKeysofDbStructure copy]; } #pragma mark - -- cgit v1.2.3