aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDatabaseViewController.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2011-02-11 02:06:18 +0000
committerrowanbeentje <rowan@beent.je>2011-02-11 02:06:18 +0000
commite3ac547a6fb5b73581e61bb35ac2f3f7fca67a96 (patch)
tree8ed159102057d9a26a5dd13e303cf1ce37da7c3b /Source/SPDatabaseViewController.m
parentf5a99e49839174bdfa2364fbba1c963da4a3481b (diff)
downloadsequelpro-e3ac547a6fb5b73581e61bb35ac2f3f7fca67a96.tar.gz
sequelpro-e3ac547a6fb5b73581e61bb35ac2f3f7fca67a96.tar.bz2
sequelpro-e3ac547a6fb5b73581e61bb35ac2f3f7fca67a96.zip
- Revert r3187, which only masked an underlying bug and caused double columns in views
- In SPTableStructureDelete, don't request the encoding if the table is reloading; this prevents multithreaded data fetches and race conditions causing Issue #974. - Alter SPTableData to use thread mutexes instead of a boolean to prevent threading issues, which also fixes Issue #974 in a different way. Alter race condition checks to block their threads instead of returning bogus information to prevent state issues. - Alter table loading to no longer load trigger information until required, speeding up use of other views and cleaning up the console log.
Diffstat (limited to 'Source/SPDatabaseViewController.m')
-rw-r--r--Source/SPDatabaseViewController.m25
1 files changed, 9 insertions, 16 deletions
diff --git a/Source/SPDatabaseViewController.m b/Source/SPDatabaseViewController.m
index 03153230..a6600d3f 100644
--- a/Source/SPDatabaseViewController.m
+++ b/Source/SPDatabaseViewController.m
@@ -280,7 +280,7 @@
[tableSourceInstance loadTable:nil];
[tableContentInstance loadTable:nil];
[[extendedTableInfoInstance onMainThread] loadTable:nil];
- [[tableTriggersInstance onMainThread] loadTriggers];
+ [[tableTriggersInstance onMainThread] resetInterface];
structureLoaded = NO;
contentLoaded = NO;
statusLoaded = NO;
@@ -393,8 +393,12 @@
// Update the window title
[self updateWindowTitle:self];
- // Reset table information caches
+ // Reset table information caches and mark that all loaded views require their data reloading
[tableDataInstance resetAllData];
+ structureLoaded = NO;
+ contentLoaded = NO;
+ statusLoaded = NO;
+ triggersLoaded = NO;
// Ensure status and details are fetched using UTF8
NSString *previousEncoding = [mySQLConnection encoding];
@@ -408,7 +412,8 @@
[tableDataInstance updateStatusInformationForCurrentTable];
// Check the current encoding against the table encoding to see whether
- // an encoding change and reset is required
+ // an encoding change and reset is required. This also caches table information on
+ // the working thread.
if( selectedTableType == SPTableTypeView || selectedTableType == SPTableTypeTable) {
// tableEncoding == nil indicates that there was an error while retrieving table data
@@ -426,24 +431,12 @@
if (changeEncoding) [mySQLConnection restoreStoredEncoding];
- // Cache table information on the working thread
- if (selectedTableType == SPTableTypeView)
- [tableDataInstance updateInformationForCurrentView];
- else
- [tableDataInstance updateInformationForCurrentTable];
-
// Notify listeners of the table change now that the state is fully set up.
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:SPTableChangedNotification object:self];
// Restore view states as appropriate
[spHistoryControllerInstance restoreViewStates];
- // Mark that all loaded views require their data reloading
- structureLoaded = NO;
- contentLoaded = NO;
- statusLoaded = NO;
- triggersLoaded = NO;
-
// Load the currently selected view if looking at a table or view
if (tableEncoding && (selectedTableType == SPTableTypeView || selectedTableType == SPTableTypeTable))
{
@@ -475,7 +468,7 @@
if (!structureLoaded) [tableSourceInstance loadTable:nil];
if (!contentLoaded) [tableContentInstance loadTable:nil];
if (!statusLoaded) [[extendedTableInfoInstance onMainThread] loadTable:nil];
- if (!triggersLoaded) [[tableTriggersInstance onMainThread] loadTriggers];
+ if (!triggersLoaded) [[tableTriggersInstance onMainThread] resetInterface];
// Update the "Show Create Syntax" window if it's already opened
// according to the selected table/view/proc/func