Option settings
In order to provide application settings, ODABA supports options, which allow assigning an option value to an option name. Option names are case insensitive names corresponding to the default encoding of the application. There are several system options controlling common behavior of the GUI framework and the database. Other options might be created by the user. Standard options for database applicationsare described in option reference (Reference documentation / Common ODABA options). GUI framework options are described in the ODABA GUI reference documentation.
ODABA supports an option hierarchy, which might be filled from different sources. How to access options in an ODABA application is described in the odaba::Option class reference (Reference documentation / ODABA application interface / Helper classes).
Options can be defined on different places depending on the importance of an option:
- System environment - permanent options as the TRACE option for the error log file can be set in the system environment (export/set command). Under Linux, environment variables are case sensitive, but environment variables imported to ODABA application are not, i.e. one must not refer to environment variables differing in upper/lower case, only.
- Configuration or ini-file - Options that are valid for a specific application should be set in a configuration or ini-file passed to the application when starting it.
- Application configuration - User depending options may be stored in user-specific configurations in the application database. Administrating application configurations is supported by the OptionBrowser.
- Application - Temporary options, i.e. options valid while running the application, might be set in the application programs using the odaba::Option class.
Special attention is required to DefaultEncoding option. In order to control text encoding externally, the text data type STRING may be used instead of explicit formats like UTF8 or ASCII. The DefaultEncoding option allows setting the text encoding for all STRING data type values externally. i.e. one may run the same application e.g. with UTF8 or LATIN1 encoding.
Application options will overwrite any option value set before. Application configurations will overwrite all options defined in the configuration when being loaded. Options not set by the application or loaded from the configuration are looked for in the configuration or ini-file. Finally, options not found are searched in the environment.
When an option has been set once, it remains until it is changed by the application, i.e. changes in the configuration or ini-file or in database configurations will not apply immediately.
In order to refresh settings (e.g. applying updated database configurations), the application has to refresh options explicitly (e.g. by reading updated options). In order to read options, several functions are provided in the Option class, which allow setting, reading, comparing or removing options.