On 10/7/09 21:35 , "Adam DeVita" <adev...@verifeye.com> wrote:

> One can  also get a mess if Mr. Red and Mr Black both get new customers, and
> enter them and they both get the same ID because the auto-generated int
> happens to be the same. Both copies get updated with the other guy's data,
> they then get annoyed and enter the stuff again and it happens over again,
> but now there are N entries of the other guy's customer  in the database
> depending on how many times they do it.
> 

I solve this problem the following way:

New records ID is not set by the local client who creates the new record,
but by the central database.

Upon new record creation a "trigger" is run that sends the new record to the
central database. The central database then allocates the new id (and
revision stamp) to the new record and returns them to the trigger which
inserts them back into to local repository.

This only works in an "online" scenario clearly.

An alternative is to guarantee uniqueness across clients by making sure the
newly allocated id is a composite that includes the creator client identity.

Jean-Denis

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to