From f683094590e4a95eb047893584493ed7b32e2a02 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Fri, 5 Nov 2010 20:49:16 +0000 Subject: =?UTF-8?q?=E2=80=A2=C2=A0fixed=20table=20structure=20logic=20for?= =?UTF-8?q?=20date/time=20fields=20-=20fixes=20issue=20886?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPTableStructureDelegate.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Source/SPTableStructureDelegate.m') diff --git a/Source/SPTableStructureDelegate.m b/Source/SPTableStructureDelegate.m index 049e2507..d63064e2 100644 --- a/Source/SPTableStructureDelegate.m +++ b/Source/SPTableStructureDelegate.m @@ -154,7 +154,10 @@ if(anObject && [(NSString*)anObject length] && ![(NSString*)anObject hasPrefix:@"--"]) { [currentRow setObject:[(NSString*)anObject uppercaseString] forKey:@"type"]; // If type is BLOB or TEXT reset DEFAULT since these field types don't allow a default - if([[currentRow objectForKey:@"type"] hasSuffix:@"TEXT"] || [[currentRow objectForKey:@"type"] hasSuffix:@"BLOB"] || [fieldValidation isFieldTypeGeometry:[currentRow objectForKey:@"type"]]) { + if([[currentRow objectForKey:@"type"] hasSuffix:@"TEXT"] + || [[currentRow objectForKey:@"type"] hasSuffix:@"BLOB"] + || [fieldValidation isFieldTypeGeometry:[currentRow objectForKey:@"type"]] + || ([fieldValidation isFieldTypeDate:[currentRow objectForKey:@"type"]] && ![[currentRow objectForKey:@"type"] isEqualToString:@"YEAR"])) { [currentRow setObject:@"" forKey:@"default"]; [currentRow setObject:@"" forKey:@"length"]; } @@ -520,7 +523,7 @@ } // TEXT, BLOB, date, and GEOMETRY fields don't allow a length else if([[aTableColumn identifier] isEqualToString:@"length"]) { - [aCell setEnabled:([theRowType hasSuffix:@"TEXT"] || [theRowType hasSuffix:@"BLOB"] || [fieldValidation isFieldTypeDate:theRowType] || [fieldValidation isFieldTypeGeometry:theRowType]) ? NO : YES]; + [aCell setEnabled:([theRowType hasSuffix:@"TEXT"] || [theRowType hasSuffix:@"BLOB"] || ([fieldValidation isFieldTypeDate:theRowType] && ![theRowType isEqualToString:@"YEAR"]) || [fieldValidation isFieldTypeGeometry:theRowType]) ? NO : YES]; } else { [aCell setEnabled:YES]; -- cgit v1.2.3