aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDataImport.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2012-01-22 12:19:21 +0000
committerstuconnolly <stuart02@gmail.com>2012-01-22 12:19:21 +0000
commit1d7ed99d602bf9c7aa4ea40a9a2ab6458864e51f (patch)
tree6c08ad29618ea02caf302180706d010c90cd57e0 /Source/SPDataImport.m
parente23ba5155a53c43a106ac9646f51321ccc7d86f4 (diff)
downloadsequelpro-1d7ed99d602bf9c7aa4ea40a9a2ab6458864e51f.tar.gz
sequelpro-1d7ed99d602bf9c7aa4ea40a9a2ab6458864e51f.tar.bz2
sequelpro-1d7ed99d602bf9c7aa4ea40a9a2ab6458864e51f.zip
Bring outlinew view branch up to date with trunk (r3375:3468).
Diffstat (limited to 'Source/SPDataImport.m')
-rw-r--r--Source/SPDataImport.m24
1 files changed, 19 insertions, 5 deletions
diff --git a/Source/SPDataImport.m b/Source/SPDataImport.m
index d1b2b67a..606906f4 100644
--- a/Source/SPDataImport.m
+++ b/Source/SPDataImport.m
@@ -297,6 +297,9 @@
- (void)importFileSheetDidEnd:(id)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
+ // Ensure text inputs are completed, preventing dead character entry
+ [sheet makeFirstResponder:nil];
+
// Save values to preferences
[prefs setObject:[(NSOpenPanel*)sheet directory] forKey:@"openPath"];
[prefs setObject:[[importFormatPopup selectedItem] title] forKey:@"importFormatPopupValue"];
@@ -808,7 +811,12 @@
[csvParser setFieldTerminatorString:[importFieldsTerminatedField stringValue] convertDisplayStrings:YES];
[csvParser setLineTerminatorString:[importLinesTerminatedField stringValue] convertDisplayStrings:YES];
[csvParser setFieldQuoteString:[importFieldsEnclosedField stringValue] convertDisplayStrings:YES];
- [csvParser setEscapeString:[importFieldsEscapedField stringValue] convertDisplayStrings:YES];
+ if ([[importFieldsEscapedField stringValue] isEqualToString:@"\\ or \""]) {
+ [csvParser setEscapeString:@"\\" convertDisplayStrings:NO];
+ } else {
+ [csvParser setEscapeString:[importFieldsEscapedField stringValue] convertDisplayStrings:YES];
+ [csvParser setEscapeStringsAreMatchedStrictly:YES];
+ }
[csvParser setNullReplacementString:[prefs objectForKey:SPNullValue]];
csvDataBuffer = [[NSMutableData alloc] init];
@@ -1245,7 +1253,7 @@
fieldMappingImportArray = [[NSArray alloc] initWithArray:importData];
numberOfImportDataColumns = [[importData objectAtIndex:0] count];
- fieldMapperSheetStatus = 1;
+ fieldMapperSheetStatus = SPFieldMapperInProgress;
fieldMappingArrayHasGlobalVariables = NO;
// Init the field mapper controller
@@ -1264,9 +1272,15 @@
[[[fieldMapperController window] onMainThread] makeKeyWindow];
// Wait for field mapper sheet
- while (fieldMapperSheetStatus == 1)
+ while (fieldMapperSheetStatus == SPFieldMapperInProgress)
usleep(100000);
+ // If the mapping was cancelled, abort the import
+ if (fieldMapperSheetStatus == SPFieldMapperCancelled) {
+ if (fieldMapperController) [fieldMapperController release];
+ return FALSE;
+ }
+
// Get mapping settings and preset some global variables
fieldMapperOperator = [[NSArray arrayWithArray:[fieldMapperController fieldMapperOperator]] retain];
fieldMappingArray = [[NSArray arrayWithArray:[fieldMapperController fieldMappingArray]] retain];
@@ -1317,7 +1331,7 @@
if(fieldMapperController) [fieldMapperController release];
- if(fieldMapperSheetStatus == 2)
+ if(fieldMapperSheetStatus == SPFieldMapperCompleted)
return YES;
else
return NO;
@@ -1329,7 +1343,7 @@
- (void)fieldMapperDidEndSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
{
[sheet orderOut:self];
- fieldMapperSheetStatus = (returnCode) ? 2 : 3;
+ fieldMapperSheetStatus = (returnCode) ? SPFieldMapperCompleted : SPFieldMapperCancelled;
}
/**