aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableContent.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-10-17 16:02:58 +0000
committerrowanbeentje <rowan@beent.je>2009-10-17 16:02:58 +0000
commitb967aeff1d12af4e9b1f27bc65c8506e5a3a2d2d (patch)
tree5d621b20e84b6b14a952138b4b6786b0a3770d04 /Source/TableContent.m
parent6a4e2994d17220eb43015162522deec1efdd429b (diff)
downloadsequelpro-b967aeff1d12af4e9b1f27bc65c8506e5a3a2d2d.tar.gz
sequelpro-b967aeff1d12af4e9b1f27bc65c8506e5a3a2d2d.tar.bz2
sequelpro-b967aeff1d12af4e9b1f27bc65c8506e5a3a2d2d.zip
- Update the row count a bit more intelligently when the table content is LMITed or FILTERed but the table content is increasing. This addresses Issue #421.
Diffstat (limited to 'Source/TableContent.m')
-rw-r--r--Source/TableContent.m26
1 files changed, 26 insertions, 0 deletions
diff --git a/Source/TableContent.m b/Source/TableContent.m
index ed74a005..6f8f8dcd 100644
--- a/Source/TableContent.m
+++ b/Source/TableContent.m
@@ -2172,6 +2172,7 @@
*/
- (void)updateNumberOfRows
{
+ BOOL checkStatusCount = NO;
// For unfiltered and non-limited tables, use the result count - and update the status count
if (!isLimited && !isFiltered) {
@@ -2186,6 +2187,7 @@
} else if ([[tableDataInstance statusValueForKey:@"RowsCountAccurate"] boolValue]) {
maxNumRows = [[tableDataInstance statusValueForKey:@"Rows"] intValue];
maxNumRowsIsEstimate = NO;
+ checkStatusCount = YES;
// Choose whether to display an estimate, or to fetch the correct row count, based on prefs
} else if ([prefs boolForKey:SPFetchCorrectRowCount]) {
@@ -2200,6 +2202,30 @@
} else {
maxNumRows = [[tableDataInstance statusValueForKey:@"Rows"] intValue];
maxNumRowsIsEstimate = YES;
+ checkStatusCount = YES;
+ }
+
+ // Check whether the estimated count requires updating, ie if the retrieved count exceeds it
+ if (checkStatusCount) {
+ NSInteger foundMaxRows;
+ if ([prefs boolForKey:SPLimitResults]) {
+ foundMaxRows = [limitRowsField intValue] - 1 + [tableValues count];
+ if (foundMaxRows > maxNumRows) {
+ if (foundMaxRows == [limitRowsField intValue] - 1 + [prefs integerForKey:SPLimitResultsValue]) {
+ maxNumRows = foundMaxRows + 1;
+ maxNumRowsIsEstimate = YES;
+ } else {
+ maxNumRows = foundMaxRows;
+ maxNumRowsIsEstimate = NO;
+ }
+ }
+ } else if ([tableValues count] > maxNumRows) {
+ maxNumRows = [tableValues count];
+ maxNumRowsIsEstimate = YES;
+ }
+ [tableDataInstance setStatusValue:[NSString stringWithFormat:@"%d", maxNumRows] forKey:@"Rows"];
+ [tableDataInstance setStatusValue:maxNumRowsIsEstimate?@"n":@"y" forKey:@"RowsCountAccurate"];
+ [tableInfoInstance tableChanged:nil];
}
}