Subject | Re: [firebird-support] Re: Timestamp difference Windows / Linux |
---|---|
Author | Kjell Rilbe |
Post date | 2008-08-18T12:06:57Z |
roydamman wrote:
which acts as a record version counter.
select <datafields>, VersionCounter from YourTable
...
edit...
...
update YourTable
set <datafields as you please>,
VersionCounter = VersionCounter + 1
where <keys match>
and VersionCounter = TheValueYouSelectedInitially
If the update has rowsaffected = 0 then someone has already done an update.
The good thing with this is:
1. I won't fail if the server's real time clock is changed, for example
due to daylight savings.
2. It takes less space in the DB.
3. It probably executes faster.
4. It doesn't suffer from your described problem.
Kjell
--
--------------------------------------
Kjell Rilbe
DataDIA AB
E-post: kjell@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64
> > What are you trying to do? I mean, how do you want to use theYou don't need a timestamp for that. It's a waste. You just need an int
> timestamps?
> >
>
> As initally written I use the timestamp for comparisment if a record
> has changed between my start of editing and committing the changes
> (for this I use a userid (integer) and a timestamp). Reading and
> committing are done in seperate transactions. After committing I check
> the rows affected. This value should be one.
> I know I could/should use RDB$DB_KEY but this involves a rewrite of
> the application.
which acts as a record version counter.
select <datafields>, VersionCounter from YourTable
...
edit...
...
update YourTable
set <datafields as you please>,
VersionCounter = VersionCounter + 1
where <keys match>
and VersionCounter = TheValueYouSelectedInitially
If the update has rowsaffected = 0 then someone has already done an update.
The good thing with this is:
1. I won't fail if the server's real time clock is changed, for example
due to daylight savings.
2. It takes less space in the DB.
3. It probably executes faster.
4. It doesn't suffer from your described problem.
Kjell
--
--------------------------------------
Kjell Rilbe
DataDIA AB
E-post: kjell@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64