diff options
author | Max <post@wickenrode.com> | 2017-01-27 22:23:57 +0100 |
---|---|---|
committer | Max <post@wickenrode.com> | 2017-01-27 22:23:57 +0100 |
commit | bd75d9a98c695689eedc26b28d68dd6a9d7008b4 (patch) | |
tree | 6f536035c6e70433642c3dca73c00175a7b2fd4f /Source | |
parent | a13b067a5357084b3a7db5472d0e3fec6a26a4cb (diff) | |
download | sequelpro-bd75d9a98c695689eedc26b28d68dd6a9d7008b4.tar.gz sequelpro-bd75d9a98c695689eedc26b28d68dd6a9d7008b4.tar.bz2 sequelpro-bd75d9a98c695689eedc26b28d68dd6a9d7008b4.zip |
Restrict some variables to their actual usage scope
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPSQLExporter.m | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/Source/SPSQLExporter.m b/Source/SPSQLExporter.m index e826c36d..cb085e39 100644 --- a/Source/SPSQLExporter.m +++ b/Source/SPSQLExporter.m @@ -90,16 +90,13 @@ [sqlTableDataInstance setConnection:connection]; SPMySQLResult *queryResult; - SPMySQLStreamingResult *streamingResult; - NSArray *row; NSString *tableName; NSDictionary *tableDetails; - BOOL *useRawDataForColumnAtIndex, *useRawHexDataForColumnAtIndex; SPTableType tableType = SPTableTypeTable; id createTableSyntax = nil; - NSUInteger j, t, s, rowCount, queryLength, lastProgressValue, cleanAutoReleasePool = NO; + NSUInteger j, s; BOOL sqlOutputIncludeStructure; BOOL sqlOutputIncludeContent; @@ -232,7 +229,7 @@ // Inform the delegate that we are about to start fetcihing data for the current table [delegate performSelectorOnMainThread:@selector(sqlExportProcessWillBeginFetchingData:) withObject:self waitUntilDone:NO]; - lastProgressValue = 0; + NSUInteger lastProgressValue = 0; // Add the name of table [self writeString:[NSString stringWithFormat:@"# %@ %@\n# ------------------------------------------------------------\n\n", NSLocalizedString(@"Dump of table", @"sql export dump of table label"), tableName]]; @@ -297,8 +294,8 @@ NSMutableArray *rawColumnNames = [NSMutableArray arrayWithCapacity:colCount]; NSMutableArray *queryColumnDetails = [NSMutableArray arrayWithCapacity:colCount]; - useRawDataForColumnAtIndex = calloc(colCount, sizeof(BOOL)); - useRawHexDataForColumnAtIndex = calloc(colCount, sizeof(BOOL)); + BOOL *useRawDataForColumnAtIndex = calloc(colCount, sizeof(BOOL)); + BOOL *useRawHexDataForColumnAtIndex = calloc(colCount, sizeof(BOOL)); // Determine whether raw data can be used for each column during processing - safe numbers and hex-encoded data. for (j = 0; j < colCount; j++) @@ -347,17 +344,17 @@ continue; } - rowCount = [NSArrayObjectAtIndex(rowArray, 0) integerValue]; + NSUInteger rowCount = [NSArrayObjectAtIndex(rowArray, 0) integerValue]; if (rowCount) { // Set up a result set in streaming mode - streamingResult = [[connection streamingQueryString:[NSString stringWithFormat:@"SELECT %@ FROM %@", [queryColumnDetails componentsJoinedByString:@", "], [tableName backtickQuotedString]] useLowMemoryBlockingStreaming:([self exportUsingLowMemoryBlockingStreaming])] retain]; + SPMySQLStreamingResult *streamingResult = [[connection streamingQueryString:[NSString stringWithFormat:@"SELECT %@ FROM %@", [queryColumnDetails componentsJoinedByString:@", "], [tableName backtickQuotedString]] useLowMemoryBlockingStreaming:([self exportUsingLowMemoryBlockingStreaming])] retain]; // 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; + NSUInteger queryLength = 0; // Lock the table for writing and disable keys if supported [metaString setString:@""]; @@ -371,13 +368,15 @@ // Iterate through the rows to construct a VALUES group for each NSUInteger rowsWrittenForTable = 0; NSUInteger rowsWrittenForCurrentStmt = 0; + BOOL cleanAutoReleasePool = NO; NSAutoreleasePool *sqlExportPool = [[NSAutoreleasePool alloc] init]; // Inform the delegate that we are about to start writing the data to disk [delegate performSelectorOnMainThread:@selector(sqlExportProcessWillBeginWritingData:) withObject:self waitUntilDone:NO]; - while ((row = [streamingResult getRowAsArray])) + NSArray *row; + while ((row = [streamingResult getRowAsArray])) { // Check for cancellation flag if ([self isCancelled]) { @@ -428,7 +427,7 @@ [sqlString setString:@",\n\t("]; } - for (t = 0; t < colCount; t++) + for (NSUInteger t = 0; t < colCount; t++) { id object = NSArrayObjectAtIndex(row, t); |