version 2003
PA_CreateVariable (varKind; stringSize) PA_Variable
Parameter | Type | Description | |
varKind | PA_VariableKind | Kind of the variable to create | |
stringSize | short | Length of a string variable | |
Function result | PA_Variable | Variable of appropriate kind |
Description
The routine PA_CreateVariable creates and initializes a variable of the appropriate kind and returns it.
Pass the kind of variable you want to create in the varKind parameter. If you create a string variable, pass the length of the string in stringSize. For all other kinds, the stringSize parameter is ignored.
PA_CreateVariable initializes the variable at its default value (0 for numerics, empty string, null date, 0 size BLOB, zero element array) and takes care of every memory allocation needed by some specific kinds (arrays, BLOBs)
The different kinds of variables are listed in an enumeration in the PublicType.h header file:
typedef enum { eVK_Real = 1, // Variable declared using C_REAL eVK_Text = 2, // Variable declared using C_TEXT eVK_Date = 4, // Variable declared using C_DATE eVK_Undefined = 5, // Undefined variable eVK_Boolean = 6, // variable declared using C_BOOLEAN eVK_Longint = 9, // Variable declared using C_LONGINT eVK_Picture = 10, // Variable declared using C_PICTURE eVK_Time = 11, // Variable declared using C_TIME eVK_ArrayOfArray = 13, // Any two-dimensional array eVK_ArrayReal = 14, // One dimension array declared using ARRAY REAL eVK_ArrayInteger = 15, // One dimension array declared using ARRAY INTEGER eVK_ArrayLongint = 16, // One dimension array declared using ARRAY LONGINT eVK_ArrayDate = 17, // One dimension array declared using ARRAY DATE eVK_ArrayText = 18, // One dimension array declared using ARRAY TEXT eVK_ArrayPicture = 19, // One dimension array declared using ARRAY PICTURE eVK_ArrayPointer = 20, // One dimension array declared using ARRAY POINTER eVK_ArrayString = 21, // One dimension array declared using ARRAY STRING eVK_ArrayBoolean = 22, // One dimension array declared using ARRAY BOOLEAN eVK_Pointer = 23, // Variable declared using C_POINTER eVK_String = 24, // Variable declared using C_STRING eVK_Blob = 30 // Variable declared using C_BLOB } PA_VariableKind;
Example
Create variables .
PA_Variable aLong, aPicture, aTextArray; aLong = PA_CreateVariable(eVK_Longint, 0); aPicture = PA_CreateVariable(eVK_Picture, 0); aTextArray = PA_CreateVariable(eVK_ArrayText, 0);
See Also
Every PA_GetxxxVariable, Every PA_SetxxxVariable, PA_VariableKind.
Error Handling
PA_GetLastError keeps the last error that occurred before calling PA_CreateVariable.