MEMO UPDATE()

From Recital Documentation Wiki
Jump to: navigation, search

PURPOSE

Update a memo field


SYNONYM

api_memo_update()


SYNOPSIS

#include "dbapi.h"
 
int	MEMO_UPDATE(fldname, memo)
 
<input parameters>
char	*fldname;		/* Address of a buffer containing the name of a memo field	*/
char	*memo;		/* Address of a buffer containing the memo			*/
 
<output parameters>
none


DESCRIPTION

The MEMO_UPDATE() function will update the specified memo field with the contents of the memo buffer. The space occupied by the memo in the memo in the memo file is overwritten with the specified memo buffer. The MEMO_UPDATE() function is the same as using both the MEMO_RECLAIM() and MEMO_WRITE() function together.

A value of -1 will be returned if the field is not a MEMO.


EXAMPLE

The following example deletes the current contents of the specified memo and updates it with the value specified in the second parameter

#include "dbapi.h"
 
dbapi_memo_update()
{
	int	result;
 
	if (_parinfo(1) == API_CTYPE && _parinfo(2) == API_CTYPE) {
 
	if (!DBF_ISEXCLUSIVE()) DBF_LOCKR(DBF_RECNO());
 
	result = MEMO_UPDATE(_parc(1), _parc(2));
	if (result) result = DBF_UPDATE();
 
	if (!DBF_ISEXCLUSIVE()) DBF_UNLOCKR(DBF_RECNO());
 
	} else {
		result = -1;
	}
 
	_retni(result);
}


SEE ALSO

BLOB_UPDATE(), BLOB_WRITE(), DBF_APPEND(), DBF_DELETE(), DBF_ISEXCLUSIVE(), DBF_ISREADONLY(), DBF_LOCKF(), DBF_LOCKR(), DBF_RECALL(), DBF_UNLOCKF(), DBF_UNLOCKR(), FIELD_UPDATE(), MEMO_MLCOUNT(), MEMO_MLINE(), MEMO_READ(), MEMO_SIZE(), MEMO_WRITE()