SDK Overview of Level 1

From Recital Documentation Wiki
Jump to: navigation, search

Level 1 Functions

Function Level 1 Description
_parc() Pass a pointer to a Recital character string
_parclen() Length of a character string
_parcsiz() Size of a character string passed by reference
_pards() Pass a character pointer to a Recital date
_parinfa() Parameter checking of arrays
_parinfo() Parameter checking
_parl() Pass a Recital logical as an integer
_parnd() Pass a Recital numeric as a double
_parni() Pass a Recital numeric as an integer
_parnl() Pass a Recital numeric as a long
_paro() Pass an object pointer to a Recital object
_parts() Pass a character pointer to a Recital datetime
_parys() Pass a character pointer to a Recital currency
_ret() Return to Recital
_retc() Return a character string to Recital
_retclen() Return a character string and its length to Recital
_retds() Return a date string to Recital
_retl() Return an integer to a Recital logical
_retnd() Return a double to a Recital numeric
_retni() Return an integer to a Recital numeric
_retnl() Return a long to a Recital numeric
_reto() Return an object to Recital
_retts() Return a datetime string to Recital
_retys() Return a currency string to Recital
ALENGTH() Number of array elements
ISARRAY() Is parameter an array
ISCHAR() Is parameter a character string
ISCURRENCY() Is parameter a currency
ISDATE() Is parameter a date
ISDATETIME() Is parameter a datetime
ISLOG() Is parameter a logical
ISMEMO() Is parameter a memo
ISNUM() Is parameter a numeric
ISOBJECT() Is parameter an object
PCOUNT() Number of parameters passed


Level 1 functions are used for passing parameters between the 'C' functions and Recital. When creating a 'C' function with the API the parameters being passed should not be defined in the function name like a normal 'C' function. Instead the parameters passed are referenced with the API _par functions. Each parameter passed is referenced by specifying a number representing the ordinal position in the parameter list with the API _par function call.

For example, the following 'C' function is passed 2 parameters from Recital. The data type of each parameter is checked first with the _parinfo() function, then the value of the parameters are passed to a char with the _parc() function. Lastly the char value is then returned to Recital.

#include "dbapi.h"
 
dbapi_test_function()
{
    char string1[9];
    char string2[9];
 
    if (_parinfo(1) == API_CTYPE) {
       strcpy( string1, _parc(1));
    }
    if (_parinfo(2) == API_CTYPE) {
       strcpy( string2, _parc(2));
    }
 
    _retc( string1 );
}

Values are returned to Recital using the API _ret functions. Recital memory variables and array elements can also be updated from within the 'C' function to store the results, see level 3.