TZQuery does not accept empty strings - sets as NULL
Posted: 27.08.2009, 17:18
Hi!
First of all, the scenario: D2009, PG 8.4, Zeos testing rev. 680.
In my form I have a TZQuery linked to a TZUpdateSQL, and everything is working fine (even UTF8 encoding), except for this small issue.
A table has a varchar field setted as not null.
TZQuery.AfterInsert sets that particular field as '' (empty string).
When I post the data, I get an error saying that that field cannot be NULL.
Well, empty strings are not NULL, so I'm assuming that, somehow, Zeos is translating an empty string into NULL.
My workaround was that, TZQuery.BeforePost tests if that field's value is an empty string, then I put a space in it: ' '
I wish I could solve this issue in Zeos itself, but I haven't been able to find where in the code I could change this behavior, which is wrong, AFAIK: empty strings should not be converted to NULL, right?
Can someone point me where to look for this in the code?
Thanks in advance!
Ari Caldeira
First of all, the scenario: D2009, PG 8.4, Zeos testing rev. 680.
In my form I have a TZQuery linked to a TZUpdateSQL, and everything is working fine (even UTF8 encoding), except for this small issue.
A table has a varchar field setted as not null.
TZQuery.AfterInsert sets that particular field as '' (empty string).
When I post the data, I get an error saying that that field cannot be NULL.
Well, empty strings are not NULL, so I'm assuming that, somehow, Zeos is translating an empty string into NULL.
My workaround was that, TZQuery.BeforePost tests if that field's value is an empty string, then I put a space in it: ' '
I wish I could solve this issue in Zeos itself, but I haven't been able to find where in the code I could change this behavior, which is wrong, AFAIK: empty strings should not be converted to NULL, right?
Can someone point me where to look for this in the code?
Thanks in advance!
Ari Caldeira