Difference between revisions of "MEMVAR UPDATE()"

From Recital Documentation Wiki
Jump to: navigation, search
 
(3 intermediate revisions by one user not shown)
Line 15: Line 15:
 
<input parameters>
 
<input parameters>
 
char *name; /* Address of a buffer containing the memory variable name */
 
char *name; /* Address of a buffer containing the memory variable name */
char type; /* Memory variable type */
+
char type; /* Memory variable type */
int width; /* Memory variable width */
+
int width; /* Memory variable width */
int decimal; /* Number of decimal places */
+
int decimal; /* Number of decimal places */
char string; /* Address of a buffer containing character string */
+
char string; /* Address of a buffer containing character string */
double *number; /* Numeric value */
+
double *number; /* Numeric value */
char logical; /* Logical value */
+
char logical; /* Logical value */
unsigned long date; /* Recital date */
+
unsigned long date; /* Recital date */
DATETIME datetime; /* Recital datetime */
+
DATETIME datetime; /* Recital datetime */
CURRENCY currency; /* Recital currency */
+
CURRENCY currency; /* Recital currency */
  
 
<output parameters>
 
<output parameters>
Line 92: Line 92:
  
 
rc = MEMVAR_UPDATE( "character", 'C', 7, 0,  
 
rc = MEMVAR_UPDATE( "character", 'C', 7, 0,  
string, &numeric, logical, date, datetime, currency);
+
string, &numeric, logical, date, datetime, currency);
 
rc = MEMVAR_UPDATE( "number", 'N', 10, 2,  
 
rc = MEMVAR_UPDATE( "number", 'N', 10, 2,  
string, &numeric, logical, date, datetime, currency);
+
string, &numeric, logical, date, datetime, currency);
 
rc = MEMVAR_UPDATE( "logical", 'L', 1, 0,  
 
rc = MEMVAR_UPDATE( "logical", 'L', 1, 0,  
string, &numeric, logical, date, datetime, currency);
+
string, &numeric, logical, date, datetime, currency);
 
rc = MEMVAR_UPDATE( "date", 'D', 8, 0,  
 
rc = MEMVAR_UPDATE( "date", 'D', 8, 0,  
string, &numeric, logical, date, datetime, currency);
+
string, &numeric, logical, date, datetime, currency);
 
rc = MEMVAR_UPDATE( "datetime", 'T', sizeof(DATETIME), 0,  
 
rc = MEMVAR_UPDATE( "datetime", 'T', sizeof(DATETIME), 0,  
string, &numeric, logical, date, datetime, currency);
+
string, &numeric, logical, date, datetime, currency);
 
rc = MEMVAR_UPDATE( "currency", 'Y', sizeof(CURRENCY), 0,  
 
rc = MEMVAR_UPDATE( "currency", 'Y', sizeof(CURRENCY), 0,  
string, &numeric, logical, date, datetime, currency);
+
string, &numeric, logical, date, datetime, currency);
  
 
}
 
}

Latest revision as of 15:06, 27 March 2009

PURPOSE

Update a Recital memory variable


SYNONYM

api_memvar_update()


SYNOPSIS

#include "dbapi.h"
 
int	MEMVAR_UPDATE(name, type, width, decimal, string, number, logical, date)
 
<input parameters>
char		*name;		/* Address of a buffer containing the memory variable name	*/
char		type;			/* Memory variable type							*/
int		width;		/* Memory variable width						*/
int		decimal;		/* Number of decimal places						*/
char		string;		/* Address of a buffer containing character string			*/
double		*number;		/* Numeric value								*/
char		logical;		/* Logical value								*/
unsigned long	date;		/* Recital date								*/
DATETIME	datetime;		/* Recital datetime							*/
CURRENCY	currency;		/* Recital currency								*/
 
<output parameters>
none


DESCRIPTION

The MEMVAR_UPDATE() function will update a specified Recital memory variable.

Recital will only recognize the first 10 characters on a memory name as being unique. The memory variable names are not case sensitive and must have been previously defined before updating, or the MEMVAR_UPDATE() function will return a value of -1.

Memory variables can be updated with different data types than they are currently defined. The variable type parameter specifies both the data type and which input parameter value will be used to update the memory variable.

The width parameter is used to specify length of the memory variable. A decimal place can be specified for a number, but should be 0 for other data types.

A memory variable can be defined as any one of the following.


TYPE OUTPUT WIDTH DESCRIPTION
C string 1-8192 Address of a buffer containing a character string
D date 8 Unsigned long representing a recital date
L logical 1 Character of either 'T' for true or 'F' for false
N number 1-16 A value stored in a double
T info_datetime sizeof(DATETIME) RCT_DATETIME_DEF structure
Y info_currency sizeof(CURRENCY) RCT_CURRENCY_DEF structure


EXAMPLE

The following example defines six memory variables and then stores the specified values to each variable.

#include "dbapi.h"
 
dbapi_store()
{
	int			rc;
	double			numeric;
	char			string[8];
	char			logical;
	unsigned long		date;
	DATETIME		datetime;
	CURRENCY		currency;
 
	strcpy(string, "Recital");
	date = DATE_CTOD(DATE_DATE());
	logical = 'T';
	numeric = 23.5;
	datetime = DATE_STOT(DATE_DATETIME());
	currency = CURR_STOY("6474.99");
 
	COMMAND("release all");
	MEMVAR_DEFINE( "character", API_PRIVATE );
	MEMVAR_DEFINE( "number", API_PRIVATE );
	MEMVAR_DEFINE( "logical", API_PRIVATE );
	MEMVAR_DEFINE( "date", API_PRIVATE );
	MEMVAR_DEFINE( "datetime", API_PRIVATE );
	MEMVAR_DEFINE( "currency", API_PRIVATE );
 
	rc = MEMVAR_UPDATE( "character", 'C', 7, 0, 
		string, &numeric, logical, date, datetime, currency);
	rc = MEMVAR_UPDATE( "number", 'N', 10, 2, 
		string, &numeric, logical, date, datetime, currency);
	rc = MEMVAR_UPDATE( "logical", 'L', 1, 0, 
		string, &numeric, logical, date, datetime, currency);
	rc = MEMVAR_UPDATE( "date", 'D', 8, 0, 
		string, &numeric, logical, date, datetime, currency);
	rc = MEMVAR_UPDATE( "datetime", 'T', sizeof(DATETIME), 0, 
		string, &numeric, logical, date, datetime, currency);
	rc = MEMVAR_UPDATE( "currency", 'Y', sizeof(CURRENCY), 0, 
		string, &numeric, logical, date, datetime, currency);
 
}


SEE ALSO

ARRAY_UPDATE(), MEMVAR_DEFINE(), MEMVAR_LOOKUP()