Alaska Software Inc. - DbSetScope() - wrong result with records marked as deleted ...
Username: Password:
AuthorTopic: DbSetScope() - wrong result with records marked as deleted ...
Dieter KubeschDbSetScope() - wrong result with records marked as deleted ...
on Thu, 26 Feb 2009 15:24:33 +0100
Hi,

i have a DBF/NTX with following fields:

ACCOUNT, numeric 7,0
DATE, date

and an Index over "str(account,7) + dtos(date)"

Following records are in the DBF,

7630 | 01/30/2009
7700 | 01/05/2009    marked as deleted
7700 | 01/05/2009    marked as deleted
7703 | 01/05/2009    marked as deleted
7800 | 01/31/2009
7810 | 01/31/2009

SET DELETED is set to ON
If i now define a scope
top: "   770020090101"          --> Account 7700, 1.January.2009
bottom: "   770020093112"    --> Account 7700, 31st December 2009

i get as result the record 7800, by means i have in my scope one match. The 
result of the scoped DBF is shown via an XbpBrowse ...

I would expect to get no records in the scope, and EOF() should be .T., so 
my XbpBrowse should show no entries.

Is this a bug, or am i thinking wrong?

XBase Version 1.90.331 Apr 26 2006

Thanks for the help!
Dieter
Thomas Braun
Re: DbSetScope() - wrong result with records marked as deleted ...
on Thu, 26 Feb 2009 16:33:53 +0100
Dieter Kubesch wrote:

> i get as result the record 7800, by means i have in my scope one match. The 
> result of the scoped DBF is shown via an XbpBrowse ...
> 
> I would expect to get no records in the scope, and EOF() should be .T., so 
> my XbpBrowse should show no entries.
> 
> Is this a bug, or am i thinking wrong?

Not sure - could you show the actual code where you are setting the scope?

Did you already have a look at the knowledge base?

thomas
Dieter KubeschRe: DbSetScope() - wrong result with records marked as deleted ...
on Thu, 26 Feb 2009 18:34:53 +0100
Hi Thomas,

i checked the knowledge base, but couldnt find anything appropriate. (I 
also tried, like mentioned in the closed PDR 4673, with SET EXACT OFF, SET 
LEXICAL OFF, also tried to SET RUSHMORE OFF and so on ...)

Except SET DELETED ON, i use the default SET values ...

Heres a code example:

l_kontonr := 7700
l_nJahr := 2009

(l_nKB_WA)->(dbsetscope(SCOPE_TOP,str(l_kontonr,7,0) + 
str(l_nJahr,4)+"0101"))
(l_nKB_WA)->(dbsetscope(SCOPE_BOTTOM,str(l_kontonr,7,0) + 
str(l_nJahr,4)+"1231"))

l_oKontenbrowse := XbpBrowse():new()
      l_oKontenbrowse:goTopBlock    := {|| (l_nKB_WA)->(DbGoTop()) }
      l_oKontenbrowse:goBottomBlock := {|| (l_nKB_WA)->(DbGoBottom()) }
      l_oKontenbrowse:skipBlock     := {|n| (l_nKB_WA)->(DbSkipper(n)) }
      l_oKontenbrowse:phyPosBlock   := {| | (l_nKB_WA)->(Recno())      }
      l_oKontenbrowse:posBlock      := {| | (l_nKB_WA)->(DbPosition())    }
      l_oKontenbrowse:goPosBlock    := {|n| (l_nKB_WA)->(DbGoPosition(n)) }
      l_oKontenbrowse:lastPosBlock  := {| | 100             }
      l_oKontenbrowse:firstPosBlock := {| | 0               }
      l_oKontenbrowse:create():show()


Any ideas?
Dieter
Thomas Braun
Re: DbSetScope() - wrong result with records marked as deleted ...
on Fri, 27 Feb 2009 11:03:34 +0100
Dieter Kubesch wrote:

> Here´s a code example:
[snipped]
> (l_nKB_WA)->(dbsetscope(SCOPE_TOP,str(l_kontonr,7,0) + 
> str(l_nJahr,4)+"0101"))
> (l_nKB_WA)->(dbsetscope(SCOPE_BOTTOM,str(l_kontonr,7,0) + 
> str(l_nJahr,4)+"1231"))

WHERE IS THE dbGotop() call?

