diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-03-30 09:10:02 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-03-30 09:10:02 +0000 |
commit | 5fd7c0a6c1f284a261d8e3cabe97db8601e2bd93 (patch) | |
tree | 5751ab514cf46a60676246b8ec5f748a88c61cf4 /Frameworks/MCPKit/MCPFoundationKit | |
parent | 2424d968ad5e6d9516b15fead3edf26d0183c450 (diff) | |
download | sequelpro-5fd7c0a6c1f284a261d8e3cabe97db8601e2bd93.tar.gz sequelpro-5fd7c0a6c1f284a261d8e3cabe97db8601e2bd93.tar.bz2 sequelpro-5fd7c0a6c1f284a261d8e3cabe97db8601e2bd93.zip |
• some speed improvements and code simplifications for navigator
• avoid making the completion key list unique since it's possible to insert unique items only
• added trigger to query db structure after SQL import
• some work to avoid http://log.sequelpro.com/view/90 (not yet ideally - WIP)
Diffstat (limited to 'Frameworks/MCPKit/MCPFoundationKit')
-rw-r--r-- | Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m | 22 |
1 files changed, 12 insertions, 10 deletions
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 - |