aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableDocument.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-03-26 15:14:11 +0000
committerBibiko <bibiko@eva.mpg.de>2010-03-26 15:14:11 +0000
commit52309a04b95bc6dea3ead6d1968bd6e17be285bf (patch)
tree1b2ca1982f9b5c9599e04289d1de2c88a4ba6a60 /Source/TableDocument.m
parent91db43ffddbe3f5476ef3265b57d68c61a8e06c2 (diff)
downloadsequelpro-52309a04b95bc6dea3ead6d1968bd6e17be285bf.tar.gz
sequelpro-52309a04b95bc6dea3ead6d1968bd6e17be285bf.tar.bz2
sequelpro-52309a04b95bc6dea3ead6d1968bd6e17be285bf.zip
• first steps to ease the structure querying for auto-completion and navigator
- now it accumulates the data and caches them db by db, ie one has to select a db before using its structure for completion and navigator - next step is to avoid querying info_schema as much as possible - it will only query the structure if something was changed - next steps follows as soon as possible
Diffstat (limited to 'Source/TableDocument.m')
-rw-r--r--Source/TableDocument.m30
1 files changed, 20 insertions, 10 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 163f6d8b..1b39a9c4 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -688,8 +688,8 @@
window:tableWindow
notificationName:@"Connected"];
- // Query the structure of all databases in the background (mainly for completion)
- [NSThread detachNewThreadSelector:@selector(queryDbStructure) toTarget:mySQLConnection withObject:nil];
+ // // Query the structure of all databases in the background (mainly for completion)
+ // [NSThread detachNewThreadSelector:@selector(queryDbStructureAndForceUpdate:) toTarget:mySQLConnection withObject:nil];
// Init Custom Query editor with the stored queries in a spf file if given.
[spfDocData setObject:[NSNumber numberWithBool:NO] forKey:@"save_editor_content"];
@@ -840,6 +840,8 @@
}
(![self database]) ? [chooseDatabaseButton selectItemAtIndex:0] : [chooseDatabaseButton selectItemWithTitle:[self database]];
+
+
}
/**
@@ -865,6 +867,7 @@
// Select the database
[self selectDatabase:[chooseDatabaseButton titleOfSelectedItem] item:[self table]];
+
}
/**
@@ -874,7 +877,7 @@
{
// Do not update the navigator since nothing is changed
- [[SPNavigatorController sharedNavigatorController] setIgnoreUpdate:YES];
+ [[SPNavigatorController sharedNavigatorController] setIgnoreUpdate:NO];
// If Navigator runs in syncMode let it follow the selection
if([[SPNavigatorController sharedNavigatorController] syncMode]) {
@@ -1014,10 +1017,6 @@
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
@@ -1026,7 +1025,7 @@
[self _addDatabase];
// Query the structure of all databases in the background (mainly for completion)
- [NSThread detachNewThreadSelector:@selector(queryDbStructure) toTarget:mySQLConnection withObject:nil];
+ [NSThread detachNewThreadSelector:@selector(queryDbStructureAndForceUpdate:) toTarget:mySQLConnection withObject:[NSNumber numberWithBool:YES]];
} else {
// reset chooseDatabaseButton
@@ -1091,6 +1090,11 @@
[[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
}
+- (BOOL)navigatorSchemaPathExistsForDatabase:(NSString*)dbname
+{
+ return [[SPNavigatorController sharedNavigatorController] schemaPathExistsForConnection:[self connectionID] andDatabase:dbname];
+}
+
#pragma mark -
#pragma mark Console methods
@@ -4093,7 +4097,9 @@
return;
}
-
+
+ [[SPNavigatorController sharedNavigatorController] removeDatabase:[self database] forConnectionID:[self connectionID]];
+
// Delete was successful
if (selectedDatabase) [selectedDatabase release], selectedDatabase = nil;
@@ -4103,6 +4109,7 @@
[tableDumpInstance setConnection:mySQLConnection];
[tableWindow setTitle:[self displaySPName]];
+
}
/**
@@ -4177,11 +4184,14 @@
[tablesListInstance selectItemWithName:targetItemName];
} else {
[[tablesListInstance onMainThread] setTableListSelectability:YES];
- [[[tablesListInstance valueForKey:@"tablesListView"] onMainThread] deselectAll:self];
+ [[[tablesListInstance valueForKey:@"tablesListView"] onMainThread] deselectAll:self];
[[tablesListInstance onMainThread] setTableListSelectability:NO];
}
}
+ // Query the structure of all databases in the background (mainly for completion)
+ [NSThread detachNewThreadSelector:@selector(queryDbStructureAndForceUpdate:) toTarget:mySQLConnection withObject:nil];
+
[self endTask];
[taskPool drain];
}