aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTextView.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-11-04 17:03:12 +0000
committerBibiko <bibiko@eva.mpg.de>2010-11-04 17:03:12 +0000
commit65670f060759c2d5f096db401390da47b9365706 (patch)
tree4c34858715090715eb49e3ba50a9b93034430a75 /Source/SPTextView.m
parent286d4ef211a7ab3e9564bbe6a099021e0064c941 (diff)
downloadsequelpro-65670f060759c2d5f096db401390da47b9365706.tar.gz
sequelpro-65670f060759c2d5f096db401390da47b9365706.tar.bz2
sequelpro-65670f060759c2d5f096db401390da47b9365706.zip
• alias (auto-)completion
- further improvements to match table names
Diffstat (limited to 'Source/SPTextView.m')
-rw-r--r--Source/SPTextView.m12
1 files changed, 6 insertions, 6 deletions
diff --git a/Source/SPTextView.m b/Source/SPTextView.m
index a1797521..892fc744 100644
--- a/Source/SPTextView.m
+++ b/Source/SPTextView.m
@@ -364,14 +364,14 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
if(!aDbName) {
// Try to suggest only items which are uniquely valid for the parsed string
- NSArray *uniqueSchema = [[SPNavigatorController sharedNavigatorController] getUniqueDbIdentifierFor:[aTableName lowercaseString] andConnection:[[[self delegate] valueForKeyPath:@"tableDocumentInstance"] connectionID]];
+ NSArray *uniqueSchema = [[SPNavigatorController sharedNavigatorController] getUniqueDbIdentifierFor:[aTableName lowercaseString] andConnection:[[[self delegate] valueForKeyPath:@"tableDocumentInstance"] connectionID] ignoreFields:YES];
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]
+ if(uniqueSchemaKind == 2 && aTableName && [aTableName length]
&& [dbs objectForKey:currentDb] && [[dbs objectForKey:currentDb] isKindOfClass:[NSDictionary class]]
- && [[dbs objectForKey:currentDb] objectForKey:[NSString stringWithFormat:@"%@%@%@", currentDb, SPUniqueSchemaDelimiter, [uniqueSchema objectAtIndex:1]]]
- && uniqueSchemaKind == 2) {
+ && [[dbs objectForKey:currentDb] objectForKey:[NSString stringWithFormat:@"%@%@%@", currentDb, SPUniqueSchemaDelimiter, [uniqueSchema objectAtIndex:1]]] )
+ {
aTableNameExists = YES;
aTableName = [uniqueSchema objectAtIndex:1];
aTableName_id = [NSString stringWithFormat:@"%@%@%@", currentDb, SPUniqueSchemaDelimiter, aTableName];
@@ -379,7 +379,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
}
// If no db name but table name check if table name is a valid db name
- if(!aTableNameExists && aTableName && [aTableName length] && uniqueSchemaKind == 1) {
+ if(uniqueSchemaKind == 1 && !aTableNameExists && aTableName && [aTableName length]) {
aDbName_id = [NSString stringWithFormat:@"%@%@%@", connectionID, SPUniqueSchemaDelimiter, [uniqueSchema objectAtIndex:1]];
aTableNameExists = NO;
}
@@ -766,7 +766,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
object:nil];
// Check for table name aliases
- if(tableDocumentInstance && customQueryInstance) {
+ if(dbBrowseMode && tableDocumentInstance && customQueryInstance) {
NSString *theDb = (dbName == nil) ? [NSString stringWithString:currentDb] : [NSString stringWithString:dbName];
NSString *connectionID = [tableDocumentInstance connectionID];
NSString *conID = [NSString stringWithFormat:@"%@%@%@", connectionID, SPUniqueSchemaDelimiter, theDb];