GO

GO

Move the pointer to the specified identity

Syntax

      GO[TO] <xIdentity> | BOTTOM | TOP

Arguments

<xIdentity> is a unique value guaranteed by the structure of the data file to reference a specific item in a data source (database). In a .dbf, identity is the record number. In other data formats, identity is the unique primary key value.

BOTTOM specifies the last logical record in the current work area.

TOP specifies the first logical record in the current work area.

Description

GO[TO] is a database command that positions the record pointer in the current work area at the specified identity. In an Xbase data structure, this identity is the record number because every record, even an empty record, has a record number. In data structures of different design, identity may be defined as something other than record number.

Examples

      .  This example saves the current record number, searches for a
         key, and then restores the record pointer to the saved position:
      FUNCTION KeyExists( xKeyExpr )
         LOCAL nSavRecord := RECNO()      // Save the current record
                                          // pointer position
         LOCAL lFound
         SEEK xKeyExpr
         IF ( lFound := FOUND() )
            .
            .  < statements >
            .
         ENDIF
         GOTO nSavRecord      // Restore the record pointer position
         RETURN ( lFound )

Seealso

DBGOTO(), LASTREC(), RECNO(), SET DELETED, SET FILTER

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

RecSize()

RECSIZE()

Returns the size of a single record in an active database.

Syntax

      RECSIZE() --> nBytes

Arguments

(This function has no arguments)

Returns

<nBytes> The record size.

Description

This function returns the number os bytes used by a single record in the currently selected or designated database file. If no database is in use in this work area, the return value from this function will be 0.

Examples

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

Compliance

Clipper

Files

Library is rdd

Seealso

DISKSPACE(), FIELDNAME(), HEADER(), LASTREC()

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()

RecCount()

RECCOUNT()

Counts the number of records in a database.

Syntax

      RECCOUNT()* | LASTREC() --> nRecords

Arguments

(This function has no arguments)

Returns

<nRecords> The number of records

Descriptions

This function returns the number of records present in the database in the selected or designated work area. If no records are present the value of this function will be 0. Additionaly, if no database is in use in the selected or designated work area, this function will return a 0 value as well.

Examples

      USE test NEW
      USE harbour NEW
      ? RecCount()
      ? Test->( RecCount() )
      CLOSE ALL

Compliance

Clipper

Files

Library is rdd

Seealso

EOF(), LASTREC(), RECNO(), DBGOBOTTOM()

LUpdate()

LUPDATE()

Yields the date the database was last updated.

Syntax

      LUPDATE() --> dModification

Arguments

(This function has no arguments)

Returns

<dModification> The date of the last modification.

Description

This function returns the date recorded by the OS when the selected or designated database was last written to disk. This function will only work for those database files in USE.

Examples

      PROCEDURE Main()
         USE tests NEW
         ? LUpdate()
         USE
         RETURN

Compliance

Clipper

Platforms

All

Files

Library is rdd

Seealso

FIELDNAME(), LASTREC(), RECSIZE()

Header()

HEADER()

Return the length of a database file header

Syntax

      HEADER() --> nBytes

Returns

<nBytes> The numeric size of a database file header in bytes

Description

This function returns the number of bytes in the header of the selected database ot the database in the designated work area.

If used in conjunction with the LASTREC(), RECSIZE() and DISKSPACE() functions, this functions is capable of implementing a backup and restore routine.

Examples

      USE tests NEW
      ? Header()

Compliance

Clipper

Files

Library is rdd

Seealso

DISKSPACE(), LASTREC(), RECSIZE()

Eof()

EOF()

Test for end-of-file condition.

Syntax

      EOF() --> <lEnd>

Arguments

(This command has no arguments)

Returns

<lEnd> A logical true (.T.) or false (.F.)

Description

This function determines if the end-of-file marker has been reached. If it has, the function will return a logical true (.T.); otherwise a logical false (.F.) will be returnd

Examples

      PROCEDURE Main()
         USE tests NEW
         DBGOTOP()
         ? "Is Eof()", EOF()
         DBGOBOTTOM()
         ? "Is Eof()", EOF()
         USE
         RETURN

Compliance

Clipper

Files

Library is rdd

Seealso

BOF(), FOUND(), LASTREC()

Bof()

 

BOF()

Test for the beggining-of-file condition

Syntax

      BOF() --> <lBegin>

Returns

BOF() Logical true (.T.) or false (.F.)

Description

This function determines if the beggining of the file marker has been reached. If so, the function will return a logical true (.T.); otherwise, a logical false (.F.) will be returned. By default, BOF() will apply to the currently selected database unless the function is preceded by an alias

Examples

      PROCEDURE Main()
         USE tests NEW
         DBGOTOP()
         ? "Is Eof()", EOF()
         DBGOBOTTOM()
         ? "Is Eof()", EOF()
         USE
         RETURN

Compliance

Clipper

Files

Library is rdd

Seealso

EOF(), FOUND(), LASTREC()