The mi_get_serverenv() function
The mi_get_serverenv() function obtains information from the server environment.
Syntax
mi_integer mi_get_serverenv(name, value)
const char *name;
char **value;
- name
- A pointer to the name of the server-environment information to obtain.
- value
- A pointer to the value to obtain from the server-environment information that name references.
Valid in client LIBMI application? | Valid in user-defined routine? |
---|---|
No | Yes |
Usage
The mi_get_serverenv() function obtains a copy of the value assigned to the
server-environment information that name references. The server environment describes the
environment of the database server in which the UDR executes. The name buffer can contain any
of the following server-environment information:
- The name of the HCL Informix® environment variable
- The name of a configuration parameter in the database server onconfig file
Tip: The mi_get_serverenv() function is similar in functionality
to the operating-system call getenv(), except that
mi_get_serverenv() can only retrieve the value of the Informix® environment variable.
If the item in the name buffer has multiple
occurrences in the server environment, mi_get_serverenv() returns
the first occurrence from the following list:
- The InetLogin login structure (Windows™)
- The Windows™ Registry
- The onconfig file (for configuration parameters)
- The default value (if one exists)
For GLS, the mi_get_serverenv() function performs any necessary code-set conversion on the values of server-environment information from the client code set to the code set of the current processing locale.
The mi_get_serverenv() function
copies the current value into the buffer that value references.
The function allocates memory for the value buffer in the current
memory duration. When you no longer need this buffer, free this memory.
If the name buffer specifies some entity that is undefined
in the server environment, the mi_get_serverenv() function
takes the following actions:
- It sets value to a NULL-valued pointer.
- It returns a value of MI_OK.
Return values
- MI_OK
- The function was successful or the specified server-environment information is undefined.
- MI_ERROR
- The function was not successful. The arguments are not valid pointers or memory cannot be allocated for the value that name references.