Difference between revisions of "Dblockr()"

From Recital Documentation Wiki
Jump to: navigation, search
 
 
Line 11: Line 11:
  
 
<input parameter>
 
<input parameter>
char *dbf; /* File descriptor of a .DBF file to be locked */
+
char *dbf; /* File descriptor of a .DBF file to be locked */
int recno; /* Record number to lock */
+
int recno; /* Record number to lock */
  
 
<output parameter>
 
<output parameter>
Line 37: Line 37:
 
<code lang="c">
 
<code lang="c">
 
#include "dbl.h"
 
#include "dbl.h"
char *dbf; /* Database file descriptor */
+
char *dbf; /* Database file descriptor */
int rc; /* Return code */
+
int rc; /* Return code */
  
 
rc = dblockr(dbf, 5);
 
rc = dblockr(dbf, 5);
if (rc = SUCCESS) printf("record 5 is locked n");
+
if (rc == SUCCESS) printf("record 5 is locked \n");
 
else {
 
else {
printf("record 5 could not be locked n");
+
printf("record 5 could not be locked \n");
 
return (ERROR);
 
return (ERROR);
 
}
 
}

Latest revision as of 13:43, 1 May 2009

PURPOSE

lock a record in a database file


SYNOPSIS

#include "dbl.h"
 
	int	dblockr(dbf, recno)
 
	<input parameter>
	char	*dbf;		/* File descriptor of a .DBF file to be locked */
	int	recno;	/* Record number to lock */
 
	<output parameter>
	none


RETURN VALUE

The dblockr() function returns 0 for success, or < 0 if an error occurs. See the section on return code value for a detailed list of return codes.


DESCRIPTION

The dblockr() function locks a record in the database file from the given file descriptor "char *dbf". The record locked is the number in "int recno".


EXAMPLE

The following example locks record number 5 in the .DBF file whose file descriptor is in "char *dbf".


#include "dbl.h"
	char	*dbf;		/* Database file descriptor */
	int	rc;		/* Return code */
 
	rc = dblockr(dbf, 5);
	if (rc == SUCCESS) printf("record 5 is locked \n");
	else {
		printf("record 5 could not be locked \n");
		return (ERROR);
	}


SEE ALSO

dbfilemode(), dblockf(), dblocki(), dbtlockf(), dbtlockr(), dbunlockf(), dbunlocki(), dbunlockr()