From 1f18d0eb40a1bc0551dbabdfe355c9632a47c6c6 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Tue, 20 Mar 2012 22:43:34 +0000 Subject: - When exporting a query result or filtered table view make sure we're including the entire content of BLOBs, not just what we display. Fixes issue #1124. - Move SPTableContent's table view datasource and delegate methods to separate categories in order to reduce it's size. --- Source/SPCustomQuery.m | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'Source/SPCustomQuery.m') diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index da15da11..3388b035 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -57,7 +57,7 @@ @interface SPCustomQuery (PrivateAPI) - (id)_resultDataItemAtRow:(NSInteger)row columnIndex:(NSUInteger)column; -- (id)_convertResultDataValueToDisplayableRepresentation:(id)value whilePreservingNULLs:(BOOL)preserveNULLs; +- (id)_convertResultDataValueToDisplayableRepresentation:(id)value whilePreservingNULLs:(BOOL)preserveNULLs truncateDataFields:(BOOL)truncate; @end @@ -1455,7 +1455,7 @@ */ - (NSArray *)currentResult { - return [self currentDataResultWithNULLs:NO]; + return [self currentDataResultWithNULLs:NO truncateDataFields:YES]; } /** @@ -1464,8 +1464,9 @@ * * @param includeNULLs Indicates whether to include NULLs as a native type * or use the user's NULL string representation preference. + * @param truncate Indicates whether to truncate data fields for display purposes. */ -- (NSArray *)currentDataResultWithNULLs:(BOOL)includeNULLs +- (NSArray *)currentDataResultWithNULLs:(BOOL)includeNULLs truncateDataFields:(BOOL)truncate { NSInteger i; id tableColumn; @@ -1492,7 +1493,7 @@ { id value = [self _resultDataItemAtRow:i columnIndex:[[tableColumn identifier] integerValue]]; - [tempRow addObject:[self _convertResultDataValueToDisplayableRepresentation:value whilePreservingNULLs:YES]]; + [tempRow addObject:[self _convertResultDataValueToDisplayableRepresentation:value whilePreservingNULLs:includeNULLs truncateDataFields:truncate]]; } [currentResult addObject:[NSArray arrayWithArray:tempRow]]; @@ -2045,7 +2046,7 @@ { if (aTableView == customQueryView) { - return [self _convertResultDataValueToDisplayableRepresentation:[self _resultDataItemAtRow:rowIndex columnIndex:[[tableColumn identifier] integerValue]] whilePreservingNULLs:NO]; + return [self _convertResultDataValueToDisplayableRepresentation:[self _resultDataItemAtRow:rowIndex columnIndex:[[tableColumn identifier] integerValue]] whilePreservingNULLs:NO truncateDataFields:YES]; } return @""; @@ -3994,13 +3995,14 @@ * @param value The value to convert * @param preserveNULLs Whether or not NULLs should be preserved or converted to the * user's NULL placeholder preference. + * @param truncate Whether or not data fields should be truncates for display purposes. * * @return The converted value */ -- (id)_convertResultDataValueToDisplayableRepresentation:(id)value whilePreservingNULLs:(BOOL)preserveNULLs +- (id)_convertResultDataValueToDisplayableRepresentation:(id)value whilePreservingNULLs:(BOOL)preserveNULLs truncateDataFields:(BOOL)truncate { if ([value isKindOfClass:[NSData class]]) { - value = [value shortStringRepresentationUsingEncoding:[mySQLConnection stringEncoding]]; + value = truncate ? [value shortStringRepresentationUsingEncoding:[mySQLConnection stringEncoding]] : [value stringRepresentationUsingEncoding:[mySQLConnection stringEncoding]]; } if ([value isNSNull] && !preserveNULLs) { -- cgit v1.2.3