db_id

Returns the current database connection ID.

Available in:

Apps (win) Apps (char) Reportwriter RPC Standalone PL
X X X X X

Syntax

int db_id()

Description

Refer to trim.h for the possible db_id() values.

Example

Executes a different SQL statement based on current database connection.
if (db_id() == db_oracle)
  ll = list_open("SELECT decode(ID,1,'Clerk',2,'Mgr','Unknown') "
                 "FROM staff",100);
else if (db_id() == db_rdb){
  ll = list_open("SELECT id FROM staff",100);
  while (true) {
    list_modcol(ll,0,decode(list_curr(ll,0),1,"Clerk",2,"Mgr","Unknown"));
    if(list_pos(ll) == list_next(ll))break;
    }
  }