aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPTableData.m9
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/SPTableData.m b/Source/SPTableData.m
index 81fe5479..69db2b93 100644
--- a/Source/SPTableData.m
+++ b/Source/SPTableData.m
@@ -739,6 +739,15 @@
if ([status objectForKey:@"Type"]) {
[status setObject:[status objectForKey:@"Type"] forKey:@"Engine"];
}
+
+ // [status objectForKey:@"Rows"] is NULL then try to get the number of rows via SELECT COUNT(*) FROM `foo`
+ // this happens e.g. for db "information_schema"
+ if([[status objectForKey:@"Rows"] isKindOfClass:[NSNull class]]) {
+ tableStatusResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(*) FROM %@", [escapedTableName backtickQuotedString] ]];
+ if ([[mySQLConnection getLastErrorMessage] isEqualToString:@""])
+ [status setObject:[NSNumber numberWithLongLong:[[[tableStatusResult fetchRowAsArray] objectAtIndex:0] longLongValue]] forKey:@"Rows"];
+
+ }
return TRUE;
}