aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TablesList.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-05-01 01:36:52 +0000
committerrowanbeentje <rowan@beent.je>2010-05-01 01:36:52 +0000
commit8acde6bf2580ce1e2feac2b9ac74dfa34b1ddf7e (patch)
tree4c2411b8f04d038d03013cae244d54566761ec96 /Source/TablesList.m
parent9175848b8bbe6e4b9145a492d9b4da86adb8760d (diff)
downloadsequelpro-8acde6bf2580ce1e2feac2b9ac74dfa34b1ddf7e.tar.gz
sequelpro-8acde6bf2580ce1e2feac2b9ac74dfa34b1ddf7e.tar.bz2
sequelpro-8acde6bf2580ce1e2feac2b9ac74dfa34b1ddf7e.zip
Review trigger fetching and storage:
- Trigger queries are no longer made for MySQL < 5.0.2 - Trigger loading has been deferred until the trigger tab is active, reducing queries when switching tables and thus increasing overall responsiveness - Export triggers in MySQL dumps even if the Table Content switch is unchecked
Diffstat (limited to 'Source/TablesList.m')
-rw-r--r--Source/TablesList.m53
1 files changed, 30 insertions, 23 deletions
diff --git a/Source/TablesList.m b/Source/TablesList.m
index e39da649..15def773 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -693,40 +693,35 @@
// Restore view states as appropriate
[spHistoryControllerInstance restoreViewStates];
+ structureLoaded = NO;
+ contentLoaded = NO;
+ statusLoaded = NO;
+ triggersLoaded = NO;
if( selectedTableType == SPTableTypeView || selectedTableType == SPTableTypeTable) {
if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 0 ) {
[tableSourceInstance loadTable:selectedTableName];
structureLoaded = YES;
- contentLoaded = NO;
- statusLoaded = NO;
} else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 1 ) {
if(tableEncoding == nil) {
[tableContentInstance loadTable:nil];
} else {
[tableContentInstance loadTable:selectedTableName];
}
- structureLoaded = NO;
contentLoaded = YES;
- statusLoaded = NO;
} else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 3 ) {
- [extendedTableInfoInstance performSelectorOnMainThread:@selector(loadTable:) withObject:selectedTableName waitUntilDone:YES];
- structureLoaded = NO;
- contentLoaded = NO;
+ [[extendedTableInfoInstance onMainThread] loadTable:selectedTableName];
statusLoaded = YES;
- } else {
- structureLoaded = NO;
- contentLoaded = NO;
- statusLoaded = NO;
+ } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 5 ) {
+ [[tableTriggersInstance onMainThread] loadTriggers];
+ triggersLoaded = YES;
}
} else {
// if we are not looking at a table or view, clear these
[tableSourceInstance loadTable:nil];
[tableContentInstance loadTable:nil];
- [extendedTableInfoInstance performSelectorOnMainThread:@selector(loadTable:) withObject:nil waitUntilDone:YES];
- structureLoaded = NO;
- contentLoaded = NO;
- statusLoaded = NO;
+ [[extendedTableInfoInstance onMainThread] loadTable:nil];
+ [[tableTriggersInstance onMainThread] loadTriggers];
}
// Update the "Show Create Syntax" window if it's already opened
@@ -769,10 +764,12 @@
[tableSourceInstance loadTable:nil];
[tableContentInstance loadTable:nil];
[extendedTableInfoInstance loadTable:nil];
+ [tableTriggersInstance loadTriggers];
structureLoaded = NO;
contentLoaded = NO;
statusLoaded = NO;
+ triggersLoaded = NO;
// Set gear menu items Remove/Duplicate table/view according to the table types
// if at least one item is selected
@@ -1358,24 +1355,27 @@
// if the 'table' is a view or a table, reload the currently selected view
if (selectedTableType == SPTableTypeTable || selectedTableType == SPTableTypeView)
{
+ statusLoaded = NO;
+ structureLoaded = NO;
+ contentLoaded = NO;
+ triggersLoaded = NO;
switch ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]]) {
case 0:
[tableSourceInstance loadTable:newTableName];
structureLoaded = YES;
- contentLoaded = statusLoaded = NO;
break;
case 1:
[tableContentInstance loadTable:newTableName];
contentLoaded = YES;
- structureLoaded = statusLoaded = NO;
break;
case 3:
[extendedTableInfoInstance loadTable:newTableName];
statusLoaded = YES;
- structureLoaded = contentLoaded = NO;
break;
- default:
- statusLoaded = structureLoaded = contentLoaded = NO;
+ case 5:
+ [tableTriggersInstance loadTriggers];
+ triggersLoaded = YES;
+ break;
}
}
}
@@ -1560,8 +1560,9 @@
{
NSAutoreleasePool *tabLoadPool = [[NSAutoreleasePool alloc] init];
- if ( [tablesListView numberOfSelectedRows] == 1 &&
- ([self tableType] == SPTableTypeTable || [self tableType] == SPTableTypeView) ) {
+ if ([tablesListView numberOfSelectedRows] == 1
+ && ([self tableType] == SPTableTypeTable || [self tableType] == SPTableTypeView) )
+ {
if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 0) && !structureLoaded ) {
[tableSourceInstance loadTable:selectedTableName];
@@ -1574,9 +1575,14 @@
}
if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 3) && !statusLoaded ) {
- [extendedTableInfoInstance performSelectorOnMainThread:@selector(loadTable:) withObject:selectedTableName waitUntilDone:YES];
+ [[extendedTableInfoInstance onMainThread] loadTable:selectedTableName];
statusLoaded = YES;
}
+
+ if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 5) && !triggersLoaded ) {
+ [[tableTriggersInstance onMainThread] loadTriggers];
+ triggersLoaded = YES;
+ }
}
else {
[tableSourceInstance loadTable:nil];
@@ -1805,6 +1811,7 @@
structureLoaded = NO;
contentLoaded = NO;
statusLoaded = NO;
+ triggersLoaded = NO;
isTableListFiltered = NO;
tableListIsSelectable = YES;
tableListContainsViews = NO;