xHarbour Reference Documentation > Function Reference |
Retrieves information about a database field
DbFieldInfo( <nInfo>, <nFieldPos> ) --> xFieldInfo
DbFieldInfo() returns the queried information as supplied by the replaceable database driver (RDD).
DbFieldInfo() allows for querying detailed field information from the replaceable database driver (RDD). Depending on database and RDD used, different information may be available. The type of information to retrieve is specified with #define constants available in the DBINFO.CH and DBSTRUCT.CH header files.
Constants for DbFieldInfo()
Constant | Return value |
---|---|
DBSTRUCT.CH | |
DBS_DEC | Number of decimal places for the field. |
DBS_LEN | Numeric length of the field. |
DBS_NAME | Character string holding the name of the field. |
DBS_TYPE | Character identifying the data type of the field. |
DBINFO.CH | |
DBS_BLOB_LEN | Number of bytes stored in a memo field (BLOB). |
DBS_BLOB_OFFSET | Numeric file offset into memo file of the data in a memo field. |
DBS_BLOB_POINTER | Numeric value for usage with e.g. BlobDirectGet(), BlobDirectImport(). |
DBS_BLOB_TYPE | Character indicating the data type of a memo field (BLOB). |
By default, DbFieldInfo() operates in the current work area. Use an aliased expression to query field information in different work areas.
See also: | BlobDirectGet(), BlobDirectImport(), DbInfo(), DbOrderInfo(), DbRecordInfo(), DbStruct(), FieldDec(), FieldLen(), FieldName(), FieldType() |
Category: | Database functions , Field functions |
Header: | Dbinfo.ch, Dbstruct.ch |
Source: | rdd\dbcmd.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example retrieves structural information for a // single database with a user defined function. #include "Dbstruct.ch" PROCEDURE Main USE Customer AEval( FieldStruct( 1 ), {|x| QOut( x ) } ) USE RETURN FUNCTION FieldStruct( nFieldPos ) LOCAL aFStruct[4] aFStruct[DBS_NAME] := DbFieldInfo( DBS_NAME, nFieldPos ) aFStruct[DBS_TYPE] := DbFieldInfo( DBS_TYPE, nFieldPos ) aFStruct[DBS_LEN ] := DbFieldInfo( DBS_LEN , nFieldPos ) aFStruct[DBS_DEC ] := DbFieldInfo( DBS_DEC , nFieldPos ) RETURN aFStruct
http://www.xHarbour.com