Not quite, Rachel. It keeps incrementing, so testing for > 1 only works the
first time. When you retrieve any row, its Sys_Rowver value could be any
integer. When you save the row back, it will be that value + 1. A row that's
been edited 20 times might have a sys_rowver of 21.
In web applications, when a user can be editing the detail, my SELECT
command that gets the data for the html forms also gets the sys_rowver.
Then, when the user presses "Save changes", the UPDATE command can have the
equivalent of "IDColumn = .vIdColumn AND sys_rowver = .vSys_Rowver"  If it
doesn't find the row, (and SQLCODE says so), it means somebody else probably
updated it in between. So the application can take appropriate action:
"Somebody else just changed the Zip Code to 56085. Do you want to overwrite
that change with 56058?" etc.

On Fri, Mar 13, 2009 at 12:17 PM, Rachael Malberg <
[email protected]> wrote:

>  DITTO!! this cool!! is there a sql statement we could do? something
> like...
>
> update PermTable set PTCol=TTCol from PermTable t1, TempTable T2 where
> t1.ID=t2.ID and t2.SYS_ROWVER>1
>
> or just cursor threw the recs?
>
> ----- Original Message -----
>
> *From:* Dennis McGrath <[email protected]>
> *To:* RBASE-L Mailing List <[email protected]>
> *Sent:* Friday, March 13, 2009 8:46 AM
> *Subject:* [RBASE-L] - Re: How to detect a dirty table?
>
>  My sentiments too!
>
>
>
> Dennis McGrath
>
>
>  ------------------------------
>
> *From:* [email protected] [mailto:[email protected]] *On Behalf Of *
> [email protected]
> *Sent:* Friday, March 13, 2009 8:43 AM
> *To:* RBASE-L Mailing List
> *Subject:* [RBASE-L] - Re: How to detect a dirty table?
>
>
>
> Doug:  Cool!  For years I've considered that column useless, and would
> usually set it permanently off.   Never considered turning it on and off to
> track whether changes are made to a temp table.  I'm glad you brought it up
> because I never would have thought of it on my own!
>
> Karen
>
>
>
> Bingo Karen!  And it isn't as complicated (for my needs) as you suggested.
>
> SYS_ROWVER basically does what Emmitt suggested with triggers but all the
> heavy lifting is done by R:Base: it adds the SYS_ROWVER column, sets it to 1
> for all rows, creates the trigger and increments SYS_ROWVER each time a col
> in a row is changed. So any changed row will have a SYS_ROWVER value >1, I
> don't even need to compare it to the original table. woohoo!
>
>
>
>

Reply via email to