diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-01-21 14:15:33 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-01-21 14:15:33 +0000 |
commit | 0d1fff4494127c5676067c2c9bef597e7bc0ca94 (patch) | |
tree | edbe8b8772bed7123ca129c030e4ae841286e183 /Source/CMTextView.m | |
parent | d1af3d55bace5a74766d29da0c72665989038067 (diff) | |
download | sequelpro-0d1fff4494127c5676067c2c9bef597e7bc0ca94.tar.gz sequelpro-0d1fff4494127c5676067c2c9bef597e7bc0ca94.tar.bz2 sequelpro-0d1fff4494127c5676067c2c9bef597e7bc0ca94.zip |
• added call to update the completion list to neuralgic places
- next steps to minimize the traffic - ie manipulating the dict directly without querying - follows
Diffstat (limited to 'Source/CMTextView.m')
-rw-r--r-- | Source/CMTextView.m | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Source/CMTextView.m b/Source/CMTextView.m index 7378253a..036d221b 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -204,7 +204,15 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) // Add structural db/table/field data to completions list or fallback to gathering TablesList data NSDictionary *dbs = [NSDictionary dictionaryWithDictionary:[mySQLConnection getDbStructure]]; if(dbs != nil && [dbs count]) { - NSArray *allDbs = [dbs allKeys]; + NSMutableArray *allDbs = [[NSMutableArray array] autorelease]; + [allDbs addObjectsFromArray:[dbs allKeys]]; + + // Add database names having no tables since they don't appear in the information_schema + if ([[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKey:@"allDatabaseNames"] != nil) + for(id db in [[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKey:@"allDatabaseNames"]) + if(![allDbs containsObject:db]) + [allDbs addObject:db]; + NSSortDescriptor *desc = [[NSSortDescriptor alloc] initWithKey:nil ascending:YES selector:@selector(localizedCompare:)]; NSMutableArray *sortedDbs = [[NSMutableArray array] autorelease]; [sortedDbs addObjectsFromArray:[allDbs sortedArrayUsingDescriptors:[NSArray arrayWithObject:desc]]]; |