Difference between revisions of "DBF LOCKR()"

From Recital Documentation Wiki
Jump to: navigation, search
 
Line 52: Line 52:
  
 
==SEE ALSO==
 
==SEE ALSO==
[[
+
[[BLOB_UPDATE()]], [[BLOB_WRITE()]], [[DBF_APPEND()]], [[DBF_DELETE()]], [[DBF_ISEXCLUSIVE()]], [[DBF_ISREADONLY()]], [[DBF_LOCKF()]], [[DBF_RECALL()]], [[DBF_RECNO()]], [[DBF_UNLOCKF()]], [[DBF_UNLOCKR()]], [[DBF_UPDATE()]], [[FIELD_UPDATE()]], [[MEMO_UPDATE()]], [[MEMO_WRITE()]]
BLOB_UPDATE()]], [[BLOB_WRITE()]], [[DBF_APPEND()]], [[DBF_DELETE()]], [[DBF_ISEXCLUSIVE()]], [[DBF_ISREADONLY()]], [[DBF_LOCKF()]], [[DBF_RECALL()]], [[DBF_RECNO()]], [[DBF_UNLOCKF()]], [[DBF_UNLOCKR()]], [[DBF_UPDATE()]], [[FIELD_UPDATE()]], [[MEMO_UPDATE()]], [[MEMO_WRITE()]]
+
  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:SDK]]
 
[[Category:SDK]]

Latest revision as of 10:25, 30 March 2009

PURPOSE

Lock a record


SYNONYM

api_dbf_lockr()


SYNOPSIS

#include "dbapi.h"
 
int	DBF_LOCKR(recnum)
 
<input parameters>
long	recnum;		/* Record number		*/
 
<output parameters>
none


DESCRIPTION

The DBF_LOCKR() function will lock the specified record. A value of -1 will be returned if there is no database open in the current workarea or the specified record number to lock is out of range.

The record lock will be issued when no other user has a file lock or the specified record locked.

The database will still be opened for shared read/write access for other users however they will not be able to update the record you have locked until you release the record lock.


EXAMPLE

The following example locks the current record.

#include "dbapi.h"
 
dbapi_dbf_lockr()
{
    int 	locked;
 
    if (DBF_ISEXCLUSIVE() == 0 ) {
       locked = DBF_LOCKR(DBF_RECNO());
    } else {
       locked = -1;
    }
 
    _retl( (locked) ? 1 : 0 );
 
}


SEE ALSO

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