The same happens in various DBF files in a random fashion and I cannot pinpoint exactly what is causing it. I am passing a SYMBOL for the field name such as oSrv:FieldGet(#MYFIELD). Is IsSymbol() the problem or is it FieldPosSym() ?
Since this is random and I cannot replicate it, I am baffled. Any idea on what is causing this issue or a possible workaround?
Code: Select all
METHOD FIELDGET(uField) CLASS _SpeciallDBServer
LOCAL uRetVal as USUAL
LOCAL wPos AS DWORD
LOCAL dwCurrentWorkArea as DWORD
LOCAL oError as USUAL
BEGIN SEQUENCE
VODBSelect( wWorkArea, @dwCurrentWorkArea )
IF IsSymbol( uField )
wPos := FieldPosSym( uField)
ELSEIF IsString( uField )
wPos := FieldPos( AsString(uField) )
ELSEIF IsNumeric( uField )
wPos := uField
IF wPos > wFieldCount
wPos := 0
ENDIF
ENDIF
IF wPos = 0
InfoBox{,"Utility", "Invalid field: " + AsString(uField) + " in " + AsString(self:name) + _chr(10) + Psz2String(ProcName(2)) + _chr(10) + AsString(ProcLine(2))}:show()
ELSE
(wWorkArea)->VODBFieldGet( wPos, @uRetVal )
ENDIF
__DBSSetSelect( dwCurrentWorkArea ) //SE-060527
RECOVER USING oError
oErrorInfo := oError
__DBSSetSelect( dwCurrentWorkArea ) //SE-060527
uRetVal := nil
END SEQUENCE
RETURN uRetVal