Page 1 of 1

TZQuery does not accept empty strings - sets as NULL

Posted: 27.08.2009, 17:18
by aricaldeira
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

Posted: 02.09.2009, 22:47
by mdaems
I would say : start in unit ZDatasetUtils by debugging PostToResultSet and seeing if this data is already null at that point or if the empty string is passed.

I hope it's null already because that would be a TDataset/TField Issue, not a zeoslib issue.

Can you report please? Eventually you could file a bug report with a sample program at zeosbugs.firmos.at.

Mark