aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableContentDataSource.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPTableContentDataSource.m')
-rw-r--r--Source/SPTableContentDataSource.m34
1 files changed, 27 insertions, 7 deletions
diff --git a/Source/SPTableContentDataSource.m b/Source/SPTableContentDataSource.m
index 34b886d4..56e8df71 100644
--- a/Source/SPTableContentDataSource.m
+++ b/Source/SPTableContentDataSource.m
@@ -106,10 +106,6 @@
value = [self _contentValueForTableColumn:columnIndex row:rowIndex asPreview:YES];
}
}
-
- NSDictionary *columnDefinition = [[(id <SPDatabaseContentViewDelegate>)[tableContentView delegate] dataColumnDefinitions] objectAtIndex:columnIndex];
-
- NSString *columnType = [columnDefinition objectForKey:@"typegrouping"];
if ([value isKindOfClass:[SPMySQLGeometryData class]]) {
return [value wktString];
@@ -120,9 +116,12 @@
}
if ([value isKindOfClass:[NSData class]]) {
-
- if ([columnType isEqualToString:@"binary"] && [prefs boolForKey:SPDisplayBinaryDataAsHex]) {
- return [NSString stringWithFormat:@"0x%@", [value dataToHexString]];
+
+ if ([self cellValueIsDisplayedAsHexForColumn:columnIndex]) {
+ if ([(NSData *)value length] > 255) {
+ return [NSString stringWithFormat:@"0x%@...", [[(NSData *)value subdataWithRange:NSMakeRange(0, 255)] dataToHexString]];
+ }
+ return [NSString stringWithFormat:@"0x%@", [(NSData *)value dataToHexString]];
}
pthread_mutex_t *fieldEditorCheckLock = NULL;
@@ -207,6 +206,27 @@
}
}
+- (BOOL)cellValueIsDisplayedAsHexForColumn:(NSUInteger)columnIndex
+{
+ if (![prefs boolForKey:SPDisplayBinaryDataAsHex]) {
+ return NO;
+ }
+
+ NSDictionary *columnDefinition = [[(id <SPDatabaseContentViewDelegate>)[tableContentView delegate] dataColumnDefinitions] objectAtIndex:columnIndex];
+ NSString *typeGrouping = columnDefinition[@"typegrouping"];
+
+ if ([typeGrouping isEqual:@"binary"]) {
+ return YES;
+ }
+
+ if ([typeGrouping isEqual:@"blobdata"]) {
+ return YES;
+ }
+
+
+ return NO;
+}
+
@end
@implementation SPTableContent (SPTableContentDataSource_Private_API)