aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDataImport.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPDataImport.m')
-rw-r--r--Source/SPDataImport.m14
1 files changed, 9 insertions, 5 deletions
diff --git a/Source/SPDataImport.m b/Source/SPDataImport.m
index 00876c8d..d467e0a1 100644
--- a/Source/SPDataImport.m
+++ b/Source/SPDataImport.m
@@ -902,10 +902,14 @@
[insertBaseString appendString:@","];
else
insertBaseStringHasEntries = YES;
- // Store column index for each geometry field to be able to apply GeomFromText() while importing
- if([geometryFields containsObject:fieldName = NSArrayObjectAtIndex(fieldMappingTableColumnNames, i) ])
- [geometryFieldsMapIndex addIndex:i];
- [insertBaseString appendString:[fieldName backtickQuotedString]];
+ if([geometryFields count]) {
+ // Store column index for each geometry field to be able to apply GeomFromText() while importing
+ if([geometryFields containsObject:fieldName = NSArrayObjectAtIndex(fieldMappingTableColumnNames, i) ])
+ [geometryFieldsMapIndex addIndex:i];
+ [insertBaseString appendString:[fieldName backtickQuotedString]];
+ } else {
+ [insertBaseString appendString:[NSArrayObjectAtIndex(fieldMappingTableColumnNames, i) backtickQuotedString]];
+ }
}
}
[insertBaseString appendString:@") VALUES\n"];
@@ -1353,7 +1357,7 @@
[valueString appendString:@"NULL"];
} else {
// Apply GeomFromText() for each geometry field
- if([geometryFieldsMapIndex containsIndex:i]) {
+ if([geometryFields count] && [geometryFieldsMapIndex containsIndex:i]) {
[valueString appendFormat:@"GeomFromText('%@')", [mySQLConnection prepareString:cellData]];
} else {
[valueString appendFormat:@"'%@'", [mySQLConnection prepareString:cellData]];