TZQuery does not accept empty strings - sets as NULL

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
aricaldeira
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 27.08.2009, 17:03

TZQuery does not accept empty strings - sets as NULL

Post 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
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
Locked