Skip to content

Incorrect DBOI_POSITION at EoF #593

@cpyrgas

Description

@cpyrgas

When skipping to EoF, DbOrderInfo( DBOI_POSITION ) returns RecCount + 1, instead of 0, as VO does.

Strangely enough, when adding this code to the test suite, it works correctly, DbOrderInfo( DBOI_POSITION ) returns 0 at EoF. Probably some runtime setting affects this, which I haven't found yet.

FUNCTION Start() AS VOID
	LOCAL cDBF  AS STRING 
	LOCAL aFields, aValues AS ARRAY 
	LOCAL i  AS DWORD  
	
	RddSetDefault ( "DBFCDX" ) 
	
	cDBF := "C:\test\testdbf"
	
	FErase ( cDbf + ".cdx" )
	
	aFields := { { "LAST" , "C" , 20 , 0 } 	} 
	aValues := { "a" , "b", "c"}	
	
	DbCreate( cDBF , AFields)
	DbUseArea( ,,cDBF )		
	FOR i := 1 UPTO ALen ( aValues )
		DbAppend() 
		FieldPut ( 1 , aValues [ i ] )
	NEXT
	DbCreateOrder ( "ORDER1" , cDbf , "upper(LAST)" , { || Upper ( _Field->LAST) } )
	DbCloseArea()
	
	// --------------
	
	DbUseArea( TRUE,,cDBF )
	? DbSetOrder ( 1 ) 
	
	DbGoTop()
	? Eof(), DbOrderInfo ( DBOI_POSITION ) // FALSE, 1 OK
	DbSkip()
	? Eof(), DbOrderInfo ( DBOI_POSITION ) // FALSE, 2 OK
	DbSkip()
	? Eof(), DbOrderInfo ( DBOI_POSITION ) // FALSE, 3 OK
	DbSkip()
	? Eof(), DbOrderInfo ( DBOI_POSITION ) // TRUE, 4 should be 0
	DbSkip()
	
	DbCloseArea() 
RETURN

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions