aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-01-21 14:15:33 +0000
committerBibiko <bibiko@eva.mpg.de>2010-01-21 14:15:33 +0000
commit0d1fff4494127c5676067c2c9bef597e7bc0ca94 (patch)
treeedbe8b8772bed7123ca129c030e4ae841286e183 /Source
parentd1af3d55bace5a74766d29da0c72665989038067 (diff)
downloadsequelpro-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')
-rw-r--r--Source/CMTextView.m10
-rw-r--r--Source/TableDocument.m8
-rw-r--r--Source/TableSource.m3
-rw-r--r--Source/TablesList.m26
4 files changed, 45 insertions, 2 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]]];
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 8d9bdca7..d0410044 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -1143,12 +1143,20 @@
if ([contextInfo isEqualToString:@"removeDatabase"]) {
if (returnCode == NSAlertDefaultReturn) {
[self _removeDatabase];
+
+ // Query the structure of all databases in the background (mainly for completion)
+ [NSThread detachNewThreadSelector:@selector(queryDbStructure) toTarget:mySQLConnection withObject:nil];
+
}
}
// Add a new database
else if ([contextInfo isEqualToString:@"addDatabase"]) {
if (returnCode == NSOKButton) {
[self _addDatabase];
+
+ // Query the structure of all databases in the background (mainly for completion)
+ [NSThread detachNewThreadSelector:@selector(queryDbStructure) toTarget:mySQLConnection withObject:nil];
+
} else {
// reset chooseDatabaseButton
if([[self database] length])
diff --git a/Source/TableSource.m b/Source/TableSource.m
index 1fd0cd44..1aa6185e 100644
--- a/Source/TableSource.m
+++ b/Source/TableSource.m
@@ -771,6 +771,9 @@ fetches the result as an array with a dictionary for each row in it
// Mark the content table for refresh
[tablesListInstance setContentRequiresReload:YES];
+ // Query the structure of all databases in the background (mainly for completion)
+ [NSThread detachNewThreadSelector:@selector(queryDbStructure) toTarget:mySQLConnection withObject:nil];
+
return YES;
}
else {
diff --git a/Source/TablesList.m b/Source/TablesList.m
index 645e2305..e784f862 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -1315,7 +1315,10 @@
// Set window title
[tableWindow setTitle:[tableDocumentInstance displaySPName]];
- }
+ // Query the structure of all databases in the background (mainly for completion)
+ [NSThread detachNewThreadSelector:@selector(queryDbStructure) toTarget:mySQLConnection withObject:nil];
+
+ }
else {
// Error while renaming
alertSheetOpened = YES;
@@ -1871,6 +1874,10 @@
[tableWindow setTitle:[tableDocumentInstance displaySPName]];
[tablesListView deselectAll:self];
+
+ // Query the structure of all databases in the background (mainly for completion)
+ [NSThread detachNewThreadSelector:@selector(queryDbStructure) toTarget:mySQLConnection withObject:nil];
+
}
/**
@@ -1965,6 +1972,10 @@
[self updateFilter:self];
[tablesListView scrollRowToVisible:[tablesListView selectedRow]];
[self updateSelectionWithTaskString:[NSString stringWithFormat:NSLocalizedString(@"Loading %@...", @"Loading table task string"), selectedTableName]];
+
+ // Query the structure of all databases in the background (mainly for completion)
+ [NSThread detachNewThreadSelector:@selector(queryDbStructure) toTarget:mySQLConnection withObject:nil];
+
}
else {
// Error while creating new table
@@ -2154,6 +2165,10 @@
[self updateFilter:self];
[tablesListView scrollRowToVisible:[tablesListView selectedRow]];
[self updateSelectionWithTaskString:[NSString stringWithFormat:NSLocalizedString(@"Loading %@...", @"Loading table task string"), selectedTableName]];
+
+ // Query the structure of all databases in the background (mainly for completion)
+ [NSThread detachNewThreadSelector:@selector(queryDbStructure) toTarget:mySQLConnection withObject:nil];
+
}
}
}
@@ -2181,6 +2196,10 @@
selectedTableName = [[NSString alloc] initWithString:[tableRenameField stringValue]];
[tablesListView reloadData];
[self updateSelectionWithTaskString:[NSString stringWithFormat:NSLocalizedString(@"Loading %@...", @"Loading table task string"), selectedTableName]];
+
+ // Query the structure of all databases in the background (mainly for completion)
+ [NSThread detachNewThreadSelector:@selector(queryDbStructure) toTarget:mySQLConnection withObject:nil];
+
return;
}
} else {
@@ -2243,12 +2262,17 @@
selectedTableName = [[NSString alloc] initWithString:[tableRenameField stringValue]];
[tablesListView reloadData];
[self updateSelectionWithTaskString:[NSString stringWithFormat:NSLocalizedString(@"Loading %@...", @"Loading table task string"), selectedTableName]];
+
+ // Query the structure of all databases in the background (mainly for completion)
+ [NSThread detachNewThreadSelector:@selector(queryDbStructure) toTarget:mySQLConnection withObject:nil];
+
return;
}
}
// Set window title
[tableWindow setTitle:[tableDocumentInstance displaySPName]];
+
}
/*