aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/MCPKit
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-08-16 13:22:51 +0000
committerrowanbeentje <rowan@beent.je>2009-08-16 13:22:51 +0000
commitb48d3efeb093dd0075fc7201de779048626ca4b3 (patch)
treeb4982b1862b4ab61277d3be361e1f630951cf4af /Frameworks/MCPKit
parent0cd7f29373fa0db65e1f46ef7423c051712c07f1 (diff)
downloadsequelpro-b48d3efeb093dd0075fc7201de779048626ca4b3.tar.gz
sequelpro-b48d3efeb093dd0075fc7201de779048626ca4b3.tar.bz2
sequelpro-b48d3efeb093dd0075fc7201de779048626ca4b3.zip
- Make result sets 1.5x faster to process by using 10.4+ native stringWithCString:encoding: instead of old NSData-based functions. Speeds up large table loading significantly.
Diffstat (limited to 'Frameworks/MCPKit')
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPResult.m19
1 files changed, 4 insertions, 15 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m b/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m
index f8572613..158d01c8 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m
@@ -451,7 +451,7 @@ const OUR_CHARSET our_charsets60[] =
case FIELD_TYPE_SET:
case FIELD_TYPE_ENUM:
case FIELD_TYPE_NEWDATE: // Don't know what the format for this type is...
- theCurrentObj = [self stringWithCString:theData];
+ theCurrentObj = [NSString stringWithCString:theData encoding:mEncoding];
break;
case FIELD_TYPE_BIT:
@@ -1098,20 +1098,9 @@ const OUR_CHARSET our_charsets60[] =
*/
- (NSString *)stringWithCString:(const char *)theCString
{
- NSData *theData;
- NSString *theString;
-
- if (theCString == NULL) {
- return @"";
- }
-
- theData = [[NSData alloc] initWithBytes:theCString length:(strlen(theCString))];
- theString = [[NSString alloc] initWithData:theData encoding:mEncoding];
-
- if (theData) [theData release];
- if (theString) [theString autorelease];
-
- return theString;
+ if (theCString == NULL) return @"";
+
+ return [NSString stringWithCString:theCString encoding:mEncoding];
}
#pragma mark -