Harbour All Functions – D

Date()
Day()
Days()

DaysInMonth()
DaysToMonth()

dbAppend()
dbClearFilter()
dbCloseAll()
dbCloseArea()
dbCommit()
dbCommitAll()
dbCreate()
dbDelete()
dbEval()
dbF()
dbFilter()
dbGoBottom()
dbGoTo()
dbGoTop()
dbReCall()
dbRLock()
dbRLockList()
dbRUnlock()
dbSeek()
dbSelectArea()
dbSetDriver()
dbSetFilter()
dbSkip()
dbSkipper()
dbStruct()
dbUnlock()
dbUnlockAll()
dbUseArea()

DecToBin()
DecToHexa()
DecToOctal()

Deleted()
Descend()
DevOutPict()
DirChange()
DirRemove()
DiskSpace()

DMY()
Do()
DoW()

DOY
DToC()

DToR
DToS()

Advertisements

Harbour Database Functions

Database Functions

AFields Fills referenced arrays with database field information
Alias Returns the alias name of a work area
BOF Test for the beggining-of-file condition
dbAppend Appends a new record to a database file
dbClearFilter Clears the current filter condiction in a work area
dbCloseAll Close all open files in all work areas.
dbCloseArea Close a database file in a work area
dbCommit Updates all index and database buffers for a given workarea
dbCommitAll Flushes the memory buffer and performs a hard-disk write
dbCreate Creates an empty database from a array
dbDelete Mark a record for deletion in a database
dbEval Performs a code block operation on the current Database
DBF Alias name of a work area
dbFilter Return the filter expression in a work area
dbGoBottom Moves the record pointer to the bottom of the database
dbGoto Position the record pointer to a specific location
dbGoTop Moves the record pointer to the top of the database
dbRecall Recalls a record previousy marked for deletion
dbSeek Searches for a value based on an active index
dbSelectArea Change to another work area
dbSetDriver Establishes the RDD name for the selected work area
dbSetFilter Establishes a filter condition for a work area
dbSkip Moves the record pointer in the selected work area
dbSkipper Helper function to skip a database
dbStruct Builds a multidimensional array of a database structure
dbUseArea Opens a work area and uses a database file
Deleted Tests the record’s deletion flag
EOF Test for end-of-file condition
FCount Counts the number of fields in an active database
FieldDeci Determines the number of decimal places of a given numeric field
FieldGet Obtains the value of a specified field
FieldName Return the name of a field at a numeric field location
FieldPos Return the ordinal position of a field
FieldPut Set the value of a field variable
FieldSize Determines the size of a given field
FieldType Determines the type of a given field
Found Determine the success of a previous search operation
Header Return the length of a database file header
LastRec Returns the number of records in an active work area or database
LUpdate Yields the date the database was last updated
RecCount Counts the number of records in a database
RecNo Returns the current record number or identity
RecSize Returns the size of a single record in an active database
Select Returns the work area number for a specified alias
Used Checks whether a database is in use in a work area

RecNo()

RECNO()

Returns the current record number or identity.

Syntax

      RECNO() --> Identity

Arguments

(This function has no arguments)

Returns

RECNO() The record number or identity

Description

This function returns the position of the record pointer in the currently selected or designated work area.

If the database file is empty and if the RDD is the traditional .dbf file, the value of this function will be 1.

Examples

      USE tests NEW
      DBGOTOP()
      RECNO()            // Returns 1
      DBGOTO( 50 )
      RECNO()            // Returns 50

Compliance

Clipper

Files

Library is rdd

Seealso

DBGOTO(), DBGOTOP(), DBGOBOTTOM(), LASTREC(), EOF(), BOF()

dbSkip()

DBSKIP()

Moves the record pointer in the selected work area.

Syntax

      DBSKIP([<nRecords>])

Arguments

<nRecords> Numbers of records to move record pointer.

Description

This function moves the record pointer <nRecords> in the selected or aliased work area. The default value for <nRecords> will be 1. A DBSKIP(0) will flush and refresh the internal database bufer and make any changes made to the record visible without moving the record pointer in either direction.

Examples

      PROCEDURE Main()
         USE tests NEW
         DBGOTOP()
         DO WHILE ! EOF()
            ? tests->Id, tests->Name
            DBSKIP()
         ENDDO
         USE
         RETURN

