DB2 Version 10.1 for Linux, UNIX, and Windows

sqlbotsq API - Open a table space query

Prepares for a table space query operation, and returns the number of table spaces currently in the database.

Important: This command or API has been deprecated in Version 9.7 and might be removed in a future release. You can use the MON_GET_TABLESPACE and the MON_GET_CONTAINER table functions instead which return more information. For more information, see LIST TABLESPACES and LIST TABLESPACE CONTAINERS commands have been deprecated.

Authorization

One of the following authorities:
  • SYSADM
  • SYSCTRL
  • SYSMAINT
  • SYSMON
  • DBADM
  • LOAD

Required connection

Database

API include file

sqlutil.h

API and data structure syntax

SQL_API_RC SQL_API_FN
  sqlbotsq (
   struct sqlca * pSqlca,
   sqluint32 TablespaceQueryOptions,
   sqluint32 * pNumTablespaces);

SQL_API_RC SQL_API_FN
  sqlgotsq (
   struct sqlca * pSqlca,
   sqluint32 TablespaceQueryOptions,
   sqluint32 * pNumTablespaces);

sqlbotsq API parameters

pSqlca
Output. A pointer to the sqlca structure.
TablespaceQueryOptions
Input. Indicates which table spaces to process. Valid values (defined in sqlutil) are:
SQLB_OPEN_TBS_ALL
Process all the table spaces in the database.
SQLB_OPEN_TBS_RESTORE
Process only the table spaces that the user's agent is restoring.
pNumTablespaces
Output. The number of table spaces in the connected database.

Usage notes

This API is normally followed by one or more calls to sqlbftpq, and then by one call to sqlbctsq.

An application can use the following APIs to fetch information about the currently defined table spaces:
  • sqlbstpq

    Fetches information about a given table space. Only one table space entry is returned (into a space provided by the caller). Use this API when the table space identifier is known, and information about only that table space is desired.

  • sqlbmtsq

    Fetches information about all table spaces. The API allocates the space required to hold the information for all table spaces, and returns a pointer to this information. Use this API to scan the list of table spaces when searching for specific information. Using this API is identical to calling the three APIs mentioned in the following list, except that this API automatically allocates the memory for the output information. A call to this API must be followed by a call to sqlefmem to free the memory.

  • sqlbotsq
  • sqlbftpq
  • sqlbctsq

    These three APIs function like an SQL cursor, in that they use the OPEN/FETCH/CLOSE paradigm. The caller must provide the output area for the fetch. Unlike an SQL cursor, only one table space query may be active at a time. Use this set of APIs to scan the list of table spaces when searching for specific information. This set of APIs allows the user to control the memory requirements of an application (compared with sqlbmtsq).

When sqlbotsq is called, a snapshot of the current table space information is buffered in the agent servicing the application. If the application issues a second table space query call (sqlbmtsq or sqlbotsq), this snapshot is replaced with refreshed information.

No locking is performed, so the information in the buffer may not reflect more recent changes made by another application. The information is not part of a transaction.

There is one snapshot buffer for table space queries and another for table space container queries. These buffers are independent of one another.