MySQL & Empty string values
Posted: Saturday 15th December 2018 11:33pm
When I try to save a record to a MySQL instance and there is an empty string for one of the fields then it returns an error saying that Null values are not allowed.
Having an empty string for this particular field is expected and only has data occasionally for any record.
The field(s) in question are set to NOT NULL but I have always understood that an empty string and Null are very different and I've searched the MySQL website for any possible fix as well as anything that Google can return ( StackOverflow articles ect....), I can't find anything to explain the behavior.
I 'have' done this with Gambas about 18 months ago so I know it 'did' work at some stage.
The MySQL Instance is on a newly built Ubuntu Server (Binary Beaver) and if I fill any empty string fields with data, the record writes fine. All other functions work fine - Just fields with empty strings.
I know I can set these fields to allow Null values to solve this issue but would very much like to understand why.
Any assistance would be greatly appreciated.
Having an empty string for this particular field is expected and only has data occasionally for any record.
The field(s) in question are set to NOT NULL but I have always understood that an empty string and Null are very different and I've searched the MySQL website for any possible fix as well as anything that Google can return ( StackOverflow articles ect....), I can't find anything to explain the behavior.
I 'have' done this with Gambas about 18 months ago so I know it 'did' work at some stage.
The MySQL Instance is on a newly built Ubuntu Server (Binary Beaver) and if I fill any empty string fields with data, the record writes fine. All other functions work fine - Just fields with empty strings.
I know I can set these fields to allow Null values to solve this issue but would very much like to understand why.
Any assistance would be greatly appreciated.