Re: ESQL/C cursor looping
Posted in 1996
Allen W. Jantzen wrote: > > In ESQL/C when I am cycling through the rows returned by a cursor, if > an error occurs on the fetch (say, SQLCODE=-244 record locked), does > it make any sense to attempt to keep fetching additional rows?? > It depends on your application. Do you intend to change the row? Can you survive by using a dirty read? Can you afford to wait for the row to be released? How long? What other application is locking the row? Is it a long transaction? Can it be shortend ? > Or is the whole cursor (and any remaining rows) screwed up at that > point and I should just immediately bail out of the loop ??? > If you are doing page locking and all the rows will be in the same page, then you might as well punt. It all depends on your design of the app and database. > ******************************************************************************* > Also: > If a row is added to a table while I am in the middle of cycling > through a cursor for that table, will I see the new row in my loop??? > > Or does the cursor only "see" rows that were present at the time of > the OPEN??? > > Any help appreciated. Good question! Going from memory, (Keep in mind I have altzheimers(?sp) ;-) .... A scroll cursor will have a static list of rows. I think it occurs either at the open statement or the first fetch. I think that the regular cursor will get the new rows, but I am not sure. -Mikey