aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableContent.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-06-23 22:21:23 +0000
committerBibiko <bibiko@eva.mpg.de>2009-06-23 22:21:23 +0000
commit24f0afbfe3416b7896d0a3b4f654f04944adf39d (patch)
tree8baf8e6d89d5b57df23b5e88080e8747afaa368b /Source/TableContent.m
parented2d754e46bd6a104f1b093b979720727e95dcb5 (diff)
downloadsequelpro-24f0afbfe3416b7896d0a3b4f654f04944adf39d.tar.gz
sequelpro-24f0afbfe3416b7896d0a3b4f654f04944adf39d.tar.bz2
sequelpro-24f0afbfe3416b7896d0a3b4f654f04944adf39d.zip
• added to SPDataAdditions:
- (NSString *) shortStringRepresentationUsingEncoding: --mainly used for displaying large blob data in a tableView • tiny speed improvements for tableView:objectValueForTableColumn and tableView:setObjectValueForTableColumn in Content Browser and Custom Query
Diffstat (limited to 'Source/TableContent.m')
-rw-r--r--Source/TableContent.m40
1 files changed, 14 insertions, 26 deletions
diff --git a/Source/TableContent.m b/Source/TableContent.m
index 91ecdd53..7327d8bd 100644
--- a/Source/TableContent.m
+++ b/Source/TableContent.m
@@ -1971,26 +1971,13 @@
objectValueForTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex
{
- id theRow, theValue;
-
- theRow = [filteredResult objectAtIndex:rowIndex];
- theValue = [theRow objectForKey:[aTableColumn identifier]];
-
- // Convert data objects to their string representation in the current encoding, falling back to ascii
- if ( [theValue isKindOfClass:[NSData class]] ) {
- NSString *dataRepresentation = [[NSString alloc] initWithData:theValue encoding:[mySQLConnection encoding]];
- if (dataRepresentation == nil)
- dataRepresentation = [[NSString alloc] initWithData:theValue encoding:NSASCIIStringEncoding];
- if (dataRepresentation == nil) theValue = @"- cannot be displayed -";
- else {
- if([dataRepresentation length]>255)
- theValue = [[NSString stringWithString:dataRepresentation] substringToIndex:255];
- else
- theValue = [NSString stringWithString:dataRepresentation];
- }
- if (dataRepresentation) [dataRepresentation release];
- }
- return theValue;
+
+ id theValue = [NSArrayObjectAtIndex(filteredResult, rowIndex) objectForKey:[aTableColumn identifier]];
+
+ if ( [theValue isKindOfClass:[NSData class]] )
+ return [theValue shortStringRepresentationUsingEncoding:[mySQLConnection encoding]];
+
+ return theValue;
}
- (void)tableView: (CMCopyTable *)aTableView
@@ -2054,15 +2041,16 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
// Catch editing events in the row and if the row isn't currently being edited,
// start an edit. This allows edits including enum changes to save correctly.
if ( !isEditingRow ) {
- [oldRow setDictionary:[filteredResult objectAtIndex:rowIndex]];
+ [oldRow setDictionary:NSArrayObjectAtIndex(filteredResult, rowIndex)];
isEditingRow = YES;
currentlyEditingRow = rowIndex;
}
- if ( anObject ) {
- [[filteredResult objectAtIndex:rowIndex] setObject:anObject forKey:[aTableColumn identifier]];
- } else {
- [[filteredResult objectAtIndex:rowIndex] setObject:@"" forKey:[aTableColumn identifier]];
- }
+
+ if ( anObject )
+ [NSArrayObjectAtIndex(filteredResult, rowIndex) setObject:anObject forKey:[aTableColumn identifier]];
+ else
+ [NSArrayObjectAtIndex(filteredResult, rowIndex) setObject:@"" forKey:[aTableColumn identifier]];
+
}
#pragma mark -