From 2dbae24c7735ead0524bd9847af6ea99d8654ec6 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Sat, 14 May 2011 17:26:18 +0000 Subject: Bring outline view branch up to date with trunk (r3279:r3306). --- Source/SPSQLExporter.m | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'Source/SPSQLExporter.m') diff --git a/Source/SPSQLExporter.m b/Source/SPSQLExporter.m index 3dfed305..4c7903fc 100644 --- a/Source/SPSQLExporter.m +++ b/Source/SPSQLExporter.m @@ -302,15 +302,16 @@ rowCount = [NSArrayObjectAtIndex(rowArray, 0) integerValue]; - // Set up a result set in streaming mode - streamingResult = [[connection streamingQueryString:[NSString stringWithFormat:@"SELECT * FROM %@", [tableName backtickQuotedString]] useLowMemoryBlockingStreaming:([self exportUsingLowMemoryBlockingStreaming])] retain]; - - NSArray *fieldNames = [streamingResult fetchFieldNames]; - - // Inform the delegate that we are about to start writing data for the current table - [delegate performSelectorOnMainThread:@selector(sqlExportProcessWillBeginWritingData:) withObject:self waitUntilDone:NO]; - if (rowCount) { + + // Set up a result set in streaming mode + streamingResult = [[connection streamingQueryString:[NSString stringWithFormat:@"SELECT * FROM %@", [tableName backtickQuotedString]] useLowMemoryBlockingStreaming:([self exportUsingLowMemoryBlockingStreaming])] retain]; + + NSArray *fieldNames = [streamingResult fetchFieldNames]; + + // Inform the delegate that we are about to start writing data for the current table + [delegate performSelectorOnMainThread:@selector(sqlExportProcessWillBeginWritingData:) withObject:self waitUntilDone:NO]; + queryLength = 0; // Lock the table for writing and disable keys if supported @@ -474,6 +475,9 @@ // Drain the autorelease pool [sqlExportPool release]; + + // Release the result set + [streamingResult release]; } if ([connection queryErrored]) { @@ -484,9 +488,6 @@ dataUsingEncoding:NSUTF8StringEncoding]]; } } - - // Release the result set - [streamingResult release]; } queryResult = [connection queryString:[NSString stringWithFormat:@"/*!50003 SHOW TRIGGERS WHERE `Table` = %@ */;", [tableName tickQuotedString]]]; -- cgit v1.2.3