You are not logged in.
Pages: 1
A rest orm server:
server: TserRestServerDB
client:TRESTHttpClient
model:TOrmBiolife = class(TOrm)
  
client:
    Rec := TOrmBiolife.Create;
  try
    Rec.Species_No := strtoint(NameEdit.Text);
    Rec.Category:='test';
    rec.Common_Name:='testname';
    id:= Database.Add(rec,true,true,false);   //failed to add,why ?   
 server log is :
20240815 10053656  -    00.000.681
20240815 10054513  +    mormot.rest.sqlite3.TSqlRestServerDB(016560a0).URI POST lqf/Biolife in=120 B
20240815 10054513 EXC           ESqlite3Exception {Message:"Error SQLITE_CONSTRAINT (19) [Step] using 3.44.2 - NOT NULL constraint failed: BIOLIFE.ID, extended_errcode=1299",ErrorCode:19,SQLite3ErrorCode:"secCONSTRAINT"} [HttpSrv 8080lqf THttpApiSrv] at 010063f39d
Isnt the Table id controlled by RestServer? I am confused, can anyone help me ? thank you
Offline
Check your parameters.
You specified ForceID=true so the ORM tries to use the current value in Rec, which is 0.
Please read the documentation on any doubt:
    // - if ForceID is true, client sends the Value.ID field to use this ID for
    // adding the record (instead of a database-generated ID)Offline
I tried various value for these params , the error is always same .
e.m : id:= Database.Add(rec,true); 
In this case,the forceID default value is false ,but the error is same.
Offline
Pages: 1