Permalink
Browse files

previous commit continued

  • Loading branch information...
dmoagx committed Jan 20, 2018
1 parent 24ccb6b commit 42e6f7ecc66fe97f4a7f623b8b8ba60dfcaded70
Showing with 22 additions and 20 deletions.
  1. +0 −2 Source/SPDataImport.h
  2. +21 −17 Source/SPDataImport.m
  3. +1 −1 Source/SPFieldMapperController.m
View
@@ -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;
View
@@ -91,7 +91,6 @@ - (id)init
insertRemainingRowsAfterUpdate = NO;
numberOfImportDataColumns = 0;
selectedTableTarget = nil;
targetTableDetails = nil;
prefs = nil;
lastFilename = nil;
@@ -1286,6 +1285,7 @@ - (BOOL) buildFieldMappingArrayWithData:(NSArray *)importData isPreview:(BOOL)da
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 @@ - (BOOL) buildFieldMappingArrayWithData:(NSArray *)importData isPreview:(BOOL)da
}
// 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 @@ - (BOOL) buildFieldMappingArrayWithData:(NSArray *)importData isPreview:(BOOL)da
// 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 @@ - (BOOL) buildFieldMappingArrayWithData:(NSArray *)importData isPreview:(BOOL)da
[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;
@@ -70,7 +70,7 @@ - (id)initWithDelegate:(id)managerDelegate
fieldMappingCurrentRow = 0;
if(managerDelegate == nil) {
NSBeep();
NSLog(@"FieldMapperController was called without a delegate.");
NSLog(@"SPFieldMapperController was called without a delegate.");
return nil;
}
theDelegate = managerDelegate;

0 comments on commit 42e6f7e

Please sign in to comment.