Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: Reference Index > Foreign Data Sources and ODBC

About the SYS_ROWVER Column

Scroll Prev Top Next More

If you have ever used Oterro to generate or alter tables you may have noticed that those tables get a new column added to the end; the SYS_ROWVER column.

 

The SYS_ROWVER column is a computed integer column that contains the version of the row. Its formula is as follows:

(IFNULL((SYS_ROWVER+1),0,(SYS_ROWVER+1))).

 

This translates to the following: If the existing SYS_ROWVER is null then the row version is one. Otherwise increment the row version by one.

 

This is used, in most cases, by outside programs that do not have access to the internal R:BASE concurrency system (Table Locking, Row Locking, Page Locking, Column vs Row Verification and so on.) For this reason, Oterro defaults to AUTOROWVER ON and R:BASE defaults to OFF. When AUTOROWVER is ON any CREATE TABLE or ALTER TABLE adds the SYS_ROWVER column to the table being altered or created.

 

Examples

 

For example, let's assume you were working with an application that connected to R:BASE via Oterro. You might see...

 

SEL ROWID,FNAME,SYS_ROWVER +

  INTO vROWID,vFNAME,vROWVER+

  FROM TABLENAME WHERE CRITERIA

 

Something happens where the user edits the data...

 

SEL SYS_ROWVER INTO vNEWVER +

  WHERE ROWID=vROWID

 

IF vNEWVER = vROWVER THEN

  UPDATE TABLE +

     SET COLUMN FNAME = vFNAME +

     WHERE ROWID = vROWID

ELSE

 

  DIALOG 'The row you are editing has been changed by another user. Continue?' +

     vRESP vEND YES

 

--Continue with code that either processes the update anyways or that

--allows end user to resolve the conflict or that does something else.

 

ENDIF