Difference between revisions of "DBF LOCKR()"
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
Line 1: | Line 1: | ||
==PURPOSE== | ==PURPOSE== | ||
− | + | Lock a record | |
==SYNONYM== | ==SYNONYM== | ||
− | + | api_dbf_lockr() | |
Line 11: | Line 11: | ||
#include "dbapi.h" | #include "dbapi.h" | ||
− | int | + | int DBF_LOCKR(recnum) |
<input parameters> | <input parameters> | ||
− | long recnum; | + | long recnum; /* Record number */ |
− | <output parameters> | + | <output parameters> |
none | none | ||
</code> | </code> | ||
Line 22: | Line 22: | ||
==DESCRIPTION== | ==DESCRIPTION== | ||
− | The | + | 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== | ==EXAMPLE== | ||
− | The following example locks | + | The following example locks the current record. |
<code lang="c"> | <code lang="c"> | ||
#include "dbapi.h" | #include "dbapi.h" | ||
− | + | dbapi_dbf_lockr() | |
{ | { | ||
− | int | + | int locked; |
− | + | ||
− | + | if (DBF_ISEXCLUSIVE() == 0 ) { | |
− | + | locked = DBF_LOCKR(DBF_RECNO()); | |
− | if ( | + | } else { |
+ | locked = -1; | ||
+ | } | ||
− | + | _retl( (locked) ? 1 : 0 ); | |
+ | |||
} | } | ||
</code> | </code> | ||
Line 45: | Line 52: | ||
==SEE ALSO== | ==SEE ALSO== | ||
− | [[BLOB_UPDATE()]], [[BLOB_WRITE()]], [[DBF_APPEND()]], [[DBF_DELETE()]], [[DBF_ISEXCLUSIVE()]], [[DBF_ISREADONLY()]], [[DBF_LOCKF()]], [[DBF_RECALL()]], [[DBF_UNLOCKF()]], [[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]] |
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()