aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbamse16 <marius@marius.me.uk>2009-03-22 13:46:06 +0000
committerbamse16 <marius@marius.me.uk>2009-03-22 13:46:06 +0000
commit59b9042b3b2ad3668bb6d526d6fdf23d21a12f39 (patch)
tree993ecf6c0e486b19e1411f93d8529f9f765d47f8
parentc47c587237171476a97e981ca6db1058edfc5c60 (diff)
downloadsequelpro-59b9042b3b2ad3668bb6d526d6fdf23d21a12f39.tar.gz
sequelpro-59b9042b3b2ad3668bb6d526d6fdf23d21a12f39.tar.bz2
sequelpro-59b9042b3b2ad3668bb6d526d6fdf23d21a12f39.zip
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.
-rw-r--r--Source/SPTableData.m7
1 files changed, 6 insertions, 1 deletions
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]];