Skip to content

How to scroll backwards in an scrollable result #201

@unficyp

Description

@unficyp
  1. What version of ODPI-C are you using (see dpi.h)?
    5.6.2

  2. What OS (and version) is your application on?
    Linux/Manjaro

  3. What compiler (and version) did you use?
    g++ 15.2.1

  4. What is your version of the Oracle Client (e.g. Instant Client)? How was it installed? Where it is installed?
    instantclient 23.9

  5. What is your Oracle Database version?
    19.26

  6. What is the PATH environment variable (on Windows) or LD_LIBRARY_PATH (on Linux) set to?
    /home/oracle/instantclient_23_9

  7. What environment variables did you set? How exactly did you set them?

  8. What problem or error(s) you are seeing?
    dpiStmt_fetch misbehaves then scrolling backwards.

  9. Do you have a runnable code snippet to describe the problem?
    is attached

please see the attached code.
code fetches from query (select level from dual connect by level<=5) in forward mode. after that, the "resultset" points to the row with level value 5. then i do a loop with dpiStmt_scroll DPI_MODE_FETCH_PRIOR and a dpiStmt_fetch - so basically a reverse fetch.
the output:

reverse: loop: 1 - found: 1 buff: 3
lvl-prior: 4
reverse: loop: 2 - found: 1 buff: 2
lvl-prior: 3
reverse: loop: 3 - found: 1 buff: 1
lvl-prior: 2
reverse: loop: 4 - found: 1 buff: 0
lvl-prior: 1
reverse: loop: 5 - found: 1 buff: 0
lvl-prior: 4
reverse: loop: 6 - found: 1 buff: 0
lvl-prior: 4
reverse: loop: 7 - found: 1 buff: 0
done

Why does the variable "found" have the value 1 in line "reverse: loop: 5 - found: 1 buff: 0" ?
shouldnt this be 0 to mark the "end" of the resultset?
Why does the last dpiStmt_getQueryValue fetch the value 4 for the lvl again?

thx&regards,
gerald

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpatch availableAwaiting inclusion in official release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions