Subject | Re: Timestamp difference Windows / Linux |
---|---|
Author | roydamman |
Post date | 2008-08-18T12:42:59Z |
Hello Kjell,
If you want to go that way you can better use the already mentioned
RDB$DB_KEY field. This field is a unique key for a certain record for
a certain version of the record.
So:
Select a.RDB$DB_KEY, a.* from my_table
And:
update my_table a
set <datafields as you please>
where a.RDB$DB_KEY = :read_RDB$DB_KEY
And check the rows affected = 1. This is the fastest way. But in my
case I already want to track who an when last changed the record, so I
need the fields anyway. I works perfectly when client and server are
running under Windows but not if the server runs under Linux.
The timestamp + userid of the last change of the record are not involved.
make changes in my applications. Anyway, thank you for your response.
>update.
> You don't need a timestamp for that. It's a waste. You just need an int
> 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
If you want to go that way you can better use the already mentioned
RDB$DB_KEY field. This field is a unique key for a certain record for
a certain version of the record.
So:
Select a.RDB$DB_KEY, a.* from my_table
And:
update my_table a
set <datafields as you please>
where a.RDB$DB_KEY = :read_RDB$DB_KEY
And check the rows affected = 1. This is the fastest way. But in my
case I already want to track who an when last changed the record, so I
need the fields anyway. I works perfectly when client and server are
running under Windows but not if the server runs under Linux.
> The good thing with this is:I am not to concerned about that. Normally this will not be a problem.
>
> 1. I won't fail if the server's real time clock is changed, for example
> due to daylight savings.
The timestamp + userid of the last change of the record are not involved.
>As mentioned, I already want to track who and when did the last change.
> 2. It takes less space in the DB.
>
> 3. It probably executes faster.You are probably right. But then, you should better use RDB$DB_KEY.
>
> 4. It doesn't suffer from your described problem.I only seek a way to alter my database component so I don't have to
>
make changes in my applications. Anyway, thank you for your response.