The mi_sysname() function

The mi_sysname() function obtains the name of the default database server.

Syntax

char *mi_sysname(sysname)
   char *sysname;
sysname
The name of the system or a NULL-valued pointer.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

Client only: In a client LIBMI application, the mi_sysname() function obtains or sets the default database server name to sysname. The function returns the previous value of the name of the default database server so you can save it and set it back to its original value. The sysname value can be set to any of the following values:
  • A string that specifies a database server name

    The value in sysname must be defined in the server-definition file. Therefore, if the sysname value does not match an entry in this file, mi_sysname() returns a NULL-valued pointer.

    On UNIX or Linux, the sqlhosts file defines system names.

    On Windows, the Registry defines system names.

  • A NULL-valued pointer

    The mi_sysname() function returns the name of the current default database server. If a connection has not been established, there is no current default database server. The mi_sysname() function returns the string "default" to indicate that the current system is the default database server, which is initialized to the INFORMIXSERVER environment variable.

Server only: In a C UDR, the mi_sysname() function accepts only a NULL-valued pointer as sysname and returns the current default database server name; that is, the value of the INFORMIXSERVER environment variable. You cannot change the value of INFORMIXSERVER from within a C UDR.

The mi_sysname() function initializes the DataBlade® API when it is the first DataBlade® API function in a client LIBMI application or C UDR routine.

Return values

A char pointer
A pointer to the current system name.
NULL
The function was not successful.