sqldynposfetch() — Fetch Row of Dynamic Open Cursor
Fetches the specified row of a dynamic open cursor.
This function returns normalized values:
sqln
A pointer to the request handle for the open cursor. For more information on request handles, see the "SQL Request Handles" section.
orientation
Specifies which row to fetch. Use one of the following values defined in
proesql.h
: ESQL_FETCH_NEXT, ESQL_FETCH_FIRST, ESQL_FETCH_LAST, ESQL_FETCH_PREV, ESQL_FETCH_ABSOLUTE, or ESQL_FETCH_RELATIVE.You must supply a numeric value for ESQL_FETCH_ABSOLUTE and ESQL_FETCH_RELATIVE. ESQL_FETCH_ABSOLUTE uses a
row number relative to the beginning of the cursor, beginning with 1. ESQL_FETCH_RELATIVE uses a positive or negative relative position, including 0, which re-fetches the same row.psqlin
The integer that specifies the row. This is required only for ESQL_FETCH_ABSOLUTE and ESQL_FETCH_RELATIVE.
psqlda
The pointer to the SQL descriptor area that receives the column data values. Be sure to allocate data storage for each column in the descriptor area.
NOTES
EXAMPLE
- Currently, no embedded SQL statement uses this call.
- To use orientations other than ESQL_FETCH_NEXT, set ESQL_SCROLLABLE_STATIC with
sqlsetlogoption()
prior to preparing the SELECT statement withsqldynprep()
.- For a scrollable cursor to support positioned updates and deletes, correlated subqueries must not occur in the query (in addition to the normal restrictions on cursor updates).
- Fetch orientation,
psqlin
combinations that specify a row beyond the end or before the beginning of available rows will yield sqlcode = 100, and sqlstate = 02000.- Once a row has been fetched or fetched past, and you re-fetch the same row later, it may or may not be sensitive to intervening updates or deletes. Do not assume that the row is sensitive, since sensitivity depends on many features of the query.
- If a cursor is sensitive to updates and deletes, each re-fetch of a row displays its most recent updated state. If a referenced table row has been deleted, then a sensitive cursor returns sqlcode = -1, sqlstate = 50000 on an attempt to fetch from that position. The
sqlgetmst()
call retrieves messages that indicate which table had a deletion that undermines the requested cursor position. In the case of a sensitive join query, any one of several tables could be involved.- This routine fails to conform to the ANSI-SQL92 scrollable cursor behavior in one respect: negative absolute positions between -1 and -(cursor cardinality) are valid according to SQL92, and name the last row through the first row, respectively. The
sqldynposfetch()
call does not implement this feature. Negative absolute positions return sqlcode=100, sqlstate=50000, and you are left positioned before the first row.- There are no restrictions on what queries may be used in scrollable cursors. Any supported SQL query may be scrolled if the cursor is prepared with ESQL_SCROLLABLE_STATIC.
This example executes an absolute fetch of the data in row 50:
SEE ALSO
sqlfetch() — Fetch Next Row of Open Cursor for static fetches, sqldynftch() — Fetch Next Row of Dynamic Cursor for dynamic fetches, and sqlsetlogoption() — Set a Session-wide Option to enable/disable scrollable cursors.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |