You are not logged in.
Trying to add records with an pre-filled ID, by calling
TSQLRestClient.Add(Rec, true, true);
But they are still inserted with a ID generated by a call to EngineLockedNextID.
Probable cause, the following line (MormotDB.pas, line 864) is always used when not in Batch mode
result := ExecuteFromJSON(SentData,0); // UpdatedID=0 -> insert with EngineLockedNextID
Callstack:
Mormot_D17.mORMot.TJSONObjectDecoder.Decode('"RowID":720,"ModTime":135071471049,"Name":"PietjePuck 7","Question":"{80722197-6E21-494F-A8E3-423B42A4A168}","Address_":"Parklaan 23","PostalCode":"2347BC","City":"Nuenen","Datum":"2012-05-07","FloatNumber":7,"IntNumber":2147490647,"CurrencyNumber":255.70}',(),pNonQuoted,7,True)
Mormot_D17.mORMot.TJSONObjectDecoder.Decode('{"RowID":720,"ModTime":135071471049,"Name":"PietjePuck 7","Question":"{80722197-6E21-494F-A8E3-423B42A4A168}","Address_":"Parklaan 23","PostalCode":"2347BC","City":"Nuenen","Datum":"2012-05-07","FloatNumber":7,"IntNumber":2147490647,"CurrencyNumber":255.70}',(),pNonQuoted,7,True)
Mormot_D17.mORMotDB.TSQLRestServerStaticExternal.ExecuteFromJSON('{"RowID":720,"ModTime":135071471049,"Name":"PietjePuck 7","Question":"{80722197-6E21-494F-A8E3-423B42A4A168}","Address_":"Parklaan 23","PostalCode":"2347BC","City":"Nuenen","Datum":"2012-05-07","FloatNumber":7,"IntNumber":2147490647,"CurrencyNumber":255.70}',0)
Mormot_D17.mORMotDB.TSQLRestServerStaticExternal.EngineAdd(TSQLUnitTestSampleRecord,'{"RowID":720,"ModTime":135071471049,"Name":"PietjePuck 7","Question":"{80722197-6E21-494F-A8E3-423B42A4A168}","Address_":"Parklaan 23","PostalCode":"2347BC","City":"Nuenen","Datum":"2012-05-07","FloatNumber":7,"IntNumber":2147490647,"CurrencyNumber":255.70}')
Mormot_D17.mORMot.TSQLRestServer.URI($18F318)
Mormot_D17.mORMotSQLite3.TSQLRestClientDB.InternalURI('root/UnitTestSampleRecord','POST',nil {''},$18F3F0 {''},$18F3FC {'{"RowID":720,"ModTime":135071471049,"Name":"PietjePuck 7","Question":"{80722197-6E21-494F-A8E3-423B42A4A168}","Address_":"Parklaan 23","PostalCode":"2347BC","City":"Nuenen","Datum":"2012-05-07","FloatNumber":7,"IntNumber":2147490647,"CurrencyNumber":255.70}'})
Mormot_D17.mORMot.TSQLRestClientURI.URI('root/UnitTestSampleRecord','POST',nil {''},$18F3F0 {''},$18F3FC {'{"RowID":720,"ModTime":135071471049,"Name":"PietjePuck 7","Question":"{80722197-6E21-494F-A8E3-423B42A4A168}","Address_":"Parklaan 23","PostalCode":"2347BC","City":"Nuenen","Datum":"2012-05-07","FloatNumber":7,"IntNumber":2147490647,"CurrencyNumber":255.70}'})
Mormot_D17.mORMot.TSQLRestClientURI.EngineAdd(TSQLUnitTestSampleRecord,'{"RowID":720,"ModTime":135071471049,"Name":"PietjePuck 7","Question":"{80722197-6E21-494F-A8E3-423B42A4A168}","Address_":"Parklaan 23","PostalCode":"2347BC","City":"Nuenen","Datum":"2012-05-07","FloatNumber":7,"IntNumber":2147490647,"CurrencyNumber":255.70}')
Mormot_D17.mORMot.TSQLRestClient.Add($25C4E30,True,True)
Last edited by Bascy (2012-12-18 20:40:42)
Offline
Any progress on this?
Offline
Could you please create a ticket for easiest follow-up?
http://synopse.info/fossil/reportlist
(you need to be logged, even as anonymous, to create a ticket)
Offline
Done
Offline
Any progress on ticket 3c4146259476d06c76e5850f522ea3d093f89355?
Offline
I've committed a potential fix.
Some refactoring was necessary, since "force ID" feature was broken in several cases, including your external table process.
Even TSQLRestServerDB.EngineAdd() and TSQLRestServerStaticInMemory.AddOne() will now handle forced ID in sent data.
Offline
Hi, @ab, I think some refactoring is also necessary for function TSQLRestStorageInMemory.AddOne(Rec: TSQLRecord; ForceID: boolean;
const SentData: RawUTF8): TID;. If the new come rec is out of order and ForceID is true, there whole table will be sorted. If a lot of new come recs all like this, the sorting would take quite a long time.
I think perhaps some flags can be added such as BeginUpdate ... EndUpdate, to control the sorting procedure to take place or not.
Offline