You are not logged in.
Pages: 1
I have noticed that the following works:
if MemberExists(TOrmsometing,0) then ....
but the following does not:
Delete(TOrmsometing,0)
Is it possible in mormot.orm.sql line 1317 to allow zero IDs to be deleted through orm?
function TRestStorageExternal.EngineDelete(TableModelIndex: integer;
ID: TID): boolean;
begin
if (ID <= 0) or
(TableModelIndex < 0) or
(Model.Tables[TableModelIndex] <> fStoredClass) then
result := false
Thank you in advance
Offline
zero is invalid, a valid ID value is >=1.
Last edited by pvn0 (2024-02-15 11:27:41)
Offline
I just post it because MemberExists(TOrmsometing,0), a ORM method, accept it and it works
I tried also to run the tests without errors after changing TRestStorageExternal.EngineDelete to be like the following :
function TRestStorageExternal.EngineDelete(TableModelIndex: integer;
ID: TID): boolean;
begin
if (ID < 0) or
(TableModelIndex < 0) or
(Model.Tables[TableModelIndex] <> fStoredClass) then
result := false
I know that ID:0 has a meaning for Add/AddOrUpdate in Delete as in MemberExists I am not sure.
I am not sure also about using Delete in batches
Offline
@ab do you consider the above change as acceptable for the Delete as it works for MembereExists?
Thank you in advance
Offline
The value 0 has a meaning of invalid ID everywhere in the framework by convention.
Perhaps it is not properly checked everywhere but it is what is expected.
So I don't consider allowing to delete an ID = 0 when we can't Add or Update such ID.
Offline
No problem. I did in an other way. Thank you
Offline
Pages: 1