aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableInfo.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-09-01 23:09:21 +0000
committerrowanbeentje <rowan@beent.je>2009-09-01 23:09:21 +0000
commit1a6b920d5982840a405a6a53e0c3928b79066a9b (patch)
tree1c228187e9f5bfe66681578aebb9fe9526999ffe /Source/SPTableInfo.m
parentc193919cacda828749f7a25cded79bf0ab870190 (diff)
downloadsequelpro-1a6b920d5982840a405a6a53e0c3928b79066a9b.tar.gz
sequelpro-1a6b920d5982840a405a6a53e0c3928b79066a9b.tar.bz2
sequelpro-1a6b920d5982840a405a6a53e0c3928b79066a9b.zip
- Use long longs instead of ints when looking at table sizes, free space, and row counts for display, fixing overflow issues (this addresses Issue #394)
- Tweak the byte size formatter to also show TBs for very large numbers - Improve row count and auto increment value formatting by using a number formatter (enhancements for Issue #394)
Diffstat (limited to 'Source/SPTableInfo.m')
-rw-r--r--Source/SPTableInfo.m10
1 files changed, 7 insertions, 3 deletions
diff --git a/Source/SPTableInfo.m b/Source/SPTableInfo.m
index 07e6d895..800a87dd 100644
--- a/Source/SPTableInfo.m
+++ b/Source/SPTableInfo.m
@@ -71,6 +71,8 @@
- (void)tableChanged:(NSNotification *)notification
{
NSDictionary *tableStatus;
+ NSNumberFormatter *numberFormatter = [[[NSNumberFormatter alloc] init] autorelease];
+ [numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle];
[info removeAllObjects];
@@ -128,14 +130,16 @@
// 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:[[tableStatus objectForKey:@"RowsCountAccurate"] boolValue] ? @"rows: %@" : @"rows: ~%@", [tableStatus objectForKey:@"Rows"]]];
+ [info addObject:[NSString stringWithFormat:[[tableStatus objectForKey:@"RowsCountAccurate"] boolValue] ? @"rows: %@" : @"rows: ~%@",
+ [numberFormatter stringFromNumber:[NSNumber numberWithLongLong:[[tableStatus objectForKey:@"Rows"] longLongValue]]]]];
}
- [info addObject:[NSString stringWithFormat:@"size: %@", [NSString stringForByteSize:[[tableStatus objectForKey:@"Data_length"] intValue]]]];
+ [info addObject:[NSString stringWithFormat:@"size: %@", [NSString stringForByteSize:[[tableStatus objectForKey:@"Data_length"] longLongValue]]]];
[info addObject:[NSString stringWithFormat:@"encoding: %@", [tableDataInstance tableEncoding]]];
if (![[tableStatus objectForKey:@"Auto_increment"] isNSNull]) {
- [info addObject:[NSString stringWithFormat:@"auto_increment: %@", [tableStatus objectForKey:@"Auto_increment"]]];
+ [info addObject:[NSString stringWithFormat:@"auto_increment: %@",
+ [numberFormatter stringFromNumber:[NSNumber numberWithLongLong:[[tableStatus objectForKey:@"Auto_increment"] longLongValue]]]]];
}
}
}