Posted Thursday, January 3, 2008 @ 18:25:42
I have a compound insert sql for a specific table. In order to get everything in all the referenced tables I have the following:
qTable.addInsertSql("INSERT INTO TABLE_GROUPS " +
" ( GRP_FK_OPERATOR_OPR_IID, " +
" GRP_NAME, " +
" GRP_START_DATETIME, " +
" GRP_STOP_DATETIME, " +
" GRP_COMMENT ) " +
" values (?,?,?,?,?)",
"2,4,7,8,9");
qTable.addInsertSql("UPDATE TABLE_GROUPS SET" +
" GRP_FK_REFERENCE_CHANNELS_RFC_IID = " +
" ( SELECT RFC_IID FROM TABLE_REFERENCE_CHANNELS " +
" WHERE RFC_FK_MV_CHANNELS_MVC_CHANNEL = ?) " +
" WHERE GRP_IID = (SELECT MAX (GRP_IID) FROM TABLE_GROUPS) ",
"6");
It works fine IF (and only if) I select another row in the table. If I do a qTable.save() that is triggered by some other action (button press, focus lost, etc) it doesn't do the insert. I have the debug trace on and can watch when it actually executes the insert. It tells me Executing sql INSERT INTO TABLE_GROUPS ...... followed by the Executing sql UPDATE TABLE_GROUPS SET GRP_FK_REFERENCE_CHANNELS_RFC_IID .....
What am I missing in order to force the insert so I don't have to rely on the user selecting another row (btw, I tried setting qTable.setDatabaseUpdateMode(DBTable.UPDATE_DATABASE_ON_CELL_EXIT) and that doesn't work either)? There must be some logic inside the .save() command that determines its not time yet to do the insert action.
Thanks