diff options
author | Bibiko <bibiko@eva.mpg.de> | 2009-07-20 20:27:59 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2009-07-20 20:27:59 +0000 |
commit | c506398bb7f92644c04f542c067a761e8eee77ee (patch) | |
tree | 8dee78bde1fa07a0fe96aaebc16d437b888dbe94 /Source | |
parent | 82490a9e850ff0eb94a7a159106ca50cb34cdfa7 (diff) | |
download | sequelpro-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')
-rw-r--r-- | Source/SPTableData.m | 9 |
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; } |