diff options
author | rowanbeentje <rowan@beent.je> | 2010-01-12 00:03:47 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2010-01-12 00:03:47 +0000 |
commit | 703e78c5b147261417718d56281e91603b1e8356 (patch) | |
tree | 118c7410a1767f9474f45fa03d764092ecdba7fd /Source | |
parent | cd623f3671793e3502680113d20317d3146338e7 (diff) | |
download | sequelpro-703e78c5b147261417718d56281e91603b1e8356.tar.gz sequelpro-703e78c5b147261417718d56281e91603b1e8356.tar.bz2 sequelpro-703e78c5b147261417718d56281e91603b1e8356.zip |
- Fix incorrect pagination task text ("Filtering table...") when no filtering is occurring, just pagination
- If the table count is estimated (eg InnoDB), but the end is reached via pagination, make the row count accurate based on the known number of rows
Diffstat (limited to 'Source')
-rw-r--r-- | Source/TableContent.m | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/Source/TableContent.m b/Source/TableContent.m index 7f8f5ab4..594822ec 100644 --- a/Source/TableContent.m +++ b/Source/TableContent.m @@ -1007,9 +1007,29 @@ */ - (IBAction)filterTable:(id)sender { + NSString *taskString; + if ([tableDocumentInstance isWorking]) return; [self setPaginationViewVisibility:FALSE]; - [tableDocumentInstance startTaskWithDescription:NSLocalizedString(@"Filtering table...", @"Filtering table task description")]; + + // Select the correct pagination value + if (![prefs boolForKey:SPLimitResults] || [paginationPageField integerValue] <= 0) + contentPage = 1; + else if (([paginationPageField integerValue] - 1) * [prefs integerForKey:SPLimitResultsValue] >= maxNumRows) + contentPage = ceil((CGFloat)maxNumRows / [prefs floatForKey:SPLimitResultsValue]); + else + contentPage = [paginationPageField integerValue]; + + if ([self tableFilterString]) { + taskString = NSLocalizedString(@"Filtering table...", @"Filtering table task description"); + } else if (contentPage == 1) { + taskString = [NSString stringWithFormat:NSLocalizedString(@"Loading %@...", @"Loading table task string"), selectedTable]; + } else { + taskString = [NSString stringWithFormat:NSLocalizedString(@"Loading page %lu...", @"Loading table page task string"), (unsigned long)contentPage]; + } + + [tableDocumentInstance startTaskWithDescription:taskString]; + if ([NSThread isMainThread]) { [NSThread detachNewThreadSelector:@selector(filterTableTask) toTarget:self withObject:nil]; } else { @@ -1026,14 +1046,6 @@ // Update history [spHistoryControllerInstance updateHistoryEntries]; - // Select the correct pagination value - if (![prefs boolForKey:SPLimitResults] || [paginationPageField integerValue] <= 0) - contentPage = 1; - else if (([paginationPageField integerValue] - 1) * [prefs integerForKey:SPLimitResultsValue] >= maxNumRows) - contentPage = ceil((CGFloat)maxNumRows / [prefs floatForKey:SPLimitResultsValue]); - else - contentPage = [paginationPageField integerValue]; - // Reset and reload data using the new filter settings previousTableRowsCount = 0; [self clearTableValues]; @@ -2518,6 +2530,9 @@ maxNumRows = foundMaxRows; maxNumRowsIsEstimate = NO; } + } else if (!isInterruptedLoad && tableRowsCount < [prefs integerForKey:SPLimitResultsValue]) { + maxNumRows = foundMaxRows; + maxNumRowsIsEstimate = NO; } } else if (tableRowsCount > maxNumRows) { maxNumRows = tableRowsCount; |