Permalink
Browse files

Add capability export and copy blobs as hex, if "Display Binary Data …

…as Hex" is selected.
  • Loading branch information...
Michael Heins authored and dmoagx committed May 29, 2017
1 parent bdde7f9 commit 35b8b4a488ac3e1a20a3d7dc489e35b773c897f3
Showing with 17 additions and 2 deletions.
  1. +6 −1 Source/SPCopyTable.m
  2. +11 −1 Source/SPTableContent.m
View
@@ -197,7 +197,12 @@ - (NSString *)rowsAsTabStringWithHeaders:(BOOL)withHeaders onlySelectedRows:(BOO
[result appendFormat:@"%@\t", NSLocalizedString(@"(not loaded)", @"value shown for hidden blob and text fields")];
else if ([cellData isKindOfClass:[NSData class]]) {
if(withBlobHandling == kBlobInclude) {
NSString *displayString = [[NSString alloc] initWithData:cellData encoding:[mySQLConnection stringEncoding]];
BOOL hexBlobs = [prefs boolForKey:SPDisplayBinaryDataAsHex];
NSString *displayString;
if (hexBlobs)
displayString = [[NSString alloc] initWithFormat:@"0x%@", [cellData dataToHexString]];
else
displayString = [[NSString alloc] initWithData:cellData encoding:[mySQLConnection stringEncoding]];
if (!displayString) displayString = [[NSString alloc] initWithData:cellData encoding:NSASCIIStringEncoding];
if (displayString) {
[result appendFormat:@"%@\t", displayString];
View
@@ -2382,6 +2382,7 @@ - (NSArray *)currentDataResultWithNULLs:(BOOL)includeNULLs hideBLOBs:(BOOL)hide
[currentResult addObject:[NSArray arrayWithArray:tempRow]];
BOOL hexBlobs = [prefs boolForKey: SPDisplayBinaryDataAsHex];
// Add rows
for (i = 0; i < [self numberOfRowsInTableView:tableContentView]; i++)
{
@@ -2440,7 +2441,16 @@ - (NSArray *)currentDataResultWithNULLs:(BOOL)includeNULLs hideBLOBs:(BOOL)hide
[[image TIFFRepresentationUsingCompression:NSTIFFCompressionJPEG factor:0.01f] base64Encoding]]];
}
else {
[tempRow addObject:hide ? @"&lt;BLOB&gt;" : [o stringRepresentationUsingEncoding:[mySQLConnection stringEncoding]]];
NSString *str;
if (hide)
str = @"&lt;BLOB&gt;";
else if (hexBlobs) {
str = [NSString stringWithFormat: @"0x%@", [o dataToHexString]];
}
else {
str = [o stringRepresentationUsingEncoding:[mySQLConnection stringEncoding]];
}
[tempRow addObject: str];
}
if(image) [image release];

0 comments on commit 35b8b4a

Please sign in to comment.