You are not logged in.
Pages: 1
After inserting a negativ ID in a table with something like this:
R:= TSQLHV.Create;
R.IDValue:= -1;
DB.Add(R, true, true);
I try to delete the inserted record with:
DB.Delete(TSQLHV, -1);
but nothing happened, because of
if (ID<=0) or (TableModelIndex<0) or (Model.Tables[TableModelIndex]<>fStoredClass) then
in mORMot.pas line 1202?
Offline
A negative ID is interpreted as an error code, in most part of the code.
This is not consistent, but, in practice, you should NOT use negative IDs.
Even if they are allowed by SQLite3 or other means of storage, of course.
They are in fact reserved for future use.
I would like to use them for TSQLRestBatch automatic replacement of created IDs, e.g. when adding nested records (a record referencing to a previous one, just inserted during the very same batch, so not known in advance).
Offline
Pages: 1