diff options
author | dmoagx <post@wickenrode.com> | 2011-08-24 21:37:52 +0000 |
---|---|---|
committer | dmoagx <post@wickenrode.com> | 2011-08-24 21:37:52 +0000 |
commit | bd96d373385c8d2aff108269c1e89063cd48e416 (patch) | |
tree | 4fc509dadf5be65ce5273e85c49452c0a2336fa5 | |
parent | 4f9debeff37605793552f7fe8c3d3f1e5b4c58e2 (diff) | |
download | sequelpro-bd96d373385c8d2aff108269c1e89063cd48e416.tar.gz sequelpro-bd96d373385c8d2aff108269c1e89063cd48e416.tar.bz2 sequelpro-bd96d373385c8d2aff108269c1e89063cd48e416.zip |
* Fixes sorting of integer values in server process list (issue #1159)
-rw-r--r-- | Source/SPProcessListController.m | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/Source/SPProcessListController.m b/Source/SPProcessListController.m index 3745d4e0..5ca669df 100644 --- a/Source/SPProcessListController.m +++ b/Source/SPProcessListController.m @@ -697,8 +697,29 @@ static const NSString *SPTableViewIDColumnIdentifier = @"Id"; for (i = 0; i < [processList numOfRows]; i++) { - [processes addObject:[processList fetchRowAsDictionary]]; + //MCPKit currently returns numbers as NSString, which will break sorting of numbers in this case. + NSMutableDictionary *rowsFixed = [[processList fetchRowAsDictionary] mutableCopy]; + + id idColumn = [rowsFixed objectForKey:@"Id"]; + //Id is a signed int(11) - this is a signed 32 bit int value + if(idColumn != nil && [idColumn isKindOfClass:[NSString class]]) { + int numRaw = [(NSString *)idColumn intValue]; + NSNumber *num = [NSNumber numberWithInt:numRaw]; + [rowsFixed setObject:num forKey:@"Id"]; + } + + id timeColumn = [rowsFixed objectForKey:@"Time"]; + //Time is a signed int(7) - this is the same 32 bit int value + if(timeColumn != nil && [timeColumn isKindOfClass:[NSString class]]) { + int numRaw = [(NSString *)timeColumn intValue]; + NSNumber *num = [NSNumber numberWithInt:numRaw]; + [rowsFixed setObject:num forKey:@"Time"]; + } + + [processes addObject:[[rowsFixed copy] autorelease]]; + [rowsFixed release]; } + } // Update the UI on the main thread |