You are not logged in.
Pages: 1
with mormot+sqlite can i set Isolation level ?
for Some concurrent modification operations...
Offline
I think the reference is https://www.sqlite.org/isolation.html
In mORMot, we have a single connection to the DB (in the most simple case), protected by a global thread lock in mORMot code.
So the transactions are always serializable, and changes won't appear before the COMMIT.
Offline
I see, thanks。:)
Offline
In this case, do I have to use transactions?
(for Some concurrent modification operations...)
Last edited by zhangguichao (2023-04-20 06:54:47)
Offline
There are several ways of doing transactions in mORMot:
1) The main pattern in mORMot is to use a TRestBatch, which would create the transaction when making the writes.
2) But you can have transacations at REST level if you want to make nested reads and writes.
This transaction would better be very small in time, because they will block other transactions in the mORMot kernel (not the SQLIte3 kernel).
3) If you really need business-level transactions (e.g. long standing transactions), don't use SQlite3 but another database, and direct SQL to it (via mormot.db.sql classes), all encapsulated behind an interface.
The main points to understand, coming from RDBMS, are
a) That mORMot has to work with no-SQL database backends, with no transaction support. Its ORM is not a full mapping of the RDBMS logic.
b) mORMot favors the "aggregate" repository pattern, where you usually don't need transaction outside of the aggregate object scope - which may be a single row in a SQlite3 database, thanks to array and TDocVariant fields (storing nested info as JSON in the DB).
c) The mORMot 1 documentation is still accurate about these patterns. https://synopse.info/files/html/Synopse … l#TITL_124
d) If you want something more SQL-oriented, just use SQL, over an interface based service.
Offline
Very clear, much appreciated.
Offline
Pages: 1