From 0d1fff4494127c5676067c2c9bef597e7bc0ca94 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Thu, 21 Jan 2010 14:15:33 +0000 Subject: =?UTF-8?q?=E2=80=A2=20added=20call=20to=20update=20the=20completi?= =?UTF-8?q?on=20list=20to=20neuralgic=20places=20-=20next=20steps=20to=20m?= =?UTF-8?q?inimize=20the=20traffic=20-=20ie=20manipulating=20the=20dict=20?= =?UTF-8?q?directly=20without=20querying=20-=20follows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/CMTextView.m | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Source/CMTextView.m') 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]]]; -- cgit v1.2.3