Problem using TZTable, Lazarus, PostgreSQL and INET Datatype
Posted: 05.11.2013, 15:58
Hello,
I'm using Zeoslib 7.1.2-Stable with Lazarus 1.3 (from SVN) and I'm having a problem with using TZTable, PostgreSQL and the "INET" (PostgreSQL-specific) datatype. The "Inet" datatype is designed to work with IP Addresses, CIDR's and whatnot. I'm not really sure where to tackle this specific issue-- it's either a Zeos thing or else a Lazarus thing-- can someone help me figure this out please?
So here's the setup...
I have a table which uses several fields which are of the INET datatype.
I have NO issue using any of the fields if I am SETTING a value-- e.g., 'ip_address'='1.2.3.4' works fine.
I have NO issue if I'm using a BRAND NEW record and only setting one of the fields, 'ip_address1' = '1.2.3.4' (it DOESN'T barf when I OMIT any reference to 'ip_address2' and 'ip_address3', for instance).
I *DO* have a problem if an INET field USED to have a value and has now been cleared. E.g., it USED to be '1.2.3.4' and I've used the TDbEdit control to backspace (or whatever) to clear out the value. The resulting SQL to the database is apparently something like 'ip_address' = '' which is a no-no. It can be NULL but not EMPTY. Whenever I clear a field, it gets replaced by an EMPTY value as opposed to a NULL value.
Is this a "bug" (overlooked item) in the TZTable component? Is this something I should (or could) be addressing at the TDbEdit level (the data-aware edit component on the form)? Is there some auxillary property of the TZTable component (or alternately the TZQuery component) that could potentially intercept the EMPTY value and convert it to a NULL value? This is an area where the Zeoslib documentation (afaik) is really weak.
I'm really stuck here and I need to move forward. Can someone give me a hand figuring this out?
(BTW, I have also posted this on the Lazarus Forum: http://forum.lazarus.freepascal.org/ind ... #msg133188)
Thanks!
John
I'm using Zeoslib 7.1.2-Stable with Lazarus 1.3 (from SVN) and I'm having a problem with using TZTable, PostgreSQL and the "INET" (PostgreSQL-specific) datatype. The "Inet" datatype is designed to work with IP Addresses, CIDR's and whatnot. I'm not really sure where to tackle this specific issue-- it's either a Zeos thing or else a Lazarus thing-- can someone help me figure this out please?
So here's the setup...
I have a table which uses several fields which are of the INET datatype.
I have NO issue using any of the fields if I am SETTING a value-- e.g., 'ip_address'='1.2.3.4' works fine.
I have NO issue if I'm using a BRAND NEW record and only setting one of the fields, 'ip_address1' = '1.2.3.4' (it DOESN'T barf when I OMIT any reference to 'ip_address2' and 'ip_address3', for instance).
I *DO* have a problem if an INET field USED to have a value and has now been cleared. E.g., it USED to be '1.2.3.4' and I've used the TDbEdit control to backspace (or whatever) to clear out the value. The resulting SQL to the database is apparently something like 'ip_address' = '' which is a no-no. It can be NULL but not EMPTY. Whenever I clear a field, it gets replaced by an EMPTY value as opposed to a NULL value.
Is this a "bug" (overlooked item) in the TZTable component? Is this something I should (or could) be addressing at the TDbEdit level (the data-aware edit component on the form)? Is there some auxillary property of the TZTable component (or alternately the TZQuery component) that could potentially intercept the EMPTY value and convert it to a NULL value? This is an area where the Zeoslib documentation (afaik) is really weak.
I'm really stuck here and I need to move forward. Can someone give me a hand figuring this out?
(BTW, I have also posted this on the Lazarus Forum: http://forum.lazarus.freepascal.org/ind ... #msg133188)
Thanks!
John