Using Browse mode

Conceptually, using Browse mode involves two steps:

  1. Select rows containing columns derived from one or more database tables.

  2. Where appropriate, change values in columns of the result rows (not the actual database rows), one row at a time, and use the new values to update the original database tables.

These steps are implemented in a program as follows:

  1. Set a connection’s CS_HIDDEN_KEYS property to CS_TRUE. This ensures that Client-Library returns a table’s timestamp column as part of a result set. In browse-mode updates, the timestamp column is used to regulate multiuser updates.

  2. Execute a select...for browse language command. This command generates a regular row result set. This result set contains hidden key columns (one of which is the timestamp column) in addition to explicitly selected columns.

  3. After ct_results indicates regular row results, call ct_describe to get CS_DATAFMT descriptions of the result columns:

  4. Call ct_bind to bind the result columns of interest. An application must bind all hidden columns because it requires these column values to build a where clause at update time.

  5. Call ct_br_table, if necessary, to retrieve information about the database tables that underlie the result set. Call ct_br_column, if necessary, to retrieve information about a specific result set column. Both of these types of information are useful when building a language command to update the database.

  6. Call ct_fetch in a loop to fetch rows. When a row is fetched that contains values that need to be changed, update the database table(s) with the new values. To do this:

After one browse-mode row has been updated, the application fetches and process the next row.