cursors

Florian Bogeschdorfer fb at memedia.de
Tue Aug 30 09:34:49 CDT 2005


> 
> 
> on queen query, bank
> 
>   kServer = 2
> 
>   kReadWrite = 3
> 
>     curs = 0
> 
>     curs = new(xtra "VCursor", GetRef(gMb), query, kServer, kReadWrite)
> 
>     ccurs = GetRecordCount(curs)
> 
> end
> 
> 
> 
> if I use it once, everything is ok, but as soon I try to use it another
> time
> I get error messages.
> 
> 
> 
> error 363
> 
> error 5
> 

Well, error 363 is not documented, but at least you are missing the 3rd flag
in your cursor (I forgot what it means).
You need a new cursor for query changes everytime.

I use these handlers:

on VALselectReturnCursor condition, cs, rw, fd
  --evtl alten Cursor löschen
  if voidP(cs) then cs=2
  if voidP(rw) then rw=1
  if voidP(fd) then fd=2
  --suchen
  c= new(xtra "vCursor", GetRef(VAL_ID), condition,cs,rw,fd)
  if NOT objectP(c) then
    VALerror=ValentinaErrorstring()
    return 0
  end if
  if ValentinaError()<>0 then
    VALerror=ValentinaErrorString()
    return 0
  end if
  return c
end

on VALselectReturnRecord condition, cs, rw, fd
  --evtl alten Cursor löschen
  if voidP(cs) then cs=2
  if voidP(rw) then rw=1
  if voidP(fd) then fd=2
  --suchen
  c= new(xtra "vCursor", GetRef(VAL_ID), condition,cs,rw,fd)
  if NOT objectP(c) then
    VALerror=ValentinaErrorstring()
    return 0
  end if
  if ValentinaError()<>0 then
    VALerror=ValentinaErrorString()
    return 0
  end if
  x= VALgetCurrentRecord(c)
  c=0
  return x
end

on VALcursorRecCount vCursor
  if NOT objectP(vCursor) then
    return 0
  else
    return vCursor.getRecordCount()
  end if
end


They work pretty well

Best regards, Florian



More information about the Valentina mailing list