diff options
author | stuconnolly <stuart02@gmail.com> | 2010-05-27 22:30:44 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2010-05-27 22:30:44 +0000 |
commit | 417b151533528e0b43c3cdea72e89bec6207b0f7 (patch) | |
tree | 3bc0db57eb6f1bb1b913d1b65992a2163b95e85e | |
parent | 31ea7d44be9602679c57e0209689c261409aa384 (diff) | |
download | sequelpro-417b151533528e0b43c3cdea72e89bec6207b0f7.tar.gz sequelpro-417b151533528e0b43c3cdea72e89bec6207b0f7.tar.bz2 sequelpro-417b151533528e0b43c3cdea72e89bec6207b0f7.zip |
Remove multiple occurrences of accessing the same array element, improving the overall performance of SQL dumps.
-rw-r--r-- | Source/SPSQLExporter.m | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Source/SPSQLExporter.m b/Source/SPSQLExporter.m index 4591325a..eda13741 100644 --- a/Source/SPSQLExporter.m +++ b/Source/SPSQLExporter.m @@ -355,24 +355,26 @@ return; } + id object = NSArrayObjectAtIndex(row, t); + // Add NULL values directly to the output row - if ([NSArrayObjectAtIndex(row, t) isMemberOfClass:[NSNull class]]) { + if ([object isMemberOfClass:[NSNull class]]) { [sqlString appendString:@"NULL"]; } // Add data types directly as hex data - else if ([NSArrayObjectAtIndex(row, t) isKindOfClass:[NSData class]]) { + else if ([object isKindOfClass:[NSData class]]) { if ([self sqlOutputEncodeBLOBasHex]) { [sqlString appendString:@"X'"]; - [sqlString appendString:[connection prepareBinaryData:NSArrayObjectAtIndex(row, t)]]; + [sqlString appendString:[connection prepareBinaryData:object]]; } else { [sqlString appendString:@"'"]; - NSString *data = [[NSString alloc] initWithData:NSArrayObjectAtIndex(row, t) encoding:[self exportOutputEncoding]]; + NSString *data = [[NSString alloc] initWithData:object encoding:[self exportOutputEncoding]]; if (data == nil) { - data = [[NSString alloc] initWithData:NSArrayObjectAtIndex(row, t) encoding:NSASCIIStringEncoding]; + data = [[NSString alloc] initWithData:object encoding:NSASCIIStringEncoding]; } [sqlString appendString:data]; @@ -383,7 +385,7 @@ [sqlString appendString:@"'"]; } else { - [cellValue setString:[NSArrayObjectAtIndex(row, t) description]]; + [cellValue setString:[object description]]; // Add empty strings as a pair of quotes if ([cellValue length] == 0) { |