diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-03-29 13:17:12 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-03-29 13:17:12 +0000 |
commit | e9220681f3ad83c507ffd075844eab702f08405b (patch) | |
tree | dc929a3eec53a5d1acac91a2dc423d57b111ce8c /Source/CMTextView.m | |
parent | ae0de60e69ffd51cda85ff70417cd354ee781c1c (diff) | |
download | sequelpro-e9220681f3ad83c507ffd075844eab702f08405b.tar.gz sequelpro-e9220681f3ad83c507ffd075844eab702f08405b.tar.bz2 sequelpro-e9220681f3ad83c507ffd075844eab702f08405b.zip |
• improved completion suggestion for db schemata
- if user typed "foo." and there's an unique schema path regardless cases (like there's an item Foo) show the content of the path Foo
- now getUniqueDbIdentifierFor:term returns an array of found type (db or table) and the found string to handle case better for completion
• tried to speed up the search in the navigator by using a NSPredicate
• [MCPConennection allKeysofDbStructure]
- fixed issue while returning if allKeysofDbStructure == nil
Diffstat (limited to 'Source/CMTextView.m')
-rw-r--r-- | Source/CMTextView.m | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Source/CMTextView.m b/Source/CMTextView.m index 3884f993..a4bcda58 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -365,20 +365,23 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) if(!aDbName) { // Try to suggest only items which are uniquely valid for the parsed string - NSInteger uniqueSchemaKind = [[SPNavigatorController sharedNavigatorController] getUniqueDbIdentifierFor:[aTableName lowercaseString] andConnection:[[[self delegate] valueForKeyPath:@"tableDocumentInstance"] connectionID]]; + NSArray *uniqueSchema = [[SPNavigatorController sharedNavigatorController] getUniqueDbIdentifierFor:[aTableName lowercaseString] andConnection:[[[self delegate] valueForKeyPath:@"tableDocumentInstance"] connectionID]]; + NSInteger uniqueSchemaKind = [[uniqueSchema objectAtIndex:0] intValue]; // If no db name but table name check if table name is a valid name in the current selected db if(aTableName && [aTableName length] && [dbs objectForKey:currentDb] && [[dbs objectForKey:currentDb] isKindOfClass:[NSDictionary class]] - && [[dbs objectForKey:currentDb] objectForKey:[NSString stringWithFormat:@"%@%@%@", currentDb, SPUniqueSchemaDelimiter, aTableName]] + && [[dbs objectForKey:currentDb] objectForKey:[NSString stringWithFormat:@"%@%@%@", currentDb, SPUniqueSchemaDelimiter, [uniqueSchema objectAtIndex:1]]] && uniqueSchemaKind == 2) { aTableNameExists = YES; + aTableName = [uniqueSchema objectAtIndex:1]; + aTableName_id = [NSString stringWithFormat:@"%@%@%@", currentDb, SPUniqueSchemaDelimiter, aTableName]; aDbName_id = [NSString stringWithString:currentDb]; } // If no db name but table name check if table name is a valid db name if(!aTableNameExists && aTableName && [aTableName length] && uniqueSchemaKind == 1) { - aDbName_id = [NSString stringWithFormat:@"%@%@%@", connectionID, SPUniqueSchemaDelimiter, aTableName]; + aDbName_id = [NSString stringWithFormat:@"%@%@%@", connectionID, SPUniqueSchemaDelimiter, [uniqueSchema objectAtIndex:1]]; aTableNameExists = NO; } |