DATABASE
Top  Previous  Next

(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
          CONN 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.