regards
Thomas
Dieter KubeschRe: DbSetScope() - wrong result with records marked as deleted ...
on Fri, 27 Feb 2009 12:22:17 +0100
"Thomas Braun" <spam@software-braun.de> schrieb im Newsbeitrag 
news:1xibmb1wwu29u.p4tgpva21g1b$.dlg@40tude.net...
> Dieter Kubesch wrote:
>
>> Heres a code example:
> [snipped]
>> (l_nKB_WA)->(dbsetscope(SCOPE_TOP,str(l_kontonr,7,0) +
>> str(l_nJahr,4)+"0101"))
>> (l_nKB_WA)->(dbsetscope(SCOPE_BOTTOM,str(l_kontonr,7,0) +
>> str(l_nJahr,4)+"1231"))
>
> WHERE IS THE dbGotop() call?
>
> regards
> Thomas

Thomas,

a dbGotop() isnt needed, as it is done implicit by the dbsetscope (see the 
OPEN PDR 5273).
However, i tried with dbgotop, and without, the result is always the same.
I also recreated the NTX, to be sure that the problem isnt there. No 
change.

Dieter
Thomas Braun
Re: DbSetScope() - wrong result with records marked as deleted ...
on Fri, 27 Feb 2009 17:56:40 +0100
Dieter Kubesch wrote:

> a dbGotop() isn´t needed, as it is done implicit by the dbsetscope (see the 
> OPEN PDR 5273).
> However, i tried with dbgotop, and without, the result is always the same.
> I also recreated the NTX, to be sure that the problem isn´t there. No 
> change.

OK - now I'm lost, can't see anything else to try 

All that is left to do is to try and get a PDR at
support@alaska-software.com

regards
Thomas
James Loughner Re: DbSetScope() - wrong result with records marked as deleted ...
on Fri, 27 Feb 2009 12:18:53 -0500
Are you sure you are on the right index when you set the scope?

Jim

Dieter Kubesch wrote:
> "Thomas Braun" <spam@software-braun.de> schrieb im Newsbeitrag 
> news:1xibmb1wwu29u.p4tgpva21g1b$.dlg@40tude.net...
>> Dieter Kubesch wrote:
>>
>>> Here´s a code example:
>> [snipped]
>>> (l_nKB_WA)->(dbsetscope(SCOPE_TOP,str(l_kontonr,7,0) +
>>> str(l_nJahr,4)+"0101"))
>>> (l_nKB_WA)->(dbsetscope(SCOPE_BOTTOM,str(l_kontonr,7,0) +
>>> str(l_nJahr,4)+"1231"))
>> WHERE IS THE dbGotop() call?
>>
>> regards
>> Thomas
> 
> Thomas,
> 
> a dbGotop() isn´t needed, as it is done implicit by the dbsetscope (see the 
> OPEN PDR 5273).
> However, i tried with dbgotop, and without, the result is always the same.
> I also recreated the NTX, to be sure that the problem isn´t there. No 
> change.
> 
> Dieter
> 
> 
> 
> 
>
Dieter KubeschRe: DbSetScope() - wrong result with records marked as deleted ...
on Mon, 02 Mar 2009 10:35:13 +0100
James,
as i am
(i checked again, to be really sure .... sometimes you dont see the wood 
because of all the trees ...)
I posted a small example PRG and DBF which shows the "bug", maybe you like 
to test?

Dieter


"James Loughner" <jwrl@suddenlink.net> schrieb im Newsbeitrag 
news:54000756$5398a14a$5b3@news.alaska-software.com...
> Are you sure you are on the right index when you set the scope?
>
> Jim
>
James Loughner Re: DbSetScope() - wrong result with records marked as deleted ...
on Mon, 02 Mar 2009 11:59:03 -0500
I don't see this problem in my code but then I clear the deleted record
and set a main index field to an imposable value like "!!!!!" for
strings etc. This allows reuse of the deleted record but also would get
it out of the way of this apparent bug.


I use this to clear the records

