J. Notes for Users of QUEL : QUEL Notes for the Writing 4GL Statements Chapter : Using the Dbmsinfo Function
 
Share this page                  
Using the Dbmsinfo Function
Use the 4GL dbmsinfo function with a retrieve statement to furnish information about the current Ingres process. Use this syntax:
formname := retrieve (fieldname = dbmsinfo
  (request name))
Formname is the name of the current form, fieldname is the name of a field into which the dbmsinfo results is retrieved, and request name is a quoted string corresponding to an Ingres literal constant containing the desired information.
The following example displays the version number of the current Ingres release in the Charfld field on the form.
thisform := retrieve (charfld =
  dbmsinfo("_version")) ;
This example retrieves and displays the user name of the current user.
thisform := retrieve (charfld = 
  dbmsinfo("username")) ;
To compare the values of two dbmsinfo results, you must retrieve the results into fields in the form. The following example assigns the request names "dba" and "username" to the local variables user1 and user2 and compares them in an if then statement to determine if the current user is the DBA of the database. If so, the statements after the then clause, are processed:
thisform := retrieve (
  user1 = dbmsinfo("dba"),
  user2 = dbmsinfo("username"));
if user1 = user2 then
    perform actions
else
  message
    "You are not the DBA of this database";
  sleep 3;
endif;