DBF LOCKF()

From Recital Documentation Wiki
Revision as of 10:26, 30 March 2009 by Yvonnemilne (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

PURPOSE

Lock a database


SYNONYM

api_dbf_lockf()


SYNOPSIS

#include "dbapi.h"
 
int	DBF_LOCKF()
 
<input parameters>
none
 
<output parameters>
none


DESCRIPTION

The DBF_LOCKF() function will lock the database in the current workarea. A value of -1 will be returned if there is no database open in the current workarea.

The file lock will be issued on the shared database when no other user has a file or record lock current.

The database will still be opened shared for readonly access for other users however they will not be able to update any records until you release the file lock.


EXAMPLE

The following example locks the current database.

#include "dbapi.h"
 
dbapi_dbf_lockf()
{
    int	locked;
 
    if  (DBF_ISEXCLUSIVE() == 0 ) {
       locked = DBF_LOCKF();
    } else {
       locked = -1;
    }
 
    _retl( (locked >= 0) ? 1 : 0 );
 
}


SEE ALSO

BLOB_UPDATE(), BLOB_WRITE(), DBF_APPEND(), DBF_DELETE(), DBF_ISEXCLUSIVE(), DBF_ISREADONLY(), DBF_LOCKR(), DBF_RECALL(), DBF_UNLOCKF(), DBF_UNLOCKR(), DBF_UPDATE(), FIELD_UPDATE(), MEMO_UPDATE(), MEMO_WRITE()