From 22ae0fa8c302d22071116abca27d2add3a0af991 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Tue, 16 Feb 2010 11:23:45 +0000 Subject: =?UTF-8?q?=E2=80=A2=20re-factored=20and=20outsourced=20the=20enti?= =?UTF-8?q?re=20CSV=20import=20field=20mapper=20sheet=20-=20changed=20the?= =?UTF-8?q?=20way=20to=20choose=20whether=20a=20source=20field=20should=20?= =?UTF-8?q?be=20imported=20or=20not=20by=20introducing=20a=20new=20table?= =?UTF-8?q?=20column=20'operators'=20-=20clicking=20at=20the=20'operator's?= =?UTF-8?q?=20header=20toggles=20all=20operators=20to=20'Import'=20or=20'D?= =?UTF-8?q?o=20not=20import'=20-=20added=20tooltips=20for=20each=20table?= =?UTF-8?q?=20cell;=20if=20file's=20first=20line=20are=20the=20headers=20s?= =?UTF-8?q?how=20them=20in=20the=20tooltips=20as=20well=20-=20added=20chec?= =?UTF-8?q?kbox=20"First=20line=20contains=20fields=20names"=20since=20it'?= =?UTF-8?q?ll=20be=20clear=20in=20this=20pane=20whether=20a=20file=20has?= =?UTF-8?q?=20a=20header=20line=20or=20not=20(will=20be=20sync=20with=20pr?= =?UTF-8?q?efs)=20-=20added=20the=20possibility=20to=20choose=20the=20impo?= =?UTF-8?q?rt=20method:=20INSERT=20INTO=20or=20REPLACE=20INTO=20=E2=80=A2?= =?UTF-8?q?=20deleted=20all=20old=20field=20mapper=20stuff=20from=20TableD?= =?UTF-8?q?ump=20and=20DBView.xib?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Notes: - tests are needed to be sure that this change does not cause mismatches while importing - symbols for Do (not) import are tendative - maybe use images - a further import method UPDATE plus an operator '=' will be added soon - chance to add a new global source variable will come soon - displaying of source field types will come soon - semi-automatically matching of source field names and header names will come soon - the GUI needs some improvements afterwards --- Source/TableDump.h | 116 +++++++++++++++++++++++++---------------------------- 1 file changed, 54 insertions(+), 62 deletions(-) (limited to 'Source/TableDump.h') diff --git a/Source/TableDump.h b/Source/TableDump.h index 644057b6..001b1778 100644 --- a/Source/TableDump.h +++ b/Source/TableDump.h @@ -44,87 +44,82 @@ typedef enum _SPExportModes { IBOutlet id tableDataInstance; IBOutlet id customQueryInstance; - IBOutlet id tableWindow; - - IBOutlet id exportDumpView; - IBOutlet id exportCSVView; - IBOutlet id exportMultipleCSVView; - IBOutlet id exportMultipleXMLView; - IBOutlet id exportDumpTableView; - IBOutlet id exportMultipleCSVTableView; - IBOutlet id exportMultipleXMLTableView; - IBOutlet id exportFieldNamesSwitch; - IBOutlet id exportFieldsTerminatedField; - IBOutlet id exportFieldsEnclosedField; - IBOutlet id exportFieldsEscapedField; - IBOutlet id exportLinesTerminatedField; - IBOutlet id exportMultipleFieldNamesSwitch; - IBOutlet id exportMultipleFieldsTerminatedField; - IBOutlet id exportMultipleFieldsEnclosedField; - IBOutlet id exportMultipleFieldsEscapedField; - IBOutlet id exportMultipleLinesTerminatedField; - + IBOutlet id tableWindow; + + IBOutlet id exportDumpView; + IBOutlet id exportCSVView; + IBOutlet id exportMultipleCSVView; + IBOutlet id exportMultipleXMLView; + IBOutlet id exportDumpTableView; + IBOutlet id exportMultipleCSVTableView; + IBOutlet id exportMultipleXMLTableView; + IBOutlet id exportFieldNamesSwitch; + IBOutlet id exportFieldsTerminatedField; + IBOutlet id exportFieldsEnclosedField; + IBOutlet id exportFieldsEscapedField; + IBOutlet id exportLinesTerminatedField; + IBOutlet id exportMultipleFieldNamesSwitch; + IBOutlet id exportMultipleFieldsTerminatedField; + IBOutlet id exportMultipleFieldsEnclosedField; + IBOutlet id exportMultipleFieldsEscapedField; + IBOutlet id exportMultipleLinesTerminatedField; + // New Export Window IBOutlet id exportWindow; IBOutlet id exportTabBar; IBOutlet id exportToolbar; IBOutlet id exportTableList; - + IBOutlet id importCSVView; IBOutlet NSPopUpButton *importFormatPopup; IBOutlet id importCSVBox; - IBOutlet id importFieldNamesSwitch; - IBOutlet id importFieldsTerminatedField; - IBOutlet id importFieldsEnclosedField; - IBOutlet id importFieldsEscapedField; - IBOutlet id importLinesTerminatedField; - - IBOutlet id addDropTableSwitch; - IBOutlet id addCreateTableSwitch; - IBOutlet id addTableContentSwitch; - IBOutlet id addErrorsSwitch; - IBOutlet id sqlFullStreamingSwitch; - IBOutlet id csvFullStreamingSwitch; - IBOutlet id multiCSVFullStreamingSwitch; - IBOutlet id multiXMLFullStreamingSwitch; - IBOutlet id errorsSheet; - IBOutlet id errorsView; - IBOutlet id singleProgressSheet; - IBOutlet id singleProgressBar; - IBOutlet id singleProgressTitle; - IBOutlet id singleProgressText; - - IBOutlet id fieldMappingSheet; - IBOutlet id fieldMappingPopup; - IBOutlet id fieldMappingTableView; - - IBOutlet id rowUpButton; - IBOutlet id rowDownButton; - IBOutlet id recordCountLabel; + IBOutlet id importFieldNamesSwitch; + IBOutlet id importFieldsTerminatedField; + IBOutlet id importFieldsEnclosedField; + IBOutlet id importFieldsEscapedField; + IBOutlet id importLinesTerminatedField; + IBOutlet id importFieldMapperSheetWindow; + + IBOutlet id addDropTableSwitch; + IBOutlet id addCreateTableSwitch; + IBOutlet id addTableContentSwitch; + IBOutlet id addErrorsSwitch; + IBOutlet id sqlFullStreamingSwitch; + IBOutlet id csvFullStreamingSwitch; + IBOutlet id multiCSVFullStreamingSwitch; + IBOutlet id multiXMLFullStreamingSwitch; + IBOutlet id errorsSheet; + IBOutlet id errorsView; + IBOutlet id singleProgressSheet; + IBOutlet id singleProgressBar; + IBOutlet id singleProgressTitle; + IBOutlet id singleProgressText; MCPConnection *mySQLConnection; NSMutableArray *tables; + + // Field Mapper Controller + SPFieldMapperController *fieldMapperController; NSArray *fieldMappingImportArray; BOOL fieldMappingImportArrayIsPreview; - NSMutableArray *fieldMappingTableColumnNames; - NSMutableArray *fieldMappingArray; - NSMutableArray *fieldMappingButtonOptions; - NSInteger fieldMappingCurrentRow; + NSArray *fieldMappingTableColumnNames; + NSArray *fieldMappingArray; + NSArray *fieldMapperOperator; + NSString *selectedTableTarget; + NSString *selectedImportMethod; + NSInteger fieldMapperSheetStatus; + NSUInteger exportMode; NSUserDefaults *prefs; BOOL progressCancelled; - - NSInteger fieldMapperSheetStatus; - SPFieldMapperController *fieldMapperController; + } // IBAction methods - (IBAction)reloadTables:(id)sender; - (IBAction)selectTables:(id)sender; - (IBAction)closeSheet:(id)sender; -- (IBAction)closeFieldMapperSheet:(id)sender; -- (IBAction)stepRow:(id)sender; - (IBAction)cancelProgressBar:(id)sender; // Export methods @@ -139,11 +134,8 @@ typedef enum _SPExportModes { - (void)startSQLImportProcessWithFile:(NSString *)filename; - (void)importCSVFile:(NSString *)filename; - (IBAction)changeFormat:(id)sender; -- (IBAction)changeTable:(id)sender; - (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo; -- (BOOL) buildFieldMappingArrayWithData:(NSArray *)importData isPreview:(BOOL)dataIsPreviewData; -- (void)setupFieldMappingArray; -- (void)updateFieldMappingButtonCell; +- (BOOL) buildFieldMappingArrayWithData:(NSArray *)importData isPreview:(BOOL)dataIsPreviewData ofSoureFile:(NSString*)filename; - (NSString *) mappedValueStringForRowArray:(NSArray *)csvRowArray; // Export methods -- cgit v1.2.3