aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableContentDataSource.m
diff options
context:
space:
mode:
authorStuart Connolly <stuart02@gmail.com>2014-01-14 19:05:29 +0000
committerStuart Connolly <stuart02@gmail.com>2014-01-14 19:05:29 +0000
commitfc8cc239ab276cf0fc7a7b9ed77369aa9666e06a (patch)
tree568029c742fb30ddaa18450f0d48e1aa6037993e /Source/SPTableContentDataSource.m
parent12c3d328170a182a18280e9c62f78144095adcc0 (diff)
downloadsequelpro-fc8cc239ab276cf0fc7a7b9ed77369aa9666e06a.tar.gz
sequelpro-fc8cc239ab276cf0fc7a7b9ed77369aa9666e06a.tar.bz2
sequelpro-fc8cc239ab276cf0fc7a7b9ed77369aa9666e06a.zip
Add an option to display binary data as hex, while displaying it in blue to distinguish from string data of similar content.
Diffstat (limited to 'Source/SPTableContentDataSource.m')
-rw-r--r--Source/SPTableContentDataSource.m23
1 files changed, 19 insertions, 4 deletions
diff --git a/Source/SPTableContentDataSource.m b/Source/SPTableContentDataSource.m
index 8ffa2c69..18c6d4ac 100644
--- a/Source/SPTableContentDataSource.m
+++ b/Source/SPTableContentDataSource.m
@@ -107,26 +107,40 @@
else {
if ([tableView editedColumn] == (NSInteger)columnIndex && [tableView editedRow] == rowIndex) {
value = [self _contentValueForTableColumn:columnIndex row:rowIndex asPreview:NO];
- } else {
+ }
+ else {
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]])
+ if ([value isKindOfClass:[SPMySQLGeometryData class]]) {
return [value wktString];
+ }
- if ([value isNSNull])
+ if ([value isNSNull]) {
return [prefs objectForKey:SPNullValue];
+ }
if ([value isKindOfClass:[NSData class]]) {
+
+ if ([columnType isEqualToString:@"binary"] && [prefs boolForKey:SPDisplayBinaryDataAsHex]) {
+ return [NSString stringWithFormat:@"0x%@", [value dataToHexString]];
+ }
+
if ([tableContentView shouldUseFieldEditorForRow:rowIndex column:columnIndex]) {
return [value shortStringRepresentationUsingEncoding:[mySQLConnection stringEncoding]];
}
+
return [value stringRepresentationUsingEncoding:[mySQLConnection stringEncoding]];
}
- if ([value isSPNotLoaded])
+ if ([value isSPNotLoaded]) {
return NSLocalizedString(@"(not loaded)", @"value shown for hidden blob and text fields");
+ }
return value;
}
@@ -203,6 +217,7 @@
if (asPreview) {
return SPDataStoragePreviewAtRowAndColumn(tableValues, rowIndex, columnIndex, 150);
}
+
return SPDataStorageObjectAtRowAndColumn(tableValues, rowIndex, columnIndex);
}