NetErr()

NETERR()

Tests the success of a network function

Syntax

      NETERR([<lNewError>]) --> lError

Arguments

<lNewError> Is a logical Expression.

Returns

<lError> A value based on the success of a network operation or function.

Description

This function return a logical true (.T.) is a USE, APPEND BLANK, or a USE…EXCLUSIVE command is issue and fails in a network enviroment. In the case of USE and USE…EXCLUSIVE commands, a NETERR() value of .T. would be returned if another node of the network has the exclusive use of a file. And the case of the APPEND BLANK command, NETERR() will return a logical true (.T.) if the file or record is locked by another node or the value of LASTREC() has been advanced The value of NETERR() may be changed via the value of <lNewError>. This allow the run-time error-handling system to control the way certains errors are handled.

Examples

      USE test NEW INDEX test
      IF ! NetErr()
          SEEK test->Name := "HARBOUR"
          IF Found()
             ? test->Name
          ENDIF
      ENDIF
      USE

Compliance

Clipper

Files

Library is rdd

Seealso

FLOCK(), RLOCK()

FLock()

FLOCK()

Locks a file

Syntax

      FLOCK() --> lSuccess

Returns

<lSuccess> A true (.T.) value, if the lock was successful;otherwise false (.F.)

Description

This function returns a logical true (.T.) if a file lock is attempted and is successfully placed on the current or designated database. This function will also unlock all records locks placed by the same network station.

Examples

      USE tests New
      IF FLOCK()
         SUM tests->Ammount
      ENDIF
      USE

Compliance

Clipper

Files

Library is rdd

Seealso

RLOCK()

dbUnlockAll()

DBUNLOCKALL()

Unlocks all records and releases all file locks in all work areas.

Syntax

      DBUNLOCKALL()

Description

This function will remove all file and record locks in all work area.

Examples

      nId := 10
      USE tests INDEX testid NEW
      USE tests1 INDEX tests NEW
      IF testid->( DBSEEK( nId ) )
         IF testid->( RLOCK() )
            DBDELETE()
         ELSE
            DBUNLOCK()
         ENDIF
      ELSE
         DBUNLOCKALL()
      ENDIF
      USE

Compliance

Clipper

Files

Library is rdd

Seealso

DBUNLOCK(), FLOCK(), RLOCK()

dbUnlock()

DBUNLOCK()

Unlock a record or release a file lock

Syntax

      DBUNLOCK()

Description

This function releases the file or record lock in the currently selected or aliased work area. It will not unlock an associated lock in a related databases.

Examples

      nId := 10
      USE testid INDEX testid NEW
      IF testid->( DBSEEK( nId ) )
         IF testid->( RLOCK() )
            DBDELETE()
         ELSE
            DBUNLOCK()
         ENDIF
      ENDIF
      USE

Compliance

Clipper

Files

Library is rdd

Seealso

DBUNLOCKALL(), FLOCK(), RLOCK()

dbRUnlock()

DBRUNLOCK()

Unlocks a record based on its identifier

Syntax

      DBRUNLOCK([<xIdentity>])

Arguments

<xIdentity> Record identifier, typically a record number

Description

This function will attempt to unlock the record specified as <xIdentity>, which in a .dbf format is the record number. If not specified, them the current active record/data item will be unlocked

Examples

      PROCEDURE Main()
         USE tests NEW
         DBGOTO( 10 )
         IF RLOCK()
            ? tests->ID
            DBRUNLOCK()
         ENDIF
         USE
         RETURN

Compliance

Clipper

Files

Library is rdd

Seealso

RLOCK(), DBRLOCK(), DBRLOCKLIST()

dbRLockList()

DBRLOCKLIST()

This function return a list of locked records in the database work area

Syntax

      DBRLOCKLIST() --> aRecordLocks

Returns

<aRecordList> is an array of lock records

Description

This function will return an array of locked records in a given and active work area. If the return array is an empty array (meaning no elements in it), then there are no locked records in that work area.

Examples

      PROCEDURE Main()
         LOCAL aList := {}
         LOCAL x := 0
         USE tests NEW
         DBGOTO( 10 )
         RLOCK()
         DBGOTO( 100 )
         RLOCK()
         aList := DBRLOCKLIST()
         FOR x := 1 TO Len( aList )
            ? aList[ x ]
         NEXT
         USE
         RETURN

Compliance

Clipper

Files

Library is rdd

Seealso

RLOCK(), DBRLOCK(), DBRUNLOCK()

dbRLock()

DBRLOCK()

This function locks the record based on identity

Syntax

      DBRLOCK([<xIdentity>]) --> lSuccess

Arguments

<xIdentity> Record identifier

Returns

DBRLOCK() returns a logical true (.T.) if lock was successful

Description

This function attempts to lock a record which is identified by <xIdentity> in the active data set. If the lock is successful the function will return a logical true (.T.) value; otherwise a logical false (.F.) will be returned. If <xIdentity> is not passed it will be assumed to lock the current active record/data item.

Examples

      PROCEDURE Main()
         LOCAL x := 0
         USE tests NEW
         FOR x := 1 TO reccount()
            IF ! DBRLOCK()
               DBUNLOCK()
            ENDIF
         NEXT
         USE

Compliance

Clipper

Files

Library is rdd

Seealso

DBUNLOCK(), DBUNLOCKALL(), FLOCK(), RLOCK()