Zeos 6.6.4 MySQL NULL Strings and AutoInc Fields

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
cacofony
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 06.12.2006, 15:24
Location: Perth - Western Australia
Contact:

Zeos 6.6.4 MySQL NULL Strings and AutoInc Fields

Post 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.
You do not have the required permissions to view the files attached to this post.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

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