It is true that ADO reads the data from the server and holds it in the client's memory.
We normally open recordsets using
adLockOptimistic.
All calls to the methods Update(), Delete() and AddNew( aCols, aVals ) make the changes to the underlying database immediately and are visible to other users on the network.
We can also open the recordset using
adLockBatchOptimistic mode.
- Code: Select all Expand view RUN
oRs := FW_OpenRecordSet( oCn, cSql, adLockBatchOptimistic )
In this case, all changes including methods Update(), Delete(), AddNew(...) are all applied to the copy of data in the client's memory only. No changes are written to the server. These changes are also not visible to the other users on the network.
Calling the method
CancelBatch() cancels all changes and restores the data in the client's memory to the original state.
Calling the method
UpdateBatch() flushes all changes to the physical database on the server at once. From then on the changes are visible to the other users on the network. When some of the records are already modified by other users, they can not be written and the programmer has to handle these conflicts.
When we open recordset in batch mode, it is not necessary to keep the connection open. We can reopen the connection while saving the changes with UpdateBatch() call.
All web-software open recordsets in batch mode only.
Handling recordsets opened in batch mode requires greater expertise of ADO. It is not as easy as it may appear. For normal use in our programs, it is simple and easy to use the adLockOptimistic.
You may also consider using FWH mariadb library instead of ADO. FWH library is more powerful than ADO and (1) can do more than what is possible with even ADO (2) lot more easier to write code and (3) no need to install mysql ODBC connectors on each client.