Page 1 of 1

Multiple sources updating database

Posted: Tue Apr 19, 2016 4:15 pm
by Andy Parker

Hi,

My app allows multiple sources to update the same objects in the database.

To ensure no updates are missed or overwritten, should I use server code to handle the updates?

e.g.
User 1 adds an array item to database1-table1-newsitems[]
at the same time,
User 2 adds an array item to database1-table1-newsitems[]

To ensure both items are added and nothing is overwritten, missing an update, would server code operate sequentially or if the calls happened at exactly the same time, could 2 instances of server code get executed at the same time?

If 2 could get executed at the same time, I could negate this by flagging updates, I just need to know if server code calls are sequential or not?

Or is there a better way if handling this than using server code?


Multiple sources updating database

Posted: Tue Apr 19, 2016 7:35 pm
by Serhii Kulibaba

Hello Andy,

It is better to read updates before executing update/create service. And run that service only if there are no problems with current update, else - show to user message with the problem


Multiple sources updating database

Posted: Tue Apr 19, 2016 7:43 pm
by Andy Parker

Thanks, I guess I'm just trying to negate the problem that could occur if the client reads, modifies, then writes, only to find that another client has read before I wrote my update so mine are lost.