The AddVariable method adds a variable to the execution context of a transformation server. AddVariable is always called one time before ValidateSchema to add the IDTSErrorRecords object.
HRESULT AddVariable (
LPBYTE pvTransformServerData,
LPCOLESTR pwzName,
BOOL bGlobal,
VARIANT Variable );
Argument | Description |
---|---|
pvTransformServerData [in] | Transform server state data |
pwzName [in] | Variable name |
bGlobal [in] | For Microsoft® ActiveX® scripts, indicates whether this variable’s methods must be qualified by the object name |
Variable [in] | Variable value; passed to and updatable by the transformation server |
AddVariable allows an application variable to be passed through to the transformation process. The data pump always calls this method to add the DTSErrorRecords object immediately after a call to IDTSDataPumpTransform::Initialize and before a call to ValidateSchema. This allows ValidateSchema to add errors to the OLE DB error records collection for the thread if columns are found to be in error.
For ActiveX scripts, the variable is ignored if the variant is not of type VT_DISPATCH, which allows all variables to be passed to all transformation servers. The bGlobal parameter indicates whether the IDispatch * variable’s properties and methods are to be added to the global namespace of the script; if so, the method can be called directly, instead of requiring qualification using the object name. Data pump-generated variables (for example, DTSErrorInfo, and the DTSSource and DTSDestination column collections) are always added with this flag set to FALSE to minimize the likelihood of name conflict.