PROCEDURE ClearRecord(cField,xVal)
LOCAL I,PrvScope,NextRec,nRec
   nRec := RecNo()
   DBSkip()
   NextRec := RecNo()
   DBSkip(-1)
   PrevScope := DBScope(SCOPE_BOTH)
   DBClearScope()
   IF LockRec()
      FOR I = 1 TO FCount()
         DO CASE
            CASE DBStruct()[I,2] = "C"
               FieldPut(I,"")
            CASE DBStruct()[I,2] = "L"
               FieldPut(I,.F.)
            CASE DBStruct()[I,2] = "N"
               FieldPut(I,0)
            CASE DBStruct()[I,2] = "D"
               FieldPut(I,CTOD(""))
            CASE DBStruct()[I,2] = "M"
               FieldPut(I,"")
         ENDCASE
      NEXT I
      IF !EMPTY(cField).AND. !EMPTY(xVal)
         FieldPut(FieldPos(cField),xVal)
      ENDIF
      DBDelete()
      DBRUnLock(nRec)
   ENDIF
   IF PrevScope[1] != NIL
      DBSetScope(SCOPE_TOP,PrevScope[1])
   ENDIF
   IF PrevScope[2] != NIL
      DBSetScope(SCOPE_BOTTOM,PrevScope[2])
   ENDIF
   DBGoTo(NextRec)
RETURN


and this to append new records

FUNCTION AddRecord(DelKey,cIndex)        used to reuse deleted records
DelKey is the key to find indicating a deleted record
LOCAL lRtn := .F.
   IF !DBScope()
      Set Deleted OFF
      IF !DBSeek(DelKey,,cIndex)
         AppendRec()
         lRtn := .T.
      ELSE
         lRtn := LockRec()    reuse records
         IF lRtn
            DBRecall()
         ENDIF
      ENDIF
      Set Deleted ON
   ELSE
     MsgBox("Program error Scope set in AddRecord")
   ENDIF
RETURN lRtn


Jim


Dieter Kubesch wrote:
> James,
> as i am
> (i checked again, to be really sure .... sometimes you don´t see the wood 
> because of all the trees ...)
> I posted a small example PRG and DBF which shows the "bug", maybe you like 
> to test?
> 
> Dieter
> 
> 
> "James Loughner" <jwrl@suddenlink.net> schrieb im Newsbeitrag 
> news:54000756$5398a14a$5b3@news.alaska-software.com...
>> Are you sure you are on the right index when you set the scope?
>>
>> Jim
>>
> 
>
Klaus Overhage Re: DbSetScope() - wrong result with records marked as deleted ...
on Thu, 26 Feb 2009 18:44:50 +0100
Dieter,

ist should be
  bottom: "   770020091231"    --> Account 7700, 31st December 2009

the month must come first, then the day!



Dieter Kubesch schrieb:
> Hi,
> 
> i have a DBF/NTX with following fields:
> 
> ACCOUNT, numeric 7,0
> DATE, date
> 
> and an Index over "str(account,7) + dtos(date)"
> 
> Following records are in the DBF,
> 
> 7630 | 01/30/2009
> 7700 | 01/05/2009    marked as deleted
> 7700 | 01/05/2009    marked as deleted
> 7703 | 01/05/2009    marked as deleted
> 7800 | 01/31/2009
> 7810 | 01/31/2009
> 
> SET DELETED is set to ON
> If i now define a scope
> top: "   770020090101"          --> Account 7700, 1.January.2009
> bottom: "   770020093112"    --> Account 7700, 31st December 2009
> 
> i get as result the record 7800, by means i have in my scope one match. The 
> result of the scoped DBF is shown via an XbpBrowse ...
> 
> I would expect to get no records in the scope, and EOF() should be .T., so 
> my XbpBrowse should show no entries.
> 
> Is this a bug, or am i thinking wrong?
> 
> XBase Version 1.90.331 Apr 26 2006
> 
> Thanks for the help!
> Dieter 
> 
>
Dieter KubeschRe: DbSetScope() - wrong result with records marked as deleted ...
on Thu, 26 Feb 2009 18:51:41 +0100
"Klaus Overhage" <schulung@energy-softwareservice.de> schrieb im Newsbeitrag 
news:122a92d7$37b92289$300@news.alaska-software.com...
> Dieter,
>
> ist should be
>  bottom: "   770020091231"    --> Account 7700, 31st December 2009
>
> the month must come first, then the day!

I agree Klaus, but the month COMES first:

"   770020091231"  =  "   7700" + "2009" + "12" + "31" = Account "7700", 
year "2009", month "12", day "31"

so i think that?s ok like it is ...

Dieter
Ott HavasvlgyiRe: DbSetScope() - wrong result with records marked as deleted ...
on Sat, 28 Feb 2009 16:18:29 +0100
Hi,

