how does it get handled? i am writing a multi-threaded app that issues sql commands (reading and writing) and am wondering what happens if two transactions are issued on the same table at the same time? will they deadlock? will one transaction wait for the other to complete? what is the best way of identifying and dealing with these situations?
is making a dynamic arraylist with sql commands that run by turn is a feasible option? i am confused...
thanks.
The SQL implementation is thread-safe. Writing and reading from multiple threads should be fine.
Still there are cases that it will be easier to manage the access to the db yourself.
BTW, what is your reason for using multiple threads?
I am writing a server-like app which is devided into rooms, each room is represented by a table and is handled with it's own thread. This got me intrested to know what happens if a DB is accessed simultaneously at higher levels (DB) and lower levels (table, row, etc.).
I would like to know how b4a handles such cases.
BTW, when you say the implementation is thread-safe you mean that you (creators of b4a) took care of it when developing b4a?
I've spent time reading on sql and one thing I've noticed is that issueing two write commands simultaneously can lead to a deadlock as each transaftion waits for the other to complete. Could such a thing happen in a b4a app? Also, I didn't quite understand what is indexing and how does it solve the problem.
Basic4android uses Android implementation of SQLite. According to their documentation it should be thread safe. Which means that it shouldn't dead lock (assuming that your code doesn't dead locks).
Indexing is not related to this issue. By creating an index for a column, you can access specific items much faster.