Subject | Re: Record versioning/timestamping |
---|---|
Author | Adam |
Post date | 2004-12-21T02:02:22Z |
Firstly, once you alter a record, it will not let another user alter
that record until you commit or rollback (its called a multiversion
record), so it may not even be an issue for you. Depending on what
transaction mode you use, their query will wait for your transaction
to commit/rollback or generate an exception.
If you still want a record stamp, create a 64 bit integer column and
fill it using a generator. You may want to use a trigger to set it, or
you can return it to the calling program. Generators are thread safe too.
Adam
--- In firebird-support@yahoogroups.com, "gregatacd" <GregAtACD@h...>
wrote:
that record until you commit or rollback (its called a multiversion
record), so it may not even be an issue for you. Depending on what
transaction mode you use, their query will wait for your transaction
to commit/rollback or generate an exception.
If you still want a record stamp, create a 64 bit integer column and
fill it using a generator. You may want to use a trigger to set it, or
you can return it to the calling program. Generators are thread safe too.
Adam
--- In firebird-support@yahoogroups.com, "gregatacd" <GregAtACD@h...>
wrote:
>
> DB: Firebird 1.5
>
> I'm looking for a way to mark a record as being updated. For
> example, I read a record with a timestamp or other mark, then when I
> update it (after the user enters some changes etc.), I find that the
> mark has changed somehow (another user updating the record
> underneath me).
>
> What would be the best way to mark a record as updated or added?
>
> One potential solution would be to create a timestamp column and
> have an update/insert trigger update the timestamp column each time.
> Is there a performance issue with this (since getting the current
> time may not be overly quick, and it must be done once per
> update/insert).
>
> Or, add a 64bit integer column and have the triggers do a +1 on this
> column... would this be 'atomic' enough given that multiple users
> may be editing a given record...
>
> Any advice here on best practices would be great!
>
> Greg