aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-11-05 20:49:16 +0000
committerBibiko <bibiko@eva.mpg.de>2010-11-05 20:49:16 +0000
commitf683094590e4a95eb047893584493ed7b32e2a02 (patch)
tree2cd1186df8514b102b83e5ae2d0348b1eff11318 /Source
parentf5055ba642322bfb3d06b44d7a3beaf663d1c6e0 (diff)
downloadsequelpro-f683094590e4a95eb047893584493ed7b32e2a02.tar.gz
sequelpro-f683094590e4a95eb047893584493ed7b32e2a02.tar.bz2
sequelpro-f683094590e4a95eb047893584493ed7b32e2a02.zip
• fixed table structure logic for date/time fields
- fixes issue 886
Diffstat (limited to 'Source')
-rw-r--r--Source/SPTableStructureDelegate.m7
1 files changed, 5 insertions, 2 deletions
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];