Newbie, V4RB - new issue with cursors

Mike Dodd doddme at mindspring.com
Mon Nov 17 19:41:00 CST 2003


I am having some trouble with cursors -

Function A has a cursor in READ/WRITE mode because I will delete from within
this function.  It has several records, I run through these records within a
loop, I call Function B from within Function A :  I try to get another
cursor - READ ONLY  mode with that same record - the cursor comes back Nil

I think I know what is happening - the cursor in Function A has a LOCK on
the records, so when Function B cursor tries to go out there it cannot get
those records, BUT I believe that since it is for READ only access it should
allow for it.   Granted I worked around the problem with a global cursor for
the window.

I tested by changing the mode in Function A to READ ONLY, the Function B
cursor was able to open the records for READING.


On 11/17/03 1:16 AM, "Ruslan Zasukhin" <sunshine at public.kherson.ua> wrote:

> on 11/17/03 5:30 AM, Mike Dodd at doddme at mindspring.com wrote:
> 
> Hi Mike,
> 
> Hmm, it seems you do wrong things.
> 
> You obtain from cursor RecID of a record,
> And now try to use BaseObject API to delete it!
> 
> But cursor still exists so it keep lock on that record.
> Therefore BaseObject cannot delete it.
> That's the problem.
> 
> Why you do not want simply
> 
>   curs.Delete()
> 
> ?
> 
>> Why would I not be able to delete a record that was added to a table?
>> 
>> if job_cursor.firstRecord then
>>   do
>>     if run_job(job_cursor.field("recid").getstring) then
>>       l_recid = val(job_cursor.field("recid").getstring)
>>       if app.mdatabase.mjobs.gotorecid(l_recid) then
>>         if app.mdatabase.mjobs.deleterecord() then
>>           writeLog("Inside Poll for jobs -Record Deleted")
>>         else
>>           writelog("Inside Poll for jobs - could not delete the record")
>>         end if
>>       end if
>>     end if
>>   loop until job_cursor.nextrecord = FALSE
>> 
>> 
>> I add the record and I even tried 'flushing' the record, (which works fine,
>> because my test records keep accumulating as expected).
>> 
>> I tried deleting off the cursor itself and it fails too.



More information about the Valentina mailing list