Andy Parker
Posts: 0
Joined: Wed Mar 27, 2013 10:21 am

Multiple sources updating database

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?

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Multiple sources updating database

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

Andy Parker
Posts: 0
Joined: Wed Mar 27, 2013 10:21 am

Multiple sources updating database

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.

Return to “Issues”