Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Bug Reports » Insertorupdate and autoincrement
Re: Insertorupdate and autoincrement [message #1793 is a reply to message #1792] Thu, 06 November 2008 09:09 Go to previous messageGo to previous message
AJM is currently offline  AJM
Messages: 2361
Registered: April 2006
Location: Surrey, UK
Senior Member
The behaviour you describe is as expected. Columns with the auto_increment attribute act as follows:

(a) During an INSERT if an auto_increment column has a value which is greater than zero then that value will be used, and a new one will not be generated. It is normal practice not to supply any value, not even zero, for an auto_increment column.

(b) The insertOrUpdate() function will construct a WHERE string using the current primary key and perform a lookup to find out if the record exists or not. If the primary key is auto_increment then for an INSERT there is no value, so the result of the lookup is unpredictable.

In short, do not use the insertOrUpdate() function to insert records which rely on auto_increment to supply their values. In this case you should examine the value yourself and call either insertRecord() or updateRecord() manually.


 
Read Message
Read Message
Read Message
Previous Topic: Multi2 -> popup2 not calling _cm_pre_updateRecord?
Next Topic: Problem with accentuated char and Uppercase
Goto Forum:
  


Current Time: Tue Sep 10 17:25:50 EDT 2024

Total time taken to generate the page: 0.00998 seconds