Click or drag to resize

Functions.VoDbFieldInfo Method (DWord, DWord, Usual)

Retrieve field definition information about a field.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.16
 FUNCTION VoDbFieldInfo(
	kInfoType AS DWORD,
	wFieldPos AS DWORD,
	ptrRetVal REF USUAL
Request Example View Source


Type: DWord
Determines what type of information is retrieved.
Type: DWord
The position number of the field that you want information on.
Type: Usual
A pointer to a polymorphic value.
This value will receive the requested information if the function is successful and will be unchanged otherwise.
If you just want to retrieve information, this value must be NIL before calling the function.
Although other RDDs may expand on this concept, the supplied RDDs limit using a non-NIL value to a single circumstance in which you can change the information rather than just retrieve it. With the DBS_ALIAS kInfoType, you can specify a non-NIL value, allowing you to specify a string that you can subsequently use to access the indicated field.

Return Value

Type: Logic
TRUE if successful; otherwise, FALSE.
VODBFieldInfo() is the same as DBFieldInfo(), except for the purpose of its third argument and the fact that it returns a logical.
This function, however, does not call the error handler and will not, therefore, produce a runtime error message or create an error object if it fails. Thus, it may be important to check the return value to determine if the function succeeded.
The global structure, StrucErrInfo, will contain needed information regarding any error that occurs. See DBFieldInfo() for more information.
The following examples use VODBFieldInfo() to retrieve field information:
 1FUNCTION ShowFieldInfo(wField AS WORD) AS VOID
 2    LOCAL uResult AS USUAL
 3    uResult := NIL
 4    IF VODBFieldInfo(DBS_NAME, wField, @uResult)
 5        ? "FieldName(): ", uResult
 6    ELSE
 7        DoError()
 8    ENDIF
 9    IF VODBFieldInfo(DBS_TYPE, wField, @uResult)
10        ? "Field type: ", uResult
11    ELSE
12        DoError()
13    ENDIF
14    IF VODBFieldInfo(DBS_LEN, wField, @uResult)
15        ? "Field length: ", uResult
16    ELSE
17        DoError()
18    ENDIF
19    IF VODBFieldInfo(DBS_DEC, wField, @uResult)
20        ? "Decimals: ", uResult
21    ELSE
22        DoError()
23    ENDIF
24    RETURN
26    LOCAL uRetCode AS USUAL
27    LOCAL oError AS USUAL
28    oError := ErrorBuild(@strucErrInfo)
29    oError:FuncSym := #VODBFieldInfo
30    RETURN EVAL(ErrorBlock(), oError)
See Also