Click or drag to resize

DbInfo Function

X#
Return and optionally change information about a database file open in a work area.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION DbInfo(
	kInfoType,
	uNewSetting
) AS USUAL CLIPPER
Request Example View Source

Parameters

kInfoType (Optional)
Type: Usual
Specifies the type of information.
The constants are described in the Remarks section below. Note, however, that not all constants are supported for all RDDs.
uNewSetting (Optional)
Type: Usual
If specified, this parameter is used to change the value of a setting.
The data type (and whether uNewSetting can be specified), depends on the kInfoType constant and is documented in the Remarks section below.

Return Value

Type: Usual
If uNewSetting is not specified, RDDInfo() returns the current setting.
If uNewSetting is specified, the previous setting is returned.
Remarks
By default, this function operates on the currently selected work area.
It can be made to operate on an unselected work area by specifying it within an aliased expression
Tip Tip
The values in the table below exist both as DEFINEs and also as members of the DbInfo enum.
You can see the numeric values of the defines in the documentation of this Enum.
ConstantDescription
DBI_ALIASReturns the alias name of the work area as a string.
DBI_BLOB_HANDLE Returns an integer representing the DOS file handle for a BLOB file. T he constant is most often used in conjunction with DBServer:FieldInfo(DBS_BLOB_LEN, ...) and DBServer:FieldInfo(DBS_BLOB_POINTER, ...) to directly access BLOB fields using low-level functions, such as FRead().
DBI_BLOB_INTEGRITY Tests a BLOB file for the integrity of its internal tables and returns a logical value indicating the success (TRUE) or failure (FALSE) of the integrity check. This should not generally be necessary, but it is handy if the file's integrity is in question for any reason. This does not test the integrity between the .DBF and the BLOB file.
If the integrity check fails, you can run DBServer:Info(DBI_BLOB_RECOVER), which will automatically correct the BLOB file's tables, however, it will abandon some space within the file that would otherwise be reused.
Important! DBServer:Info(DBI_BLOB_INTEGRITY) is a disk intensive operation and may slow down processing of the data server significantly, especially on a busy network.
DBI_BLOB_RECOVERRecovers a damaged BLOB file by correcting its internal tables and returns NIL. You should run this only if DBServer:Info(DBI_BLOB_INTEGRITY) returns FALSE. Note that after running DBServer:Info(DBI_BLOB_RECOVER), the BLOB file loses some size efficiency.
DBI_BOFReturns a logical value indicating the data server's beginning-of-file status (see DBServer:BOF).
DBI_CANPUTRECReturns a logical value indicating whether the data server supports putting records.
DBI_CHILDCOUNTReturns the number of relations set from this data server.
DBI_DB_VERSIONReturns the version number of the host RDD (CAVORDDB.DLL or CAVORDD.DLL).
DBI_DBFILTERReturns the filter expression as a string (see DBServer:Filter).
DBI_EOFReturns a logical value indicating the data server's end-of-file status (see DBServer:EOF).
DBI_FCOUNTReturns the number of fields (see DBServer:FCount).
DBI_FILEHANDLEReturns an IntPtr representing the file handle for this database file.
DBI_FILESTREAMReturns a stream object representing the file stream for this database file.
DBI_FOUNDReturns a logical value indicating the success or filure of the last seek operation for this data server (see DBServer:Found).
DBI_FULLPATHReturns the full path name of opened database file.
DBI_GETDELIMITERReturns the default delimiter.
DBI_GETHEADERSIZEReturns the header size of the file (see DBServer:Header).
DBI_GETLOCKARRAYReturns the array of locked records.
DBI_GETRECSIZEReturns the record size of the file (see DBServer:RecSize).
DBI_GETSCOPEReturns the locate condition as a code block.
DBI_ISANSIReturns the ANSI flag of the database file (TRUE for ANSI and FALSE for OEM).
DBI_ISDBFReturns a logical value indicating whether the RDD provides support for the .DBF file format.
DBI_ISFLOCKReturns the file lock status.
DBI_LASTUPDATEReturns the last date on which the file was updated (see DBServer:LUpdate).
DBI_LOCKCOUNTReturns the number of locked records.
DBI_LOCKOFFSETReturns the current locking offset as a numeric value.
DBI_MEMOBLOCKSIZEReturns the block size for the memo file associated with this database.
DBI_MEMOEXTReturns the default extension for the memo file associated with this database.
DBI_MEMOHANDLEReturns an intptr representing the DOS file handle for the memo file associated with this database file.
DBI_MEMOSTREAMReturns a stream object representing the file stream for the memo file associated with this database file.
DBI_RDD_VERSIONReturns the version number of the RDD for this database.
DBI_SETDELIMITERSets the default delimiter.
DBI_SHAREDReturns the shared flag value.
DBI_TABLEEXTReturns the database file extension.
DBI_VALIDBUFFERReturns a logical value indicating whether the current buffer is valid.
DBI_USERStart of user defined DBI_ values.
Tip Tip
DBI_USER is a constant that returns the minimum value that third-party RDD developers can use for defining new parameters. Values less than DBI_USER are reserved for X# development.
Examples
The following examples return work area information:
X#
1? DBInfo(DBI_GETHEADERSIZE)    // Same as Header()
2? DBInfo(DBI_LASTUPDATE)        // Same as LUpdate()
3? DBInfo(DBI_GETRECSIZE)        // Same as RecSize()
4? DBInfo(DBI_FULLPATH)        // Full path name
The following example will display all RDDs used in the current workarea:
X#
 1FUNCTION RddTest()
 2    LOCAL n, i AS INT
 3    LOCAL rddList AS _RDDLIST
 4    USE Demo NEW
 5    rddList := DBInfo(DBI_RDD_LIST)
 6    ? "Involved Rdds: ", rddList.uiRddCount
 7    FOR i := 1 UPTO rddList.uiRddCount
 8            ? rddList.atomRddName[I]
 9    NEXT I
10    MemFree(rddList)
11    RETURN
See Also