aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2013-03-06 00:29:45 +0000
committerrowanbeentje <rowan@beent.je>2013-03-06 00:29:45 +0000
commit9f85aaffb997a8baa41322021e4a76324a50b9a2 (patch)
treea9bf9dd3fe81af45a6877301a9df2f8a91393a13
parentaa7d26a28f9609963478ffdebaf6b8ffcde32bcd (diff)
downloadsequelpro-9f85aaffb997a8baa41322021e4a76324a50b9a2.tar.gz
sequelpro-9f85aaffb997a8baa41322021e4a76324a50b9a2.tar.bz2
sequelpro-9f85aaffb997a8baa41322021e4a76324a50b9a2.zip
- If date-type fields are cleared, and allow NULLs, save the cell value as NULL; this implements Issue #1638
-rw-r--r--Source/SPCustomQuery.m2
-rw-r--r--Source/SPTableContent.m4
2 files changed, 3 insertions, 3 deletions
diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m
index ba3eca62..08b5838c 100644
--- a/Source/SPCustomQuery.m
+++ b/Source/SPCustomQuery.m
@@ -1883,7 +1883,7 @@
if ( [[anObject description] isEqualToString:@"CURRENT_TIMESTAMP"] ) {
newObject = @"CURRENT_TIMESTAMP";
} else if ([anObject isEqualToString:[prefs stringForKey:SPNullValue]]
- || (([columnTypeGroup isEqualToString:@"float"] || [columnTypeGroup isEqualToString:@"integer"])
+ || (([columnTypeGroup isEqualToString:@"float"] || [columnTypeGroup isEqualToString:@"integer"] || [columnTypeGroup isEqualToString:@"date"])
&& [[anObject description] isEqualToString:@""]))
{
newObject = @"NULL";
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index 2ca31b70..85241ce2 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -2882,9 +2882,9 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
NSString *fieldTypeGroup = [fieldDefinition objectForKey:@"typegrouping"];
// Use NULL when the user has entered the nullValue string defined in the preferences,
- // or when a numeric field is empty.
+ // or when a numeric or date field is empty.
if ([rowObject isNSNull]
- || (([fieldTypeGroup isEqualToString:@"float"] || [fieldTypeGroup isEqualToString:@"integer"])
+ || (([fieldTypeGroup isEqualToString:@"float"] || [fieldTypeGroup isEqualToString:@"integer"] || [fieldTypeGroup isEqualToString:@"date"])
&& [[rowObject description] isEqualToString:@""] && [[fieldDefinition objectForKey:@"null"] boolValue]))
{
fieldValue = @"NULL";