Browse mode

NoteBrowse mode is included to provide compatibility with Open Client libraries older than version 11.1. Sybase discourages its use in Open Server Server-Library applications, because cursors provide the same functionality in a more portable and flexible manner. Additionally, browse mode is Sybase-specific and is not suited for use in a heterogeneous environment.

Browse mode provides a means for searching through database rows and updating their values one row at a time. From the standpoint of a client application program, the process involves several steps, because each row must be transferred from the database into client application program variables before it can be browsed and updated.

Because a row being browsed is not the actual row residing in the database but a copy residing in program variables, the program must update the original database row with changes made to the variables’ values. In multiuser situations, the program must ensure that updates made to the database by one user do not overwrite recent updates made by another user. Such overwrites occur because a client application typically selects a number of rows from a database to update at one time, but the application’s users browse and update the database one row at a time. A timestamp column in browsable tables provides the information necessary to regulate this type of multiuser updating.

Client applications that permit users to enter ad hoc browse mode queries must update underlying database tables if a user command alters a table’s contents. Consequently, these applications may need information about the underlying structure of a browse mode command.

Open Server includes two routines that provide such information, srv_tabname and srv_tabcolname:

An Open Server application that receives browse mode requests can call these two routines, along with the standard data binding routines, to return browse mode information. The specific steps are:

  1. Call srv_tabname once for each table that is the source of a result row.

  2. Call srv_descfmt followed by srv_tabcolname once for each column in the result row.

    If the Open Server application has set the status field of the CS_BROWSEDESC structure to CS_RENAMED, this means that the client application’s browse mode select statement renamed the column. The Open Server application must fill in the original name of the column in the database, and the length of its name, in the origname and orignlen fields in the CS_BROWSEDESC structure prior to calling srv_tabcolname.

  3. Bind and transfer the column data using the srv_bind and srv_xferdata routines, respectively.

NoteBecause srv_tabcolname requires information returned by srv_tabname—the unique table numbersrv_tabname must precede a call to srv_tabcolname.

For more information on browse mode, see the Sybase Open Client Client-Library/C Reference Manual.