diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-08-20 10:02:00 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-08-20 10:02:00 +0000 |
commit | d17a6b638e529694685a333162bbf6fec6c7fc08 (patch) | |
tree | 5c72506af7bf75299c093ce6a47b7cc4a956e0ff /Source/SPTableContent.m | |
parent | dabf6466f11e5936ee871b8b3dd573020a142586 (diff) | |
download | sequelpro-d17a6b638e529694685a333162bbf6fec6c7fc08.tar.gz sequelpro-d17a6b638e529694685a333162bbf6fec6c7fc08.tar.bz2 sequelpro-d17a6b638e529694685a333162bbf6fec6c7fc08.zip |
• overall replacement of:
[aString appendString:[NSString stringWithFormat:]] by
[aString appendFormat:]
since it's much more faster
• first look at loop where several [aStr appendString:] occur to try to combine them into one appendString or appendFormat since the allocation of memory takes really time
Note: I tested all my changes but we should test it further to be sure that I didn't a mistake!
Diffstat (limited to 'Source/SPTableContent.m')
-rw-r--r-- | Source/SPTableContent.m | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index 3f078b88..f18cf96c 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -1668,9 +1668,9 @@ id keyValue = [tableValues cellDataAtRow:index column:[[[tableDataInstance columnWithName:NSArrayObjectAtIndex(primaryKeyFieldNames,0)] objectForKey:@"datacolumnindex"] integerValue]]; if([keyValue isKindOfClass:[NSData class]]) - [deleteQuery appendString:[NSString stringWithFormat:@"X'%@'", [mySQLConnection prepareBinaryData:keyValue]]]; + [deleteQuery appendFormat:@"X'%@'", [mySQLConnection prepareBinaryData:keyValue]]; else - [deleteQuery appendString:[NSString stringWithFormat:@"'%@'", [keyValue description]]]; + [deleteQuery appendFormat:@"'%@'", [keyValue description]]; // Split deletion query into 256k chunks if([deleteQuery length] > 256000) { @@ -2251,10 +2251,10 @@ if (firstCellOutput) [queryString appendString:@", "]; else firstCellOutput = YES; - [queryString appendString:[NSString stringWithFormat:@"%@ = %@", - [[NSArrayObjectAtIndex(dataColumns, i) objectForKey:@"name"] backtickQuotedString], [fieldValues objectAtIndex:i]]]; + [queryString appendFormat:@"%@ = %@", + [[NSArrayObjectAtIndex(dataColumns, i) objectForKey:@"name"] backtickQuotedString], [fieldValues objectAtIndex:i]]; } - [queryString appendString:[NSString stringWithFormat:@" WHERE %@", [self argumentForRow:-2]]]; + [queryString appendFormat:@" WHERE %@", [self argumentForRow:-2]]; } // If UTF-8 via Latin1 view encoding is set convert the queryString into Latin1 and @@ -2461,13 +2461,13 @@ } if ([tempValue isNSNull]) { - [argument appendString:[NSString stringWithFormat:@"%@ IS NULL", [NSArrayObjectAtIndex(keys, i) backtickQuotedString]]]; + [argument appendFormat:@"%@ IS NULL", [NSArrayObjectAtIndex(keys, i) backtickQuotedString]]; } else if ([tempValue isSPNotLoaded]) { NSLog(@"Exceptional case: SPNotLoaded object found for method “argumentForRow:”!"); return @""; } - else { + else { // If the field is of type BIT then it needs a binary prefix if ([[[tableDataInstance columnWithName:NSArrayObjectAtIndex(keys, i)] objectForKey:@"type"] isEqualToString:@"BIT"]) { [value setString:[NSString stringWithFormat:@"b'%@'", [mySQLConnection prepareString:tempValue]]]; @@ -2478,7 +2478,7 @@ else [value setString:[NSString stringWithFormat:@"'%@'", [mySQLConnection prepareString:tempValue]]]; - [argument appendString:[NSString stringWithFormat:@"%@ = %@", [NSArrayObjectAtIndex(keys, i) backtickQuotedString], value]]; + [argument appendFormat:@"%@ = %@", [NSArrayObjectAtIndex(keys, i) backtickQuotedString], value]; } } |