sqldynposfetch() — Fetch Row of Dynamic Open Cursor

Fetches the specified row of a dynamic open cursor.

This function returns normalized values:

SYNTAX
int
sqldynposfetch ( sqln, orientation, psqlin, psqlda)
  SQLRQHDL    *sqln;    /* INPUT */
  int         orientation;    /* INPUT */
  struct    SQLVAR_T    *psqlin;    /* INPUT */
  struct     SQLDA_T      *psqlda;    /* OUTPUT */ 

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

This example executes an absolute fetch of the data in row 50:

#include "proesql.h"
static SQLRQHDL *sql1 = (SQLRQHDL *) 0;
SQLVAR_T  t_scroll_pos;
long    scroll_amt; 
t_scroll_pos.data = &scroll_amt;
t_scroll_pos.indicator = NULL;
t_scroll_pos.type = SQLDAINT;
     .
     .
     .
/* EXEC SQL FETCH C1 INTO DESCRIPTOR psqlda; */
     
{
  scroll_amt = 50;
  sqlcdbind(&SQLCODE, (char *)0);
  sqldynposfetch(sql1,ESQL_FETCH_ABSOLUTE,&t_scroll_pos,psqlda);
}
if (SQLCODE == 100) break;   /* NOT FOUND means invalid position */ 

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