diff options
author | Max <post@wickenrode.com> | 2018-01-20 06:51:43 +0100 |
---|---|---|
committer | Max <post@wickenrode.com> | 2018-01-20 06:51:43 +0100 |
commit | 42e6f7ecc66fe97f4a7f623b8b8ba60dfcaded70 (patch) | |
tree | bab70669649543698a50fae1d83c30c84daf7a6e | |
parent | 24ccb6bd602f4d362ab6d47f2dfe8edc2acebbcf (diff) | |
download | sequelpro-42e6f7ecc66fe97f4a7f623b8b8ba60dfcaded70.tar.gz sequelpro-42e6f7ecc66fe97f4a7f623b8b8ba60dfcaded70.tar.bz2 sequelpro-42e6f7ecc66fe97f4a7f623b8b8ba60dfcaded70.zip |
previous commit continued
-rw-r--r-- | Source/SPDataImport.h | 2 | ||||
-rw-r--r-- | Source/SPDataImport.m | 38 | ||||
-rw-r--r-- | Source/SPFieldMapperController.m | 2 |
3 files changed, 22 insertions, 20 deletions
diff --git a/Source/SPDataImport.h b/Source/SPDataImport.h index 40eacd03..545e02ff 100644 --- a/Source/SPDataImport.h +++ b/Source/SPDataImport.h @@ -88,7 +88,6 @@ typedef enum { NSMutableArray *nibObjectsToRelease; // Field Mapper Controller - SPFieldMapperController *fieldMapperController; NSArray *fieldMappingImportArray; BOOL fieldMappingImportArrayIsPreview; NSArray *fieldMappingTableColumnNames; @@ -114,7 +113,6 @@ typedef enum { BOOL progressCancelled; BOOL _mainNibLoaded; - NSDictionary *targetTableDetails; NSMutableArray *geometryFields; NSMutableIndexSet *geometryFieldsMapIndex; NSMutableArray *bitFields; diff --git a/Source/SPDataImport.m b/Source/SPDataImport.m index 9bd2246b..629dde25 100644 --- a/Source/SPDataImport.m +++ b/Source/SPDataImport.m @@ -91,7 +91,6 @@ insertRemainingRowsAfterUpdate = NO; numberOfImportDataColumns = 0; selectedTableTarget = nil; - targetTableDetails = nil; prefs = nil; lastFilename = nil; @@ -1286,6 +1285,7 @@ fieldMappingArrayHasGlobalVariables = NO; //the field mapper is an UI object and must not be caught in the background thread's autoreleasepool + __block SPFieldMapperController *fieldMapperController = nil; dispatch_async(dispatch_get_main_queue(), ^{ // Init the field mapper controller fieldMapperController = [[SPFieldMapperController alloc] initWithDelegate:self]; @@ -1315,19 +1315,21 @@ } // Get mapping settings and preset some global variables - fieldMapperOperator = [[NSArray arrayWithArray:[fieldMapperController fieldMapperOperator]] retain]; - fieldMappingArray = [[NSArray arrayWithArray:[fieldMapperController fieldMappingArray]] retain]; - selectedTableTarget = [[NSString stringWithString:[fieldMapperController selectedTableTarget]] retain]; - selectedImportMethod = [NSString stringWithString:[fieldMapperController selectedImportMethod]]; - fieldMappingTableColumnNames = [[NSArray arrayWithArray:[fieldMapperController fieldMappingTableColumnNames]] retain]; - fieldMappingGlobalValueArray = [[NSArray arrayWithArray:[fieldMapperController fieldMappingGlobalValueArray]] retain]; - fieldMappingTableDefaultValues = [[NSArray arrayWithArray:[fieldMapperController fieldMappingTableDefaultValues]] retain]; - csvImportHeaderString = [[NSString stringWithString:[fieldMapperController importHeaderString]] retain]; - csvImportTailString = [[NSString stringWithString:[fieldMapperController onupdateString]] retain]; - importIntoNewTable = [fieldMapperController importIntoNewTable]; - fieldMappingArrayHasGlobalVariables = [fieldMapperController globalValuesInUsage]; + SPMainQSync(^{ + fieldMapperOperator = [[NSArray arrayWithArray:[fieldMapperController fieldMapperOperator]] retain]; + fieldMappingArray = [[NSArray arrayWithArray:[fieldMapperController fieldMappingArray]] retain]; + selectedTableTarget = [[NSString stringWithString:[fieldMapperController selectedTableTarget]] retain]; + selectedImportMethod = [[NSString stringWithString:[fieldMapperController selectedImportMethod]] retain]; + fieldMappingTableColumnNames = [[NSArray arrayWithArray:[fieldMapperController fieldMappingTableColumnNames]] retain]; + fieldMappingGlobalValueArray = [[NSArray arrayWithArray:[fieldMapperController fieldMappingGlobalValueArray]] retain]; + fieldMappingTableDefaultValues = [[NSArray arrayWithArray:[fieldMapperController fieldMappingTableDefaultValues]] retain]; + csvImportHeaderString = [[NSString stringWithString:[fieldMapperController importHeaderString]] retain]; + csvImportTailString = [[NSString stringWithString:[fieldMapperController onupdateString]] retain]; + importIntoNewTable = [fieldMapperController importIntoNewTable]; + fieldMappingArrayHasGlobalVariables = [fieldMapperController globalValuesInUsage]; + insertRemainingRowsAfterUpdate = [fieldMapperController insertRemainingRowsAfterUpdate]; + }); csvImportMethodHasTail = ([csvImportTailString length] == 0) ? NO : YES; - insertRemainingRowsAfterUpdate = [fieldMapperController insertRemainingRowsAfterUpdate]; importMethodIsUpdate = ([selectedImportMethod isEqualToString:@"UPDATE"]) ? YES : NO; // Error checking @@ -1344,7 +1346,7 @@ // Store target table definitions SPTableData *selectedTableData = [[SPTableData alloc] init]; [selectedTableData setConnection:mySQLConnection]; - targetTableDetails = [selectedTableData informationForTable:selectedTableTarget]; + NSDictionary *targetTableDetails = [selectedTableData informationForTable:selectedTableTarget]; [selectedTableData release]; // Store all field names which are of typegrouping 'geometry' and 'bit', and check if @@ -1358,13 +1360,15 @@ [nullableNumericFields addObject:[field objectForKey:@"name"]]; } - [importFieldNamesSwitch setState:[fieldMapperController importFieldNamesHeader]]; - [prefs setBool:[importFieldNamesSwitch state] forKey:SPCSVImportFirstLineIsHeader]; + SPMainQSync(^{ + [importFieldNamesSwitch setState:[fieldMapperController importFieldNamesHeader]]; + [prefs setBool:[importFieldNamesSwitch state] forKey:SPCSVImportFirstLineIsHeader]; + }); success = YES; cleanup: dispatch_async(dispatch_get_main_queue(), ^{ - if(fieldMapperController) SPClear(fieldMapperController); + [fieldMapperController release]; }); return success; diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m index 4dbf8aa9..a93b1d3c 100644 --- a/Source/SPFieldMapperController.m +++ b/Source/SPFieldMapperController.m @@ -70,7 +70,7 @@ static NSUInteger SPSourceColumnTypeInteger = 1; fieldMappingCurrentRow = 0; if(managerDelegate == nil) { NSBeep(); - NSLog(@"FieldMapperController was called without a delegate."); + NSLog(@"SPFieldMapperController was called without a delegate."); return nil; } theDelegate = managerDelegate; |