aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableData.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-07-20 20:27:59 +0000
committerBibiko <bibiko@eva.mpg.de>2009-07-20 20:27:59 +0000
commitc506398bb7f92644c04f542c067a761e8eee77ee (patch)
tree8dee78bde1fa07a0fe96aaebc16d437b888dbe94 /Source/SPTableData.m
parent82490a9e850ff0eb94a7a159106ca50cb34cdfa7 (diff)
downloadsequelpro-c506398bb7f92644c04f542c067a761e8eee77ee.tar.gz
sequelpro-c506398bb7f92644c04f542c067a761e8eee77ee.tar.bz2
sequelpro-c506398bb7f92644c04f542c067a761e8eee77ee.zip
• fixed: if SPTableData returns for dict: tableStatus key:Rows = NULL (as for information_schema for instance) then try to get the number of rows via "SELECT COUNT(*) FROM table" in order to be able to load the Content Tab
Diffstat (limited to 'Source/SPTableData.m')
-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;
}