DBF Functions
DBF Functions
DBF Functions
DBF_append(): Appends a new record or a series of records.
Syntax
DBF_append( [nHowMany],[nWorkArea] ) è .T.
Parameters
nHowMany number of records that must be added. Default is 1 record.
nWorkArea optional work area number. When not passed, the function operates on the current work area (nWorkArea = -1).
Returns
.T. the function always returns .T..
DBF_bot(): Is the table at begin of file?
Alias
DBF_BeginOfTable()
Syntax
DBF_bot( [nWorkArea] ) è lTableStatus
Parameters
nWorkArea optional work area number. When not passed, the function returns the table status for the current work area (nWorkArea = -1).
Returns
lTableStatus .T. if table is at first record; .F. otherwise.
DBF_commit(): Flushes current record to disk.
Syntax
DBF_commit( [nWorkArea] ) è lSuccess
Parameters
nWorkArea optional work area number. When not passed, the function operates on the current work area (nWorkArea = -1).
Returns
lSuccess .T. if COMMIT was successful; .F. otherwise.
DBF_empty(): Is it an empty table?
Syntax
DBF_empty( [nWorkArea] ) è lStatus
Parameters
nWorkArea optional work area number. When not passed, the function operates on the current work area (nWorkArea = -1).
Returns
lStatus .T. if empty table (no record); .F. otherwise.
DBF_eot(): Is the table at end of file?
Alias
DBF_EndOfTable()
Syntax
DBF_eot( [nWorkArea] ) è lTableStatus
Parameters
nWorkArea optional work area number. When not passed, the function returns the table status for the current work area (nWorkArea = -1).
Returns
lTableStatus .T. if table is at last record; .F. otherwise.
DBF_exclu(): Table open exclusively?
Alias
DBF_IsExclusive()
Syntax
DBF_exclu( [nWorkArea] ) è lExclusive
Parameters
nWorkArea optional work area number. When not passed, the function operates on the current work area (nWorkArea = -1).
Returns
lExclusive .T. if table opened exclusively; .F. otherwise.
DBF_GoBottom(): Go to the bottom of a given work area.
Syntax
DBF_GoBottom( [nWorkArea] ) è nRecord
Parameters
nWorkArea optional work area number. When not passed, the function operates on the current work area (nWorkArea = -1).
Returns
nRecord current record number.
See also
DBF_GoTop(), DBF_Skip().
DBF_GoTop(): Go to the top of a given work area.
Syntax
DBF_GoTop( [nWorkArea] ) è nRecord
Parameters
nWorkArea optional work area number. When not passed, the function operates on the current work area (nWorkArea = -1).
Returns
nRecord current record number.
See also
DBF_GoBottom(), DBF_Skip().
DBF_flockd(): Table locked or open exclusively?
Alias
DBF_IsTableLocked()
Syntax
DBF_flockd( [nWorkArea] ) è lFLocked
Parameters
nWorkArea optional work area number. When not passed, the function operates on the current work area (nWorkArea = -1).
Returns
lFLocked .T. if table locked or opened exclusively; .F. otherwise.
DBF_LastVersion(): Returns the file stamp of DBF functions.
Remark
This function helps the developer identifying the last version of a set of functions. Sometimes the global version information of FOCUS.FLL (MIS_major() and MIS_minor()) does not help tracking down the changes in a project. Starting with version 6.0 of FOCUS.FLL, each source file has now an internal date and time stamp.
Syntax
DBF_LastVersion() è szLastVersion
Parameters
None.
Returns
szLastVersion string identifying the last version of the functions set. The string is similar to "C:\Focus\5.0\DBF.C-Mon Oct 19 15:55:22 1998".
DBF_lock(): Locks a file or a record.
Syntax
DBF_lock( [nLockMethod],[nWorkArea] ) è lSuccess
Parameters
nLockMethod locking method (0 = RECORD, 1 = FILE). Default is RECORD.
nWorkArea optional work area number. When not passed, the function operates on the current work area (nWorkArea = -1).
Returns
lSuccess .T. if lock is successful; .F. otherwise.
DBF_readon(): Table open without write access?
Alias
DBF_IsReadOnly()
Syntax
DBF_readon( [nWorkArea] ) è lReadOnly
Parameters
nWorkArea optional work area number. When not passed, the function operates on the current work area (nWorkArea = -1).
Returns
lReadOnly .T. when table opened in READ ONLY mode (no write access); .F. otherwise.
DBF_reccnt(): Number of records.
Alias
DBF_Reccount(), DBF_LastRec()
Syntax
DBF_reccnt( [nWorkArea] ) è nRecords
Parameters
nWorkArea optional work area number. When not passed, the function operates on the current work area (nWorkArea = -1).
Returns
nRecords 0 if table is empty; otherwise number of records.
DBF_replac(): Replaces a field with a value.
Alias
DBF_Replace()
Syntax
DBF_replac( szField,xValue ) è lSuccessful
Parameters
szField field to be replaced with xValue.
xValue value to replace cField with.
Returns
lSuccessful .T. if REPLACE was successful; .F. otherwise.
DBF_rlockd(): Current record locked, table locked or table open exclusively?
Alias
DBF_IsRecordLocked()
Syntax
DBF_rlockd( [nWorkArea] ) è lRLocked
Parameters
nWorkArea optional work area number. When not passed, the function operates on the current work area (nWorkArea = -1).
Returns
lRLocked .T. if current record is locked, or if table is locked or if table is opened exclusively; .F. otherwise.
DBF_seek(): Performs a SEEK.
Alias
DBF_LookUp(), DBF_search()
Comment
This function operates on current work area only.
Syntax
DBF_seek( xValue ) è lFound
Parameters
xValue value to look for.
Returns
lFound .T. if value FOUND(); .F. otherwise.
DBF_Skip(): Skips a specified number of records in a given work area.
Syntax
DBF_Skip( [nWorkArea[,nRecords]] ) è nRecord
Parameters
nWorkArea optional work area number. When not passed, the function operates on the current work area (nWorkArea = -1).
nRecords optional number to skip. When not passed, the function skips 1 record forward in the table (+1). Negative numbers can be used to skip backward.
Returns
nRecord current record number or a negative number if the function failed.
See also
DBF_GoTop(), DBF_GoBottom().
DBF_status(): Retrieves the status of a DBF.
Syntax
DBF_status( [nWorkArea] ) è nStatus
Parameters
nWorkArea optional work area number. When not passed, the function operates on the current work area (nWorkArea = -1).
Returns
nStatus DBF status.
#define DB_BOF / 1 / BOF()
#define DB_EOF / 2 / EOF()
#define DB_RLOCKED / 4 / Current record is RLOCKed
#define DB_FLOCKED / 8 / Database is FLOCKed
#define DB_EXCLUSIVE / 16 / Database is open EXCLUSIVEly
#define DB_READONLY / 32 / Database is READONLY