Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: Function Index > C > CVAL

DATABASE

Scroll Prev Top Next More

(CVAL('DATABASE'))

 

Returns a text string containing the current connected database or NULL if the user is not connected to a database. This can be used to ensure that the user is connected before trying to execute some code. The example below shows how this might work.

 

SET VAR vDB = (CVAL('DATABASE'))

IF vDB IS NULL THEN

 CONNECT MyDB

ENDIF

 

SET VAR vDB = (CVAL('DATABASE'))

IF vDB IS NULL THEN

 PAUSE 2 USING 'MyDB is currently unavailable'

ENDIF

 

The check is repeated to ensure that the attempt to connect to the database was successful before continuing with the command file.