IBM Books

Administrative API Reference

sqlbotsq - Open Tablespace Query

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

Authorization

One of the following:

Required Connection

Database

Version

sqlutil.h

C API Syntax



/* File: sqlutil.h */
/* API: Open Tablespace Query */
/* ... */
SQL_API_RC SQL_API_FN
  sqlbotsq (
    struct sqlca * pSqlca,
    unsigned long TablespaceQueryOptions,
    unsigned long * pNumTablespaces);
/* ... */
 

Generic API Syntax



/* File: sqlutil.h */
/* API: Open Tablespace Query */
/* ... */
SQL_API_RC SQL_API_FN
  sqlgotsq (
    struct sqlca * pSqlca,
    unsigned long TablespaceQueryOptions,
    unsigned long * pNumTablespaces);
/* ... */
 

API Parameters

pSqlca
Output. A pointer to the sqlca structure. For more information about this structure, see SQLCA.

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.

Sample Programs

C
\sqllib\samples\c\tabspace.sqc

COBOL
\sqllib\samples\cobol\tabspace.sqb

FORTRAN
\sqllib\samples\fortran\tabspace.sqf

Usage Notes

This API is normally followed by one or more calls to sqlbftpq - Fetch Tablespace Query, and then by one call to sqlbctsq - Close Tablespace Query.

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

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 (sqlbtsq 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.

See Also

sqlbctsq - Close Tablespace Query

sqlbftpq - Fetch Tablespace Query

sqlbstpq - Single Tablespace Query

sqlbmtsq - Tablespace Query.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]