Sets the length, in bytes, for an external stored procedure output parameter or the result of a UDF or UDM that has a VARCHAR data type.
Syntax
void FNC_SetVarCharLength(void *outputString, int outputStringLength);
Syntax Elements
- outputString
- a pointer to an external stored procedure output parameter or the result of a UDF or UDM that has a data type of VARCHAR.
- outputStringLength
- the length of the string pointed to by outputString.
Usage Notes
Normally, the database uses strlen to determine the length of an external routine output parameter or result. If the output string contains NULLs, you can use FNC_SetVarCharLength to explicitly set the length of the output string. If you call FNC_SetVarCharLength, the database does not use strlen to get the length of an external routine output parameter or result.
Undefined results occur if the outputString argument points to data that is not VARCHAR or if outputStringLength is an incorrect length.
Example Using FNC_SetVarCharLength
#define SQL_TEXT Latin_Text #include "sqltypes_td.h" void dstrrev13(VARCHAR_LATIN *input, int inplen, VARCHAR_LATIN *result) { int i; for (i=0; i< inplen; i++) result[inplen-i-1] = input[i]; } void strrevdecomp_varchar(VARBYTE *InputValue, VARCHAR_LATIN *ResultValue, char sqlstate[6]) { dstrrev13(InputValue->bytes, InputValue->length, ResultValue); FNC_SetVarCharLength(ResultValue,InputValue->length); }