diff options
-rw-r--r-- | Frameworks/SPMySQLFramework/Source/SPMySQLResult Categories/Convenience Methods.m | 2 | ||||
-rw-r--r-- | Source/SPFavoriteNode.m | 2 | ||||
-rw-r--r-- | Source/SPFileHandle.m | 4 | ||||
-rw-r--r-- | Source/SPSQLExporter.m | 46 | ||||
-rw-r--r-- | Source/SPTableContent.m | 3 |
5 files changed, 35 insertions, 22 deletions
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLResult Categories/Convenience Methods.m b/Frameworks/SPMySQLFramework/Source/SPMySQLResult Categories/Convenience Methods.m index 2b049264..4d18db18 100644 --- a/Frameworks/SPMySQLFramework/Source/SPMySQLResult Categories/Convenience Methods.m +++ b/Frameworks/SPMySQLFramework/Source/SPMySQLResult Categories/Convenience Methods.m @@ -65,7 +65,7 @@ // Instead of empty arrays, return nil if there are no rows. if (![rowsToReturn count]) return nil; - return rowsToReturn; + return [rowsToReturn autorelease]; } @end diff --git a/Source/SPFavoriteNode.m b/Source/SPFavoriteNode.m index 51a9d1aa..f8eb1745 100644 --- a/Source/SPFavoriteNode.m +++ b/Source/SPFavoriteNode.m @@ -38,7 +38,7 @@ [self setNodeIsGroup:NO]; [self setNodeName:nil]; [self setNodeFavorite:nil]; - [self setNodeChildren:[[NSMutableArray alloc] init]]; + [self setNodeChildren:[NSMutableArray array]]; } return self; diff --git a/Source/SPFileHandle.m b/Source/SPFileHandle.m index 3701fc8c..94c26211 100644 --- a/Source/SPFileHandle.m +++ b/Source/SPFileHandle.m @@ -414,7 +414,7 @@ } // Copy the data into a local buffer - NSData *dataToBeWritten = [NSData dataWithData:buffer]; + NSData *dataToBeWritten = [buffer copy]; [buffer setLength:0]; bufferDataLength = 0; pthread_mutex_unlock(&bufferLock); @@ -453,6 +453,8 @@ allDataWritten = YES; } pthread_mutex_unlock(&bufferLock); + + [dataToBeWritten release]; } [writePool drain]; diff --git a/Source/SPSQLExporter.m b/Source/SPSQLExporter.m index 286abc22..907360ea 100644 --- a/Source/SPSQLExporter.m +++ b/Source/SPSQLExporter.m @@ -108,7 +108,6 @@ NSMutableArray *funcs = [NSMutableArray array]; NSMutableString *metaString = [NSMutableString string]; - NSMutableString *cellValue = [NSMutableString string]; NSMutableString *errors = [[NSMutableString alloc] init]; NSMutableString *sqlString = [[NSMutableString alloc] init]; @@ -287,6 +286,8 @@ { // Check for cancellation flag if ([self isCancelled]) { + [errors release]; + [sqlString release]; [pool release]; return; } @@ -345,51 +346,58 @@ [streamingResult cancelResultLoad]; [streamingResult release]; [sqlExportPool release]; + [errors release]; + [sqlString release]; [pool release]; - + return; } - + j++; k++; - + [sqlString setString:@""]; - - // Update the progress + + // Update the progress NSUInteger progress = (NSUInteger)(j * ([self exportMaxProgress] / rowCount)); - + if (progress > lastProgressValue) { [self setExportProgressValue:progress]; lastProgressValue = progress; - + // Inform the delegate that the export's progress has been updated [delegate performSelectorOnMainThread:@selector(sqlExportProcessProgressUpdated:) withObject:self waitUntilDone:NO]; } - - for (t = 0; t < colCount; t++) + + for (t = 0; t < colCount; t++) { // Check for cancellation flag if ([self isCancelled]) { + [connection cancelCurrentQuery]; + [streamingResult cancelResultLoad]; + [streamingResult release]; [sqlExportPool release]; + [errors release]; + [sqlString release]; [pool release]; - + return; } - + id object = NSArrayObjectAtIndex(row, t); - + // Add NULL values directly to the output row; use a pointer comparison to the singleton // instance for speed. if (object == [NSNull null]) { [sqlString appendString:@"NULL"]; - } + } // If the field is off type BIT, the values need a binary prefix of b'x'. else if ([[NSArrayObjectAtIndex([tableDetails objectForKey:@"columns"], t) objectForKey:@"type"] isEqualToString:@"BIT"]) { [sqlString appendFormat:@"b'%@'", [object description]]; } // Add data types directly as hex data else if ([object isKindOfClass:[NSData class]]) { - + if ([self sqlOutputEncodeBLOBasHex]) { [sqlString appendString:[connection escapeAndQuoteData:object]]; } @@ -415,19 +423,18 @@ [sqlString appendString:[connection escapeAndQuoteData:[object data]]]; } else { - [cellValue setString:[object description]]; // Add empty strings as a pair of quotes - if ([cellValue length] == 0) { + if ([object length] == 0) { [sqlString appendString:@"''"]; } else { if ([NSArrayObjectAtIndex(tableColumnNumericStatus, t) boolValue]) { - [sqlString appendString:cellValue]; + [sqlString appendString:object]; } // Otherwise add a quoted string with special characters escaped else { - [sqlString appendString:[connection escapeAndQuoteString:cellValue]]; + [sqlString appendString:[connection escapeAndQuoteString:object]]; } } } @@ -874,6 +881,7 @@ [sqlDatabaseName release], sqlDatabaseName = nil; [sqlExportCurrentTable release], sqlExportCurrentTable = nil; [sqlDatabaseVersion release], sqlDatabaseVersion = nil; + [sqlExportErrors release], sqlExportErrors = nil; [super dealloc]; } diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index bb86ab15..29064a5e 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -4418,6 +4418,9 @@ [dataColumns release]; [oldRow release]; #ifndef SP_REFACTOR + for (id retainedObject in nibObjectsToRelease) [retainedObject release]; + [nibObjectsToRelease release]; + [filterTableData release]; if (lastEditedFilterTableValue) [lastEditedFilterTableValue release]; if (filterTableDefaultOperator) [filterTableDefaultOperator release]; |