Page 1 of 1

Zeos 6.6.4 MySQL NULL Strings and AutoInc Fields

Posted: 05.12.2008, 07:21
by cacofony
Hi,
I have not migrate from ZEOSLIB_TRUNK_REV247 (it is a good year old now I think) as everytime I have migrated I have had issues with ftAutoInc fields.

I have not really had time until now to sit down and workout if it was just my applications. I have found the following:

In my applications I like to check before a post that if a field is REQUIRED I error and take the user to the field in question. Previously my code has checked if a field is a ftAutoInc and Required then skip; however is recent updates ftAutoInc fields are shown as ftLargeInt

I also noticed and error while posting string values, this comes about because if I remove my check of REQUIRED fields to allow the ftAutoInc field to post ok, I find my application allows EMPTY strings are posted into fields that are set as NOT NULL.

I have attached example application and SQL scripts.

Posted: 07.12.2008, 22:13
by mdaems
Hi cacofony,

I just checked your program with testing branch, but it should be the same behaviour as 6.6-stable has.

My conclusion:
- No problems with the NOT NULL fields on insert. There might be an issue when trying to erase a posted value and update for those fields. I have the impression he doesn't complain and updates to an empty string (which isn't the same as null so allowable)
- The ftAutoInc field type isn't used (automatically) by zeoslib anymore. Scanning the source of 5.5, I found there was some option to create ftautoinc fields automatically. If you want to experiment with it please check if you could change the TZAbstractRODataset.InternalInitFieldDefs method to update the fieldtype when metadata says it's a autoinc field. At least : file a feature request in the dedicated forum when you don't want to experiment yourself.
- The autoinc field functionally works like expected, raising an error only when left empty on update. On insert nulls are allowed. This behaviour got fixed with SVN commit 342 (http://fisheye2.atlassian.com/changelog/zeos?cs=342) So even if it's not an ftautoinc field, it takes into consideration the fact of being autoincrement on the database side.

Mark