aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPFieldMapperController.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-03-22 14:56:05 +0000
committerBibiko <bibiko@eva.mpg.de>2010-03-22 14:56:05 +0000
commitdb2d9565c996e206d82a441cfd8e60627f0eab6d (patch)
treecddd29b39dfaac95062a9412f4a70786f1205171 /Source/SPFieldMapperController.m
parentf4e32dd6a24793454e0af44a4429cdd9ca737724 (diff)
downloadsequelpro-db2d9565c996e206d82a441cfd8e60627f0eab6d.tar.gz
sequelpro-db2d9565c996e206d82a441cfd8e60627f0eab6d.tar.bz2
sequelpro-db2d9565c996e206d82a441cfd8e60627f0eab6d.zip
• CSV Import
- if a parsed row in the csv file doesn't have the same number of columns as the first row fill the missing columns with SPNotLoaded to allow while importing that these missing data can be replaced by the table column's DEFAULT value - fixed tiny issue for field mapper sheet to display the correct tooltip for default values • SPTableData - ATTENTION: changed the object for returned key 'default': if its value is NULL now it returns a [NSNull null] object - changed instances to handle this [NSNull null] object (must be checked)
Diffstat (limited to 'Source/SPFieldMapperController.m')
-rw-r--r--Source/SPFieldMapperController.m21
1 files changed, 13 insertions, 8 deletions
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m
index c8f2c90b..a269f75e 100644
--- a/Source/SPFieldMapperController.m
+++ b/Source/SPFieldMapperController.m
@@ -30,6 +30,7 @@
#import "SPArrayAdditions.h"
#import "SPStringAdditions.h"
#import "SPConstants.h"
+#import "SPNotLoaded.h"
@implementation SPFieldMapperController
@@ -345,13 +346,14 @@
[type appendFormat:@",%@",@"UNIQUE"];
isReplacePossible = YES;
}
- if([[[column objectForKey:@"onupdatetimestamp"] description] isEqualToString:@"1"])
- [fieldMappingTableDefaultValues addObject:@"time_stamp"];
+ // if([[[column objectForKey:@"onupdatetimestamp"] description] isEqualToString:@"1"]) {
+ // [fieldMappingTableDefaultValues addObject:@"CURRENT_TIMESTAMP"];
+ // } else {
+ if ([column objectForKey:@"default"])
+ [fieldMappingTableDefaultValues addObject:[column objectForKey:@"default"]];
else
- if ([column objectForKey:@"default"])
- [fieldMappingTableDefaultValues addObject:[column objectForKey:@"default"]];
- else
- [fieldMappingTableDefaultValues addObject:[NSNull null]];
+ [fieldMappingTableDefaultValues addObject:[NSNull null]];
+ // }
}
[fieldMappingTableTypes addObject:[NSString stringWithString:type]];
@@ -838,6 +840,8 @@
for (i = 0; i < [fieldMappingButtonOptions count]; i++) {
if ([[fieldMappingButtonOptions objectAtIndex:i] isNSNull])
[fieldMappingButtonOptions replaceObjectAtIndex:i withObject:[NSString stringWithFormat:@"%i. <%@>", i+1, [prefs objectForKey:SPNullValue]]];
+ else if ([[fieldMappingButtonOptions objectAtIndex:i] isSPNotLoaded])
+ [fieldMappingButtonOptions replaceObjectAtIndex:i withObject:[NSString stringWithFormat:@"%i. <%@>", i+1, @"DEFAULT"]];
else
[fieldMappingButtonOptions replaceObjectAtIndex:i withObject:[NSString stringWithFormat:@"%i. %@", i+1, NSArrayObjectAtIndex(fieldMappingButtonOptions, i)]];
}
@@ -950,9 +954,10 @@
{
if(aTableView == fieldMapperTableView) {
- if([[aTableColumn identifier] isEqualToString:@"import_value"] && [importFieldNamesHeaderSwitch state] == NSOnState) {
- if ([fieldMappingOperatorArray objectAtIndex:rowIndex] == doNotImport) return [NSString stringWithFormat:@"DEFAULT: %@", [fieldMappingTableDefaultValues objectAtIndex:rowIndex]];
+ if ([fieldMappingOperatorArray objectAtIndex:rowIndex] == doNotImport) return [NSString stringWithFormat:@"DEFAULT: %@", [fieldMappingTableDefaultValues objectAtIndex:rowIndex]];
+
+ if([[aTableColumn identifier] isEqualToString:@"import_value"] && [importFieldNamesHeaderSwitch state] == NSOnState) {
if([NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue]>=[NSArrayObjectAtIndex(fieldMappingImportArray, 0) count])
return [NSString stringWithFormat:@"%@: %@", NSLocalizedString(@"Global value", @"global value"), NSArrayObjectAtIndex(fieldMappingGlobalValues, [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue])];