You are not logged in.
Pages: 1
when using Batches we can set the 'boInsertOrReplace' to have replaced a row if its primary key is the same with the inserted new row.
How can we have it in ORM/REST add or addorupdate functions of mormot2?
If I understand it correctly, addorupdate is based on IDvalue to issue an add or an update.
How can we have an 'INSERT OR REPLACE' sql statement for ORM/REST in order not to have to check if a record with the same primary key value exists in the table ?
Thank you in advance
Last edited by dcoun (2022-08-08 10:41:26)
Offline
Thanks a lot @ab
Offline
This is not yet supported - the idea is to make a manual Update then Add if the first failed...
I tried the above and it does not work
If record is missing, update returns true
Offline
Trying to debug it, I noticed that in the update sql query no data are expected to be returned back. That is ok
But an update is not returning an error if the updated record does not exist
I am using ZEOS 8.0-patches branch from GitHub
I switched to your second suggestion that it is better I believe too
I issue an OneField requesting the RowID
function OneFieldValue(Table: TOrmClass; const FieldName: RawUtf8; WhereID: TID): RawUtf8;
Last edited by dcoun (2022-08-12 09:36:33)
Offline
Pages: 1