MDAC 2.5 SDK - ODBC Samples


 

Cursor Demo Menus

This section briefly describes the menu commands in Cursor Demo. For more information about the ODBC functions that are executed by many of the menu items, see the ODBC Programmer's Reference.

STMT Menu

Command Description
New Opens a new statement handle on the current connection.
Connect Closes the current data source connection and connects to a new data source.
Disconnect Disconnects from the current data source.
Sql Opens the Statement dialog box, which enables you to execute an SQL statement.
Table Information Opens the Table Information dialog box, which enables you to query various types of information from the database. It contains the following items:

Tables—Calls SQLTables with the specified arguments.

Columns—Calls SQLColumns to return column information.

Procedures—Calls SQLProcedures for procedure information.

Statistics—Calls SQLStatistics to retrieve index information.

Privileges—Calls SQLTablePrivileges to retrieve privilege information.

Qualifier, Owner, Name, and Type—These edit boxes specify arguments for the ODBC functions. For information about ODBC functions, see the ODBC Programmer's Reference.

Type Information—Use this box to specify calls to SQLGetTypeInfo to return information about the data types supported by the data source.

Options—Opens the Options dialog box, which enables you to set Cursor Demo statement options. The Options dialog box contains the following:

  • Options List Box—Contains the statement attributes for Bind, Concurrency, General, and Scrolling. It enables you to specify values for the selected type.

  • Options Group—Available options for the selected type are displayed in this group. See the descriptions for the following statement options.
    • Bind options. This attribute uses SQLSetStmtAttr with an Attribute value of SQL_ATTR_BIND_TYPE. It enables you to set binding by row, single column, all columns, or a specified row or column number.

    • Concurrency options. This option uses SQLSetStmtAttr with an Attribute value of SQL_ATTR_CONCURRENCY to specify when fetched data can be updated, and a ValuePtr value as follows:

      Read-Only
      Fetched data cannot be updated (uses SQL_CONCUR_READ_ONLY).

      Optimistic by Timestamp
      Fetches will not be updated if the timestamp differs from the original (uses SQL_CONCUR_ROWVER).

      Optimistic by Values
      Fetches will not be updated if the values differ from the original (uses SQL_CONCUR_VALUES).

    • General options. These options appear when General is selected in the Options list box. They include:

      Asynchronous Processing
      This option uses SQLSetStmtAttr with an Attribute value of SQL_ATTR_ASYNC_ENABLE to enable Cursor Demo to perform asynchronous processing.

      Always Fetch First
      This option instructs Cursor Demo to always do SQLExtendedFetch with a FetchOrientation value of SQL_FETCH_FIRST after the successful execution of an SQL statement. If this option is not set, no rows will appear in the result set window until you select one of the commands in the Fetch menu.

      Max column width
      This option sets the maximum length of data that will be retrieved for any column. The maximum limit of this parameter is set in the MAX_MAXBIND definition of the Crsrdemo.h file. Because Cursor Demo allocates space for each column in the rowset, it can run out of memory if too many large columns are bound. Make this value smaller if you run out of memory, or increase it if you want to see more data in large columns. It uses SQLSetStmtAttr with an Attribute of SQL_ATTR_MAX_LENGTH.

    • Scrolling options. These options use SQLSetStmtAttr with an Attribute value of SQL_ATTR_CURSOR_TYPE to specify permissible movement of the cursor, and a ValuePtr value as follows:

      Forward only
      The cursor will scroll in the forward direction only (uses SQL_CURSOR_FORWARD_ONLY).

      Static (scrollable snapshot)
      The cursor will scroll in any direction, but the data will not be updated (uses SQL_CURSOR_STATIC).

      Keyset driven
      The cursor is fully keyset-driven (uses SQL_CURSOR_KEYSET_DRIVEN).

      Dynamic
      The driver saves and uses the keys for only the rows in the rowset (uses SQL_CURSOR_DYNAMIC).

      Rowset size
      Defines the number of rows in your rowset.
Close Closes the current statement.
Close All Closes all open statements.
Exit Exits Cursor Demo.

Fetch Menu

All the Fetch menu items use SQLExtendedFetch with different values for the FetchOrientation argument. For information about SQLExtendedFetch, see the ODBC Programmer's Reference.

Command Description
First Uses SQLExtendedFetch with a FetchOrientation value of SQL_FETCH_FIRST. (Fetches the first rowset in the result set.)
Prev Uses SQLExtendedFetch with a FetchOrientation value of SQL_FETCH_PRIOR. (Fetches the previous rowset in the result set.)
Next Uses SQLExtendedFetch with a FetchOrientation value of SQL_FETCH_NEXT. (Fetches the next rowset in the result set.)
Last Uses SQLExtendedFetch using a FetchOrientation value of SQL_FETCH_LAST. (Fetches the last rowset in the result set.)
Absolute Uses SQLExtendedFetch with a FetchOrientation value of SQL_FETCH_ABSOLUTE. (Fetches the rowset starting at the given absolute row number.)
Relative Uses SQLExtendedFetch with a FetchOrientation value of SQL_FETCH_RELATIVE. (Fetches the rowset starting at the given relative row number.)
Delete Row Deletes the selected row.
Update Row Opens the Update Row dialog box, which enables you to change data in the selected row.

Window Menu

Command Description
Cascade Cascades all open windows.
Tile Horizontal Tiles all open windows horizontally.
Tile Vertical Tiles all open windows vertically.
Arrange Icons Lines up all minimized windows along the bottom of the Cursor Demo workspace.
List Of Open Windows Lists all open windows along with the name of the cursor they represent.

Help Menu

Command Description
Help Opens the ODBC Samples help file.
About Displays version information for Cursor Demo.