SmartList and sequence or serial primary keys

IT it at
Thu Mar 12 06:03:37 EDT 2015


This is based in OmnisSQL but I will move to PostgreSQL as soon as possible

I have an squema with some columns (TX_SEQ, TX_TIPO, TX_SUBTA, TX_SUBTN, TX_DESCRIP).

TX_SEQ is primary key, omnis sequence.  As soon I move to Postgresql i will use a serial field server side generated.

Do $clib.$tables.tSC.$sqlclassname.$assign('sFTEXTOS')
Do ivList.$definefromsqlclass('tSC')
Do ivList.$smartlist.$assign(kTrue)
Enter data 
If flag true
	Do ivList.$dowork()
	Do ivList.$clear()
End If
Do $cwind.$redraw()

I get all rows inserted in the database, but ivList has TX_SEQ as NULLs.
A  subsecuent edit of the ivList fails because the primary keys are NULLs and the smart list is unable to update the rows unless you reread the rows after inserting to recover the TX_SEQ.

Something similar happens with a row if you do an ivRow.$insert(). You don't get back the TX_SEQ value.

Is $dowork() not so useful as I thought and I will need to loop the list and insert rows one by one, recovering the primary key manually and updating it's value in the ivList ? 
Am I missing something ?



More information about the omnisdev-en mailing list