Product Documentation

SQL Operations Guide

Previous Topic

Next Topic

fc_set_rowid_visible()

Set an existing ROWID column as visible for a given table.

fc_set_rowid_visible('owner', ‘table’, ‘rowid’, ‘rowid_idx’);

Description

A hidden ROWID column is created on tables created via FairCom DB SQL and it's c-treeDB layer. This column has a special internal name of $ROWID$. This column is based on the serial segment auto-numbering index mode and thus creates a unique permanent id value for each row. fc_set_rowid_visible() sets an existing c-treeDB ROWID field as visible with a given column name. This allows the unique row number to be easily used in queries. Note, the ROWID column cannot be updated. Also, the row associated with a given ROWID column can be repositioned

A check is made that the table exists, and has a ROWID field. SQL_ERR_NOTBL or SQL_ERR_NOCOL is returned if not.

A check is made that the rowid isn’t already exposed with that id name - if so, it fails with a duplicate column exception.

Parameters

owner - Should match existing table owner, or the internal get table ID call doesn’t work.

table - table name with the ROWID to expose.

rowid - symbolic name of the exposed ROWID field

rowid_idx - assigned name for the ROWID index

Example

ISQL> call fc_set_rowid_visible('admin', 'test1', 'id', 'id_idx');

0 records returned

ISQL> select col from syscolumns where tbl='test1';

COL

---

name

age

rating

id

4 records selected

ISQL> table test1

COLNAME NULL ? TYPE LENGTH CHARSET NAME COLLATION

------- ------ ---- ------ ------------ ---------

id NOT NULL BIGINT 8

name CHAR 10

age INT 4

rating TINYINT 1

Limitations

This should only be called once for any given table. Unpredictable results can potentially happen with repeated executions.

TOCIndex