Compliance

Clipper

Files

Library is rdd

Seealso

BOF(), DBGOBOTTOM(), DBGOTOP(), DBSEEK(), EOF()

dbSeek()

DBSEEK()

Searches for a value based on an active index.

Syntax

      DBSEEK(<expKey>, [<lSoftSeek>],[<lFindLast>]) --> lFound

Arguments

<expKey> Any expression

<lSoftSeek> Toggle SOFTSEEK condition

<lFindLast> is an optional logical value that set the current record position to the last record if successful

Returns

DBSEEK() returns logical true (.T.) if found, otherwise false

Description

This function searches for the first record in a database file whose index key matches <expKey>. If the item is found, the function will return a logical true (.T.), the value of FOUND() wilI be a logical true (.T.), and the value of EOF() wilI be a logical false (.F.). If no item is found. then the function will return a logical false, the value of FOUND( ) will be a logical false (.F.), and the value of EOF( ) will be a logical true (.T.).

This function always “rewinds” the database pointer and starts the search from the top of the file.

If the SOFTSEEK flag is on or if <lSoftSeek> is set to a logical true (.T.) the value of FOUND() will be a logical false and EOF() will be false if there is an item in the index key with a greater value than the key expression <expKey>; at this point the record pointer will position itself on that record. However, if there is no greater key in the index, EOF() will return a logical true (.T.) value. If <lSoftSeek> is not passed, the function will look to the internal status of SOFTSEEK before performing the operation. The default of <lSoftSeek> is a logical false (.F.)

Examples

      PROCEDURE Main()
         USE tests NEW INDEX tests
         DBGOTO( 10 )
         nId := tests->nId
         IF tests->( DBSEEK( nId ) )
            IF RLOCK()
               ? tests->Name
               DBRUNLOCK()
            ENDIF
         ENDIF
         USE
         RETURN

      ACCEPT "Employee name: " TO cName
      IF Employee->( DBSEEK( cName ) )
         Employee->( ViewRecord() )
      ELSE
         ? "Not found"
      ENDIF

Compliance

DBSEEK() is Compatible with CA-Cl*pper 5.3

Files

Library is rdd

Seealso

DBGOBOTTOM(), DBGOTOP(), DBSKIP(), EOF(), BOF(), FOUND()

dbGoto()

DBGOTO()

Position the record pointer to a specific location.

Syntax

      DBGOTO(<xRecordNumber>)

Arguments

<xRecordNumber> Record number or unique identity

Description

This function places the record pointer, if working with a .dbf file, in selected or aliased work area at the record number specified by <xRecordNumber>. The position is not affected by an active index or by any enviromental SET condiction.

The parameter <xRecordNumber> may be something other than a record number. In some data formats, for example, the value of <xRecordNumber> is a unique primary key while in other formats, <xRecordNumber> could be an array offset if the data set was an array.

Issuing a DBGOTO(RECNO()) call in a network enviroment will refresh the database and index buffers. This is the same as a DBSKIP(0) call.

Examples

      The following example uses DBGOTO() to iteratively process
      every fourth record:

      DBUSEAREA( .T., "DBFNTX", "sales", "sales", .T. )
      //
      // toggle every fourth record
      DO WHILE ! EOF()
         DBGOTO( RECNO() + 4 )
         sales->Group := "Bear"
      ENDDO

Compliance

Clipper

Files

Library is rdd

Seealso

BOF(), EOF(), DBGOTOP(), DBGOBOTTOM(), DBSEEK(), DBSKIP()

dbGoBottom()

DBGOBOTTOM()

Moves the record pointer to the bottom of the database.

Syntax

      DBGOBOTTOM()

Description

This function moves the record pointer in the selected or aliased work area to the end of the file. The position of the record pointer is affected by the values in the index key or by an active FILTER condition. Otherwise, if no index is active or if no filter condition is present, the value of the record pointer will be LASTREC().

Examples

      USE tests
      DBGOTOP()
      ? RECNO()
      DBGOBOTTOM()
      ? RECNO()
      USE

Compliance

Clipper

Files

Library is rdd

Seealso

BOF(), EOF(), DBSKIP(), DBSEEK(), DBGOTOP()