From 59b9042b3b2ad3668bb6d526d6fdf23d21a12f39 Mon Sep 17 00:00:00 2001 From: bamse16 Date: Sun, 22 Mar 2009 13:46:06 +0000 Subject: Issue 202: NULL is prefilled in a non-NULL text field Now, if a field has NOT NULL, the default value is '' (empty string), unless the field is autoincrement, when we can keep the NULL value. --- Source/SPTableData.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/SPTableData.m b/Source/SPTableData.m index ae5f1b2f..7561b1ce 100644 --- a/Source/SPTableData.m +++ b/Source/SPTableData.m @@ -308,7 +308,12 @@ // Split the remaining field definition string by spaces and process [tableColumn addEntriesFromDictionary:[self parseFieldDefinitionStringParts:[fieldsParser splitStringByCharacter:' ' skippingBrackets:YES]]]; - + + //if column is not null, but doesn't have a default value, set empty string + if([[tableColumn objectForKey:@"null"] intValue] == 0 && [[tableColumn objectForKey:@"autoincrement"] intValue] == 0 && ![tableColumn objectForKey:@"default"]) { + [tableColumn setObject:@"" forKey:@"default"]; + } + // Store the column. [tableColumns addObject:[NSDictionary dictionaryWithDictionary:tableColumn]]; -- cgit v1.2.3