aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/SPTableData.h1
-rw-r--r--Source/SPTableData.m9
-rw-r--r--Source/TableContent.m20
3 files changed, 20 insertions, 10 deletions
diff --git a/Source/SPTableData.h b/Source/SPTableData.h
index 02179852..7ed99edd 100644
--- a/Source/SPTableData.h
+++ b/Source/SPTableData.h
@@ -51,6 +51,7 @@
- (NSArray *) getConstraints;
- (BOOL) columnIsBlobOrText:(NSString *)colName;
- (NSString *) statusValueForKey:(NSString *)aKey;
+- (void)setStatusValue:(NSString *)value forKey:(NSString *)key;
- (NSDictionary *) statusValues;
- (void) resetAllData;
- (void) resetStatusData;
diff --git a/Source/SPTableData.m b/Source/SPTableData.m
index 69db2b93..c8dbe7b0 100644
--- a/Source/SPTableData.m
+++ b/Source/SPTableData.m
@@ -196,6 +196,15 @@
return [status objectForKey:aKey];
}
+/*
+ * Set the table status value for the supplied key. This method is useful for when status values are obtained
+ * via other means and are subsequently more accurate than the value currently set.
+ */
+- (void)setStatusValue:(NSString *)value forKey:(NSString *)key
+{
+ [status setValue:value forKey:key];
+}
+
/*
* Retrieve all known status values as a dictionary, using or refreshing the cache as appropriate.
diff --git a/Source/TableContent.m b/Source/TableContent.m
index 8bcf4942..2e7d32c2 100644
--- a/Source/TableContent.m
+++ b/Source/TableContent.m
@@ -1651,7 +1651,7 @@
}
}
-/*
+/**
* Show Error sheet (can be called from inside of a endSheet selector)
* via [self performSelector:@selector(showErrorSheetWithTitle:) withObject: afterDelay:]
*/
@@ -1664,7 +1664,7 @@
}
-/*
+/**
* Returns the number of rows in the selected table
* Queries the number from MySQL if enabled in prefs and result is limited, otherwise just return the fullResult count.
*/
@@ -1676,6 +1676,9 @@
numRows = [fullResult count];
}
+ // Update table data cache with the more accurate row count
+ [tableDataInstance setStatusValue:[NSString stringWithFormat:@"%d", numRows] forKey:@"Rows"];
+
return numRows;
}
@@ -1687,15 +1690,13 @@
return [[[[mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(1) FROM %@", [selectedTable backtickQuotedString]]] fetchRowAsArray] objectAtIndex:0] intValue];
}
-//tableView datasource methods
+// TableView datasource methods
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
return [filteredResult count];
}
-- (id)tableView:(CMCopyTable *)aTableView
-objectValueForTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex
+- (id)tableView:(CMCopyTable *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
id theValue = NSArrayObjectAtIndex(NSArrayObjectAtIndex(filteredResult, rowIndex), [[aTableColumn identifier] intValue]);
@@ -1706,14 +1707,13 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
return theValue;
}
+/**
+ * This function changes the text color of text/blob fields which are not yet loaded to gray
+ */
- (void)tableView: (CMCopyTable *)aTableView
willDisplayCell: (id)cell
forTableColumn: (NSTableColumn*)aTableColumn
row: (int)row
-/*
- * This function changes the text color of
- * text/blob fields which are not yet loaded to gray
-*/
{
// Check if loading of text/blob fields is disabled
// If not, all text fields are loaded and we don't have to make them gray