From db2d9565c996e206d82a441cfd8e60627f0eab6d Mon Sep 17 00:00:00 2001 From: Bibiko Date: Mon, 22 Mar 2010 14:56:05 +0000 Subject: =?UTF-8?q?=E2=80=A2=20CSV=20Import=20-=20if=20a=20parsed=20row=20?= =?UTF-8?q?in=20the=20csv=20file=20doesn't=20have=20the=20same=20number=20?= =?UTF-8?q?of=20columns=20as=20the=20first=20row=20fill=20the=20missing=20?= =?UTF-8?q?columns=20with=20SPNotLoaded=20to=20allow=20while=20importing?= =?UTF-8?q?=20that=20these=20missing=20data=20can=20be=20replaced=20by=20t?= =?UTF-8?q?he=20table=20column's=20DEFAULT=20value=20-=20fixed=20tiny=20is?= =?UTF-8?q?sue=20for=20field=20mapper=20sheet=20to=20display=20the=20corre?= =?UTF-8?q?ct=20tooltip=20for=20default=20values=20=E2=80=A2=20SPTableData?= =?UTF-8?q?=20-=20ATTENTION:=20changed=20the=20object=20for=20returned=20k?= =?UTF-8?q?ey=20'default':=20if=20its=20value=20is=20NULL=20now=20it=20ret?= =?UTF-8?q?urns=20a=20[NSNull=20null]=20object=20-=20changed=20instances?= =?UTF-8?q?=20to=20handle=20this=20=20[NSNull=20null]=20object=20(must=20b?= =?UTF-8?q?e=20checked)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPTableData.m | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'Source/SPTableData.m') diff --git a/Source/SPTableData.m b/Source/SPTableData.m index 34ab2358..698270fe 100644 --- a/Source/SPTableData.m +++ b/Source/SPTableData.m @@ -749,13 +749,8 @@ } // Select the column default if available - if ([resultRow objectForKey:@"Default"]) { - if ([[resultRow objectForKey:@"Default"] isNSNull]) { - [tableColumn setValue:[NSString stringWithString:[[NSUserDefaults standardUserDefaults] objectForKey:SPNullValue]] forKey:@"default"]; - } else { - [tableColumn setValue:[NSString stringWithString:[resultRow objectForKey:@"Default"]] forKey:@"default"]; - } - } + if ([resultRow objectForKey:@"Default"]) + [tableColumn setObject:[NSString stringWithString:[resultRow objectForKey:@"Default"]] forKey:@"default"]; // Add the column to the list [tableColumns addObject:[NSDictionary dictionaryWithDictionary:tableColumn]]; @@ -1017,7 +1012,10 @@ // Field defaults } else if ([detailString isEqualToString:@"DEFAULT"] && (definitionPartsIndex + 1 < partsArrayLength)) { detailParser = [[SPSQLParser alloc] initWithString:[definitionParts objectAtIndex:definitionPartsIndex+1]]; - [fieldDetails setValue:[detailParser unquotedString] forKey:@"default"]; + if([[detailParser unquotedString] isEqualToString:@"NULL"]) + [fieldDetails setObject:[NSNull null] forKey:@"default"]; + else + [fieldDetails setValue:[detailParser unquotedString] forKey:@"default"]; [detailParser release]; definitionPartsIndex++; -- cgit v1.2.3