Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Pro*C/C++ - How do I OPEN CURSOR and FETCH in different fucntions
I am using Pro*C/C++ and need to have a function that sets up a cursor and opens it but I do not need to fetch at this time. I need to fetch from another function. How do I fetch in one function using a cursor declared and opened in another function? Is in possible to declare a cursor globally or as a member of a class?
This is what I am trying to do. If you have a better idea let me
know.
I am creating a class for other developers in which they issue a
select statement and then move through the rows with a MoveNext
function which sets variables to the data selected. I currently have
the open and fetch in the same function and I load up a linked list
with all the data. My MoveNext function iterates through the list and
sets variables to the current items in the list. On the next MoveNext
call I move to the next element in the list. This causes two
problems:
1) My Select fucntion is huge and hard to follow becasue all the
descriptor information (for dynamic SQL), the cursor logic, and the
linked list logic. If I keep this method I would at least like to
break it into multiple functions but am having problems becasue the
cursor can only be fetched in the function in which it is declared.
2) On selects with many columns and rows the linked list grows
huge and consumes much memory. As the user iterates thorugh the list
and stores the values in other ways (an Array, Container, or their own
list) this doubles the amount of memory used.
Thanks,
Don chambers_at_inquiregroup.comReceived on Tue May 02 2000 - 00:00:00 CDT
![]() |
![]() |