diff options
author | Michael Heins <michael.heins@joltup.com> | 2017-05-29 07:45:30 -0600 |
---|---|---|
committer | Max Lohrmann <dmoagx@users.noreply.github.com> | 2017-05-30 00:21:57 +0200 |
commit | 35b8b4a488ac3e1a20a3d7dc489e35b773c897f3 (patch) | |
tree | 63cd2f62a47ab73230e004a64d51ab6ae7591a0c | |
parent | bdde7f922ee90a6a01cf23002bc4e29d0cd7367d (diff) | |
download | sequelpro-35b8b4a488ac3e1a20a3d7dc489e35b773c897f3.tar.gz sequelpro-35b8b4a488ac3e1a20a3d7dc489e35b773c897f3.tar.bz2 sequelpro-35b8b4a488ac3e1a20a3d7dc489e35b773c897f3.zip |
Add capability export and copy blobs as hex, if "Display Binary Data as Hex" is selected.
-rw-r--r-- | Source/SPCopyTable.m | 7 | ||||
-rw-r--r-- | Source/SPTableContent.m | 12 |
2 files changed, 17 insertions, 2 deletions
diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m index ed7b1d71..f2ad878f 100644 --- a/Source/SPCopyTable.m +++ b/Source/SPCopyTable.m @@ -197,7 +197,12 @@ static const NSInteger kBlobAsImageFile = 4; [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]; diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index 4e3ee245..e2895e15 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -2382,6 +2382,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper [currentResult addObject:[NSArray arrayWithArray:tempRow]]; + BOOL hexBlobs = [prefs boolForKey: SPDisplayBinaryDataAsHex]; // Add rows for (i = 0; i < [self numberOfRowsInTableView:tableContentView]; i++) { @@ -2440,7 +2441,16 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper [[image TIFFRepresentationUsingCompression:NSTIFFCompressionJPEG factor:0.01f] base64Encoding]]]; } else { - [tempRow addObject:hide ? @"<BLOB>" : [o stringRepresentationUsingEncoding:[mySQLConnection stringEncoding]]]; + NSString *str; + if (hide) + str = @"<BLOB>"; + else if (hexBlobs) { + str = [NSString stringWithFormat: @"0x%@", [o dataToHexString]]; + } + else { + str = [o stringRepresentationUsingEncoding:[mySQLConnection stringEncoding]]; + } + [tempRow addObject: str]; } if(image) [image release]; |