Data structures for communicating with servers

A DB-Library/C application communicates with a server through one or more DBPROCESS structures. Through the DBPROCESS, commands are sent to the server and query results are returned to the application. One of the first routines an application typically calls is dbopen, which logs the application into the server and allocates and initializes a DBPROCESS. This DBPROCESS then serves as a connection between the application and the server. Most DB-Library/C routines require a DBPROCESS as the first parameter.

An application can have multiple open DBPROCESSes, connected to one or more servers. For instance, an application that has to perform database updates in the midst of processing the results of a query needs a separate DBPROCESS for each task. As another example, to select data from one server and update a database on another server, an application needs two DBPROCESSes—one for each server. Each DBPROCESS in an application functions independently of any other DBPROCESS.

The DBPROCESS structure points to a command buffer that contains language commands for transmission to the server. It also points to result rows returned from the server—either single rows or buffers of rows if buffering has been specified. In addition, it points to a message buffer that contains error and informational messages returned from the server.

The DBPROCESS also contains a wealth of information on various aspects of server interaction. Many of the DB-Library/C routines deal with extracting information from the DBPROCESS. Applications should access and manipulate components of the DBPROCESS structure only through DB-Library/C routines, and not directly.

One other important structure is the LOGINREC. It contains typical login information, such as the user name and password, which the dbopen routine uses when logging into a server. DB-Library/C routines can specify the information in the LOGINREC.