Page 1 of 1
dc_dbskip(0) in 256
Posted: Mon May 14, 2012 1:35 am
by skiman
Hi Roger,
Since 256 a problem was reported in my application. I checked and it seems to me that dc_dbskip(0) behaves different as before?
Code: Select all
nSkip := xxx
alias->(dc_eof()) // result .F.
alias->(dc_dbskip(nSkip))
alias->(dc_eof()) // result .T. if nSkip is 0 !!
Before I never had this problem. With dc_dbskip(0) nothing happened, as I expect it should be.
Re: dc_dbskip(0) in 256
Posted: Mon May 14, 2012 1:59 am
by skiman
Roger,
I checked the code in _dcscope.prg and it seems as there is a problem when nRecords == 0.
I added the following on line 368
Code: Select all
if valtype(nRecords)=="N" .and. nRecords == 0
return 0
endif
This seems to be working for me. Can you check this and add it also in _dcscope.prg?
Re: dc_dbskip(0) in 256
Posted: Mon May 14, 2012 8:20 am
by rdonnay
Chris -
eXpress++ has had no changes to DC_dbSkip() in many years so there should be no change in behavior in build 256. i just realized, however, that I never tested DC_DbSkip(0) and found that I never added code to deal with this condition.
This is from the Xbase++ docs:
Note: If <nRecords> is 0, DbSkip() attempts to reload the current record, furthermore current filter/scope and deleted conditions are evaluated. If the current record no longer is visible, DbSkip() moves the record pointer to the next visible record. This behaviour is different from Clipper's.
I suggest adding the following code at line 480 instead of your solution.
Code: Select all
IF Empty(nDidSkip)
RETURN dbSkip(0)
ENDIF
Re: dc_dbskip(0) in 256
Posted: Tue May 15, 2012 12:18 am
by skiman
rdonnay wrote:
I suggest adding the following code at line 480 instead of your solution.
Code: Select all
IF Empty(nDidSkip)
RETURN dbSkip(0)
ENDIF
This isn't working. After changing and compiling dclipx.
Code: Select all
wtf stockspecs->(eof()) // .F.
nSKips:=0
stockspecs->(DC_DbSkip(nSkips))
wtf stockspecs->(eof()) // .T.
Re: dc_dbskip(0) in 256
Posted: Tue May 15, 2012 7:33 am
by rdonnay
I'm confused. What is it that you expect DC_DbSkip(0) to do?
I will make the change to the code as you requested since nobody else is has reported any problem.
Re: dc_dbskip(0) in 256
Posted: Tue May 15, 2012 8:11 am
by skiman
Hi Roger,
This is my code:
Code: Select all
Stockspecs->(dc_dbgotop())
...
nSkip := xxx
...
stockspecs->(dc_dbskip(nSkip))
After the dc_dbskip(0) stockspecs->(dc_eof()) returns .T. This is not what I want.
I'm using dc_setscopearray(aArray) a lot. For me it is one of the most important functions of eXPress++. Especially the fact that the aArray can be multidimensional is given this function a lot of possibilities. I think there are not many users who are using this. I will use it in combination with Arctica. SQL to receive the array with results, dc_setscopearray to work as before.
Re: dc_dbskip(0) in 256
Posted: Tue May 15, 2012 8:33 am
by rdonnay
After the dc_dbskip(0) stockspecs->(dc_eof()) returns .T. This is not what I want.
That is very interesting. Now I understand.
I agree that DC_SetScopeArray() is very powerful. I use it a lot.