From e80643e92666c6752940f791f3148fcfefe9bb4e Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Wed, 2 Dec 2009 01:42:01 +0000 Subject: - Correctly construct queries where the first column of CSV imports are set to "Do not import" --- Source/TableDump.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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]]; } } -- cgit v1.2.3