Harbour Reference Guide

 

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() wilI be a logical false and EOF() will he a logical 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
      FUNCTION Main()
      USE Tests New INDEX Tests
      DBGOTO(10)
      nId:=Tests->nId
      IF Tests->(DBSEEK(nId))
        IF RLOCK()
           ? Tests->Name
           DBRUNLOCK()
        ENDIF
      ENDIF
      USE
      RETURN NIL

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

Status

Started

Compliance

DBSEEK() is Compatible with CA-Clipper 5.3

Files

Library is rdd

See Also

 




[Source Forge]

Other Docs Categories

Advantage Database RDD
Array
Binary conversion
Classes
Code Block
Console input
Conversion
Conversion Tools
DOS
Data input and output
Database
Database Tools
Date
Dos Tools
Environment
Error recovery
Events
File management
GT
Harbour Tools
Internal
Low Level
Math
Misc
Miscellaneous
Nation
Object manipulation
Operating System Specific
Parameter Checks
String Tools
Strings
TBrowse Method
TBrowse class
Terminal
Time
Utility
Variable Management

 

Last updated on 2001/07/30