See my post in bugreport: "Scope bug in 1.82.294", 2007.01.31.
There was also a test case attached.
The main point is that if the scope range should be empty, but there is at
least one deleted record in the range, then the first not-deleted record
will be visible in the scope! So the best you can do to DbPack() more often.
I have sent the test case to Alaska more than 2 years ago, they thanked it
and created a PDR (don't know which), but it seems that they did not do
anything about it.  Quite disappointing...

Best regards,
Otto





"Dieter Kubesch" <dk@ednet.cc> az albbiakat rta a kvetkezo zenetben
news:2e1ce47e$27fa37fa$1d17@news.alaska-software.com...
> Hi,
>
> i have a DBF/NTX with following fields:
>
> ACCOUNT, numeric 7,0
> DATE, date
>
> and an Index over "str(account,7) + dtos(date)"
>
> Following records are in the DBF,
>
> 7630 | 01/30/2009
> 7700 | 01/05/2009    marked as deleted
> 7700 | 01/05/2009    marked as deleted
> 7703 | 01/05/2009    marked as deleted
> 7800 | 01/31/2009
> 7810 | 01/31/2009
>
> SET DELETED is set to ON
> If i now define a scope
> top: "   770020090101"          --> Account 7700, 1.January.2009
> bottom: "   770020093112"    --> Account 7700, 31st December 2009
>
> i get as result the record 7800, by means i have in my scope one match.
The
> result of the scoped DBF is shown via an XbpBrowse ...
>
> I would expect to get no records in the scope, and EOF() should be .T., so
> my XbpBrowse should show no entries.
>
> Is this a bug, or am i thinking wrong?
>
> XBase Version 1.90.331 Apr 26 2006
>
> Thanks for the help!
> Dieter
>
>
Dieter KubeschRe: DbSetScope() - wrong result with records marked as deleted ...
on Mon, 02 Mar 2009 10:30:25 +0100
Hi Otto,
thanks for the information.
I couldnt find anything in the knowledgbase about this problem (neither as 
OPEN nor as already CLOSED PDR).

However, i attached a small demo PRG and demo DBF which definitely shows the 
error (as you already reported 2 years ago !!!).

Can someone of the community try to reproduce and post the result?

If it is also reproducable, i will enter a BUGREPORT to Alaska.

Thanks
Dieter


"Ott Havasvlgyi" <vil@chello.hu> schrieb im Newsbeitrag 
news:33b47fd1$1a3debe7$80e@news.alaska-software.com...
> Hi,
>
> See my post in bugreport: "Scope bug in 1.82.294", 2007.01.31.
> There was also a test case attached.
> The main point is that if the scope range should be empty, but there is at
> least one deleted record in the range, then the first not-deleted record
> will be visible in the scope! So the best you can do to DbPack() more 
> often.
> I have sent the test case to Alaska more than 2 years ago, they thanked it
> and created a PDR (don't know which), but it seems that they did not do
> anything about it.  Quite disappointing...
>
> Best regards,
> Otto
>




bug_dbscope.rar
Raymond Fischbach Re: DbSetScope() - wrong result with records marked as deleted ...
on Tue, 03 Mar 2009 12:06:34 +0100
Hello Dieter,

I executed your program with NTX and CDX indexes.
I didn't get any IDSC but I got different results.
See attached screen shots

HTH,
Raymond

Le Mon, 02 Mar 2009 10:30:25 +0100, Dieter Kubesch a écrit :

> Hi Otto,
> thanks for the information.
> I couldn´t find anything in the knowledgbase about this problem (neither as 
> OPEN nor as already CLOSED PDR).
> 
> However, i attached a small demo PRG and demo DBF which definitely shows the 
> error (as you already reported 2 years ago !!!).
> 
> Can someone of the community try to reproduce and post the result?
> 
> If it is also reproducable, i will enter a BUGREPORT to Alaska.
> 
> Thanks
> Dieter
> 
> 
> "Ottó Havasvölgyi" <vil@chello.hu> schrieb im Newsbeitrag 
> news:33b47fd1$1a3debe7$80e@news.alaska-software.com...
>> Hi,
>>
>> See my post in bugreport: "Scope bug in 1.82.294", 2007.01.31.
>> There was also a test case attached.
>> The main point is that if the scope range should be empty, but there is at
>> least one deleted record in the range, then the first not-deleted record
>> will be visible in the scope! So the best you can do to DbPack() more 
>> often.
>> I have sent the test case to Alaska more than 2 years ago, they thanked it
>> and created a PDR (don't know which), but it seems that they did not do
>> anything about it.  Quite disappointing...
>>
>> Best regards,
>> Otto
>>


sshot-2.jpg
sshot-1.jpg
Dieter KubeschRe: DbSetScope() - wrong result with records marked as deleted ...
on Wed, 04 Mar 2009 14:42:41 +0100
Hi Raymond,
thank you for testing!

The result of the NTX (sshot-1.jpg) shows the BUG!
The result of the CDS (sshot-2.jpg) shows the correct behaviour.

It seems, that the dbSetScope() together with NTX and deleted records is 
buggy!

I will enter a Bugreport to Alaska.

Dieter



"Raymond Fischbach" <r_fischbach@tvcablenet.be> schrieb im Newsbeitrag 
news:p3todvnvut2u$.14dde96b0f3sx.dlg@40tude.net...
> Hello Dieter,
>
> I executed your program with NTX and CDX indexes.
> I didn't get any IDSC but I got different results.
> See attached screen shots
>
> HTH,
> Raymond
>
Dieter KubeschRe: DbSetScope() - wrong result with records marked as deleted ...
on Thu, 05 Mar 2009 09:45:31 +0100
Hi,

i finally tracked down the problem.
The Problem is dbgotop(), dbgobottom() together with dbscope in a special 
situation (like i had ...)

There is also alread a PDR to this problem: 5661 DbGoTop DbGoBottom behave 
wrong using scope

Does anyone know, if the Service Level 1 fixes this issue?

Thanks
Dieter
Raymond Fischbach Re: DbSetScope() - wrong result with records marked as deleted ...
on Thu, 05 Mar 2009 10:25:45 +0100
Hi Dieter,

I confirm that with SL1 (345) the problem is still there.

Regards,
Raymond


Le Thu, 5 Mar 2009 09:45:31 +0100, Dieter Kubesch a écrit :

> Hi,
> 
> i finally tracked down the problem.
> The Problem is dbgotop(), dbgobottom() together with dbscope in a special 
> situation (like i had ...)
> 
> There is also alread a PDR to this problem: 5661 DbGoTop DbGoBottom behave 
> wrong using scope
> 
> Does anyone know, if the Service Level 1 fixes this issue?
> 
> Thanks
> Dieter
Dieter KubeschRe: DbSetScope() - wrong result with records marked as deleted ...
on Thu, 05 Mar 2009 11:18:15 +0100
Hi Raymond,

thanks for the info! Ill try to find a workaround ...

Regards
Dieter

"Raymond Fischbach" <r_fischbach@tvcablenet.be> schrieb im Newsbeitrag 
news:76tnjlmpsid2.9xbcdgb8cm0w$.dlg@40tude.net...
> Hi Dieter,
>
> I confirm that with SL1 (345) the problem is still there.
>
> Regards,
> Raymond
>
Dieter KubeschRe: DbSetScope() - wrong result with records marked as deleted ...
on Mon, 16 Mar 2009 08:11:38 +0100
Hi,

Alaska confirmed a bug and assigned PDR 6098 to this problem (it is also 
related to PDR 5661).
Due to timing reasons this one will not be fixed in SL1, there will be a 
Hotfix after release of SL1.

Dieter

"Dieter Kubesch" <dk@ednet.cc> schrieb im Newsbeitrag 
news:2e1ce47e$27fa37fa$1d17@news.alaska-software.com...
> Hi,
>
> i have a DBF/NTX with following fields:
>
> ACCOUNT, numeric 7,0
> DATE, date
>
> and an Index over "str(account,7) + dtos(date)"
>
> Following records are in the DBF,
>
> 7630 | 01/30/2009
> 7700 | 01/05/2009    marked as deleted
> 7700 | 01/05/2009    marked as deleted
> 7703 | 01/05/2009    marked as deleted
> 7800 | 01/31/2009
> 7810 | 01/31/2009
>
> SET DELETED is set to ON
> If i now define a scope
> top: "   770020090101"          --> Account 7700, 1.January.2009
> bottom: "   770020093112"    --> Account 7700, 31st December 2009
>
> i get as result the record 7800, by means i have in my scope one match. 
> The result of the scoped DBF is shown via an XbpBrowse ...
>
> I would expect to get no records in the scope, and EOF() should be .T., so 
> my XbpBrowse should show no entries.
>
> Is this a bug, or am i thinking wrong?
>
> XBase Version 1.90.331 Apr 26 2006
>
> Thanks for the help!
> Dieter
>