xsharp.eu • DBF changes not visible to second program.
Page 1 of 1

DBF changes not visible to second program.

Posted: Tue Nov 12, 2019 10:37 pm
by Jamal
Two programs open the same DBF via DBFCDX driver in shared mode.
If the first VO program adds/updates a DBF record (rlock, commit, unlock), the first app see the changes, but the second X# (or C#) program does not see the changes and oDBServer:Seek(..) fails . If the second program closes the DBF and opens it again, the changes are visible.

BTW, i tried DBServer and direct VODB functions with the same result.

I wrote the above earlier, and now while "playing around", I added oDBServer:OrderKeyCount() just before the oDBServer:Seek(...) and the changes are visible and Seek() works!! I tried Skip(0), GoTop() methods but those had no effect.

What's going in OrderKeyCount() which resolves the issue?

Jamal

The OrderKeyCount() from DBServer2.prg is below:

Code: Select all

METHOD OrderKeyCount( uOrder, oFSIndex ) 
	//SE-060601
   LOCAL dwCurrentWorkArea AS DWORD
	LOCAL uRetVal AS USUAL
	LOCAL oError AS USUAL
	LOCAL cTarget AS STRING

	#IFDEF __DEBUG__
		DBFDebug("Entering "+__ENTITY__, AsString(uOrder), AsString(OFsIndex))
	#ENDIF

	lErrorFlag := FALSE
	BEGIN SEQUENCE
		VODBSelect( wWorkArea, @dwCurrentWorkArea )
		IF IsObject(oFSIndex) .and. __Usual.ToObject(oFSIndex) IS FileSpec VAR oFS
			cTarget := oFS:FullPath
		ELSE
			IF IsString( oFSIndex )
				cTarget := oFSIndex
			ENDIF
		ENDIF
		IF ! VODBOrderInfo( DBOI_KEYCOUNT, cTarget, uOrder, @uRetVal )
			BREAK ErrorBuild(_VODBErrInfoPtr())
		ENDIF
		__DBSSetSelect( dwCurrentWorkArea )

	RECOVER USING oError
		oErrorInfo := oError
		__DBSSetSelect( dwCurrentWorkArea )
		SELF:Error( oErrorInfo, #OrderKeyCount )
		uRetVal := NIL
	END SEQUENCE


	#IFDEF __DEBUG__
		DBFDebug("Leaving "+__ENTITY__, AsString(uRetVal))
	#ENDIF
	RETURN uRetVal

DBF changes not visible to second program.

Posted: Tue Nov 12, 2019 11:14 pm
by Chris
Thanks Jamal, this is a known (after the previous release) problem, Robert is working on a fix for it now. About OrdKeyCount(), I guess it just forces a reread from file, so the problem does not happen.

DBF changes not visible to second program.

Posted: Tue Nov 12, 2019 11:24 pm
by Jamal
Thanks Chris for the confirmation! Will wait for next update.

Jamal