dc_dbskip(0) in 256

This forum is for eXpress++ general support.
Post Reply
Message
Author
skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

dc_dbskip(0) in 256

#1 Post 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.
Best regards,

Chris.
www.aboservice.be

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: dc_dbskip(0) in 256

#2 Post 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?
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: dc_dbskip(0) in 256

#3 Post 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
The eXpress train is coming - and it has more cars.

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: dc_dbskip(0) in 256

#4 Post 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.
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: dc_dbskip(0) in 256

#5 Post 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.
The eXpress train is coming - and it has more cars.

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: dc_dbskip(0) in 256

#6 Post 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.
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: dc_dbskip(0) in 256

#7 Post 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.
The eXpress train is coming - and it has more cars.

Post Reply