From c10bcae6246d08c9b6b9cb04296e40f56dacb954 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Tue, 7 Jul 2009 15:27:04 +0000 Subject: MyISAM tables report the exact number of rows in a table in the output of SHOW TABLE STATUS so don't prefix the row count with '~'. --- Source/SPExtendedTableInfo.m | 4 ++++ Source/SPTableInfo.m | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/SPExtendedTableInfo.m b/Source/SPExtendedTableInfo.m index 2f38fe5e..1bea535a 100644 --- a/Source/SPExtendedTableInfo.m +++ b/Source/SPExtendedTableInfo.m @@ -368,6 +368,10 @@ value = [dateFormatter stringFromDate:[NSDate dateWithNaturalLanguageString:value]]; } + // Prefix number of rows with '~' if this is not a MyISAM table. Only MyISAM tables report the exact row count. + else if (([key isEqualToString:@"Rows"]) && (![[infoDict objectForKey:@"Engine"] isEqualToString:@"MyISAM"])) { + value = [@"~" stringByAppendingString:value]; + } } return [NSString stringWithFormat:@"%@: %@", label, ([value length] > 0) ? value : @"Not available"]; diff --git a/Source/SPTableInfo.m b/Source/SPTableInfo.m index 9295aa38..3a2b67b8 100644 --- a/Source/SPTableInfo.m +++ b/Source/SPTableInfo.m @@ -131,7 +131,7 @@ // Check for 'Rows' == NULL - information_schema database doesn't report row count for it's tables if (![[tableStatus objectForKey:@"Rows"] isNSNull]) { - [info addObject:[NSString stringWithFormat:@"rows: ~%@", [tableStatus objectForKey:@"Rows"]]]; + [info addObject:[NSString stringWithFormat:([[tableStatus objectForKey:@"Engine"] isEqualToString:@"MyISAM"]) ? @"rows: %@" : @"rows: ~%@", [tableStatus objectForKey:@"Rows"]]]; } [info addObject:[NSString stringWithFormat:@"size: %@", [NSString stringForByteSize:[[tableStatus objectForKey:@"Data_length"] intValue]]]]; -- cgit v1.2.3