Click or drag to resize

VoDbFieldInfo Function (DWord, DWord, Usual)

X#
Retrieve field definition information about a field.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION VoDbFieldInfo(
	kInfoType AS DWORD,
	wFieldPos AS DWORD,
	uValue AS USUAL
) AS LOGIC
Request Example View Source

Parameters

kInfoType
Type: DWord
Determines what type of information is retrieved. See the table in the Remarks section below.
wFieldPos
Type: DWord
The position number of the field that you want information on.
uValue
Type: Usual
New value to assign to the Field.

Return Value

Type: Logic
TRUE if successful; otherwise, FALSE.
Remarks
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 LastRddError property in the runtime state. will contain needed information regarding any error that occurs.
See DbFieldInfo(Usual, Usual, Usual) for more information.
Tip Tip
The values in the table below exist both as DEFINEs and also as members of the DbFieldInfo enum.
You can see the numeric values of the defines in the documentation of this Enum.
ConstantsDescription
DBS_NAMEReturns the name of the field.
DBS_TYPEReturns the data type of the field.
DBS_LENReturns the length of the field.
DBS_DECReturns the number of decimal places for the field.
DBS_ALIAS Returns and optionally changes an alternate name (or alias) by which a field can be referenced (by default, same as DBS_NAME).
DBS_PROPERTIESReturns the number of properties defined for a field.
DBS_BLOB_DIRECT_LEN Returns the length of data in a BLOB as an unsigned long integer, without referencing a particular memo field. For strings, the return value is the length of the string in bytes; for arrays, it is the number of elements in the first dimension; for all other data types, it returns -1. With this constant, you must specify the BLOB using a numeric pointer obtained from DBServer:BLOBDirectPut(), DBServer:BLOBDirectImport(), or DBServer:FieldInfo(DBS_BLOB_POINTER, ... />).
DBS_BLOB_DIRECT_TYPE To determine the data type of BLOB data, without reference to a particular memo field, use DBServer:FieldInfo(DBS_BLOB_DIRECT_TYPE, ...). With this constant, you must specify the BLOB using a numeric pointer obtained from DBServer:BLOBDirectPut(), DBServer:BLOBDirectImport(), or DBServer:FieldInfo(DBS_BLOB_POINTER, ...).
See DBS_BLOB_TYPE for a table of possible return values.
DBS_BLOB_LEN Returns the length of the BLOB data in a memo field as an unsigned long integer. For strings, the return value is the length of the string in bytes; for arrays, it is the number of elements in the first dimension; for all other data types, it returns -1.
Tip Tip
DBServer:FieldInfo(DBS_BLOB_LEN, ...) has a performance advantage over the Len() function.
DBS_BLOB_POINTERReturns a numeric pointer to the BLOB data associated with a memo field.
DBS_BLOB_TYPE Unlike memo fields maintained in .DBT files, BLOB files allow you to store many different types of data in memo fields. However, the standard functions for determining data types, such as ValType(), simply treat BLOB fields as regular memo fields. To determine the actual type of BLOB data stored in a memo field, use DBServer:FieldInfo(DBS_BLOB_TYPE, ...). The data type of the return value is string and can be interpreted using this table:
ReturnsMeaning
?Blank (empty/uninitialized field)
AArray
CString
DDate
EError
LLogical
NNumeric
UUndefined (NIL was stored)
DBS_USERStart of user defined DBS_ values.
Tip Tip
DBS_USER is a constant that returns the minimum value that third-party RDD developers can use for defining new properties. Values less than DBS_USER are reserved for X# development.
Examples
The following examples use VODBFieldInfo() to retrieve field information:
X#
 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
25STATIC FUNCTION DoError() AS USUAL
26    LOCAL uRetCode AS USUAL
27    LOCAL oError AS USUAL
28    oError := ErrorBuild(RuntimeState.LastRddError)
29    oError:FuncSym := #VODBFieldInfo
30    RETURN EVAL(ErrorBlock(), oError)
See Also