mardi 21 avril 2015

Accepted methodology when using multiple Sqlite databases

Question

What is the accepted way of using multiple databases that record information about the same object that will ultimately end up living in one central database?

Example

There is one main SQL database about trees.

This database holds information about unique trees from all over the UK.

To collect the information a Sqlite database is created and taken to the tree on a phone.

The collected information is then stored in the Sqlite database until it is brought back to the main database, Where it is then transferred into the main database.

Now this works fine as long as there is only one Sqlite database out for any one tree at a time.

If two people wanted to collect information at the same time for the same tree, when they both came back to be transferred in to the main database, there would be collisions on their primary key constraints.

Possible ideas

  1. Assign each database 1000 unique ID's and then one they come back in as the ids have already been assigned the ids on each database won't collide.

Downfall

This isn't very dynamic and could fail if one database overruns on its preassigned ids.

Is there another way to achieve the same flexibility but with out the downfall mentioned above?

Aucun commentaire:

Enregistrer un commentaire