aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableDump.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-12-02 01:42:01 +0000
committerrowanbeentje <rowan@beent.je>2009-12-02 01:42:01 +0000
commite80643e92666c6752940f791f3148fcfefe9bb4e (patch)
tree35dca18ba28944b52c051abda655a9306e93ef79 /Source/TableDump.m
parent65778099b6b5084bf9d2e7a6bbefa42b6f303f68 (diff)
downloadsequelpro-e80643e92666c6752940f791f3148fcfefe9bb4e.tar.gz
sequelpro-e80643e92666c6752940f791f3148fcfefe9bb4e.tar.bz2
sequelpro-e80643e92666c6752940f791f3148fcfefe9bb4e.zip
- Correctly construct queries where the first column of CSV imports are set to "Do not import"
Diffstat (limited to 'Source/TableDump.m')
-rw-r--r--Source/TableDump.m5
1 files changed, 4 insertions, 1 deletions
diff --git a/Source/TableDump.m b/Source/TableDump.m
index 222612b5..50bba928 100644
--- a/Source/TableDump.m
+++ b/Source/TableDump.m
@@ -795,6 +795,7 @@
NSInteger dataBufferLastQueryEndPosition = 0;
int i;
BOOL allDataRead = NO;
+ BOOL insertBaseStringHasEntries;
NSStringEncoding csvEncoding = [MCPConnection encodingForMySQLEncoding:[[tableDocumentInstance connectionEncoding] UTF8String]];
if (fieldMappingArray) [fieldMappingArray release], fieldMappingArray = nil;
@@ -970,9 +971,11 @@
[insertBaseString appendString:@"INSERT INTO "];
[insertBaseString appendString:[[fieldMappingPopup titleOfSelectedItem] backtickQuotedString]];
[insertBaseString appendString:@" ("];
+ insertBaseStringHasEntries = NO;
for (i = 0; i < [fieldMappingArray count]; i++) {
if ([NSArrayObjectAtIndex(fieldMappingArray, i) intValue] > 0) {
- if (i > 0) [insertBaseString appendString:@","];
+ if (insertBaseStringHasEntries) [insertBaseString appendString:@","];
+ else insertBaseStringHasEntries = YES;
[insertBaseString appendString:[NSArrayObjectAtIndex(fieldMappingTableColumnNames, i) backtickQuotedString]];
}
}