20. Writing 4GL Statements : Inquiring About and Setting Applications Status : Using the Dbmsinfo Function
 
Share this page                  
Using the Dbmsinfo Function
You can use the 4GL dbmsinfo function in a select statement to furnish information about the current Ingres process, such as the Ingres release, the transaction state, or the username. Use this syntax:
select fieldname = dbmsinfo ('request name');
where fieldname is the name of a field into which the dbmsinfo result is retrieved, and request name is a quoted string corresponding to a Ingres constant. The following assignment statement displays the release number of the current Ingres release in the "charfld" field on the form.
select charfld = dbmsinfo('_version');
This example displays the current user's Ingres user name:
select charfld = dbmsinfo('username')
To compare the values of two dbmsinfo results, you must select the results into fields or variables. The next 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.
select 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;
The dbmsinfo function is not accessible directly through 4GL. If you use it outside of a database access statement, Ingres generally returns the empty string. No error message is issued.
For more information on the dbmsinfo function, see your query language reference guide.