User Guide
764 Chapter 4: ColdFusion C++ CFX Reference
CCFXRequest::SetVariable
Syntax
void CCFXRequest::SetVariable(LPCSTR lpszName, LPCSTR lpszValue)
Description
Sets a variable in the calling template. If the variable name already exists in the template, its value
is replaced. If it does not exist, a variable is created. The values of variables created using
SetVariable can be accessed in the same manner as other template variables (for example,
#MessageSent#).
Parameters
Example
The following example sets the value of a variable named 'MessageSent' based on the success of
an operation performed by the custom tag:
BOOL bMessageSent;
...attempt to send the message...
if ( bMessageSent == TRUE )
{
pRequest->SetVariable( "MessageSent", "Yes" ) ;
}
else
{
pRequest->SetVariable( "MessageSent", "No" ) ;
}
CCFXRequest::ThrowException
Syntax
void CCFXRequest::ThrowException(LPCSTR lpszError,
LPCSTR lpszDiagnostics)
Description
Throws an exception and ends processing of a request. Call this function when you encounter an
error that does not allow you to continue processing the request. This function is almost always
combined with the
CCFXRequest::ReThrowException to protect against resource leaks in
extension code.
Parameters
Parameter Description
lpszName Name of variable
lpszValue Value of variable
Parameter Description
lpszError Short identifier for error
lpszDiagnostics Error diagnostic information