You are not logged in.
Pages: 1
After update mORMot I get an issue with TSQLRestBatch:
The Batch consists of several tables.
In mORMot line 37869:
Value := Model.TableProps[TableIndex].Props.
SaveSimpleFieldsFromJsonArray(Sent,EndOfObject,true);
TableIndex = -1 and Exception will be raised.
If I replace TableIndex with RunTableIndex Batch work as expected.
Offline
This was indeed a regression, in such cases.
Should be fixed by http://synopse.info/fossil/info/1eeadc4628
Thanks for the report!
Offline
Thanks for your quick solution.
Is it possible to send such a Batch (with several tables included) under one implicit transaction?
Offline
What do you call "implicit"?
If you mean "automatically generated", yes it is possible.
Just define the AutomaticTransactionPerRow parameter, to some number, e.g. 10000:
// - you should better set AutomaticTransactionPerRow > 0 to execute all
// BATCH processes within an unique transaction grouped by a given number
// of rows, on the server side - set AutomaticTransactionPerRow=maxInt if
// you want one huge transaction, or set a convenient value (e.g. 10000)
// depending on the back-end database engine abilities, if you want to
// retain the transaction log file small enough for the database engine
// - BatchOptions could be set to tune the SQL execution, e.g. force INSERT
// OR IGNORE on internal SQLite3 engine
constructor Create(aRest: TSQLRest; aTable: TSQLRecordClass;
AutomaticTransactionPerRow: cardinal=0; Options: TSQLRestBatchOptions=[]);
In fact, manual transactions outside the BATCH are not a good idea, and may very likely create confusion, depending on how they are executed on the server side (some external DB may e.g. use its per-thread transaction).
This AutomaticTransactionPerRow parameter, in conjunction with a Batch, is the preferred way of creating transactions, from the ORM point of view.
Offline
Ok, that's what I wanted to know!
Thank you and have a nice day.
Offline
Pages: 1