Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - Database Administration » Database administration tools and utilities » Database administration utilities » Configuration files

Conditional parsing in configuration files

You can use conditional parsing in configuration files to specify the utilities that can use the file.

configuration-file= text...
text : comment | conditional | command-line-option
comment : line starting with # that is not a conditional
conditional :
#if  condition
   [ #elif  condition
   ] ...
   [ #else
 ] ...
condition : { tool=utility-name[,utility-name]... | utility-name }

The following values are supported for utility-name:

dbbackup dbinfo dbmlsync dbstop dbxtract
dbdsn dbinit dbping dbsupport mlsrv
dbeng dblic dbremote dbsvc mluser
dberase dblocate dbspawn dbunload qaagent
dbfhide dblog dbsrv dbupgrad mlstop
dbhist dblsn dbstats dbvalid  

Conditional directives allow command parameters to be included or excluded depending on the utility using the file. The File Hiding utility (dbfhide) can still be used to encrypt the contents of a configuration file when conditional parsing is used in the file.

To be treated as a directive, the first non-whitespace character on a line must be #. When a utility is encountered in an #if or #elif directive, the lines that follow the directive are included until another conditional directive is encountered. The #else directive handles the condition where the utility has not been found in the preceding blocks. The #endif directive completes the conditional directive structure.

Blank spaces are not permitted anywhere within the list of tool names specified by tool=. You can nest conditional directives. If an error occurs while parsing the configuration file, the utility reports that the configuration file cannot be opened.

The dbspawn utility allows you to specify a configuration file reference in the command to be spawned, but you cannot specify a configuration file with options for the dbspawn utility. For example, the first command below is supported, but the second command is not supported:

dbspawn dbeng17 @myconfig.ini 

dbspawn @spawnopts.ini dbeng17 demo.db


The following configuration file can be used by dbping, dbstop, and dbvalid.

#if tool=dbping,dbstop,dbvalid
   #always make tools quiet
   -c "UID=DBA;PWD=passwd;Host=myhost;DBN=mydb"
   #if dbping
      #make a database connection
   #elif tool=dbstop
      #don't ask
      #must be dbvalid