IDTSDataPumpTransform2::ProcessPhase

DTS Programming

DTS Programming

IDTSDataPumpTransform2::ProcessPhase

The ProcessPhase method executes a phase of the transformation for a single row.

Syntax

HRESULT ProcessPhase (     LPBYTE pvTransformServerData,
    LPCDTSTransformColumnInfo pSrcColumnInfo,
    LPDTSTransformColumnInfo pDestColumnInfo,
    IDTSDataConvert *pIDTSDataConvert,
    LPCDTSTransformPhaseInfo pPhaseInfo,
    LPDTSTransformStatus peTransformStatus );

Argument Description
pvTransformServerData [in] Transformation server state data
pSrcColumnInfo [in] Source column and row data
pDestColumnInfo [in/out] Destination column and row data
pIDTSDataConvert [in] Pointer to the data conversion interface
pPhaseInfo [in] Transform phase information structure
peTransformStatus [out] Result of the transformation

Remarks

This function is called by the data pump and executes a phase of the transformation. The phase is identified by a code from DTSTransformPhaseEnum in a field of pPhaseInfo, a DTSTransformPhaseInfo structure. The following table lists the transformation phases that are available.

Phase Description
DTSTransformPhase_PreSourceData Called before first fetch of source data. Valid destination codes can be returned in peTransformStatus to write a destination row. DTSTransformStat_SkipFetch can be returned to loop and write multiple rows.
DTSTransformPhase_Transform Transforms source columns to destination columns. Performs same function as IDTSDataPumpTransform::Execute.
DTSTransformPhase_OnTransformFailure Called when DTSTransformPhase_Transform phase returns DTSTransformStat_Error or DTSTransformStat_ExceptionRow. The returned peTransformStatus overrides that from DTSTransformPhase_Transform. The insert operation and data driven queries (DDQs) will be attempted if the peTransformStatus so directs.
DTSTransformPhase_OnInsertSuccess Called on success of the insert/DDQ. Destination operations cannot be specified in peTransformStatus as the destination row has already been written.
DTSTransformPhase_OnInsertFailure Called on failure of the insert operation or data driven query. Destination operations cannot be specified in peTransformStatus (for example, the insert operation and data driven query cannot be retried).
DTSTransformPhase_OnBatchComplete Called after the success or failure of a data pump batch. The batch size is defined by the InsertCommitSize property.
DTSTransformPhase_PostSourceData Called after last row of source data has been fetched and transformed. Valid destination codes can be returned in peTransformStatus to write a destination row, but no source data is available. DTSTransformStat_SkipFetch can be returned to loop and write multiple rows.
DTSTransformPhase_OnPumpComplete Called when data pump operation completes as a success or failure, if the transformation supports this phase. It is called in place of IDTSDataPumpTransform::OnTransformComplete. The pPhaseInfo structure is available.

ProcessPhase is only called for the phases that are returned in the peSupportedPhases parameter of IDTSDataPumpTransform2::GetTransformServerInfo. When there are multiple transformations, each phase is executed for all the transformations, in the order in which they were created, before moving on to the next phase.

Note  ProcessPhase is not called for a phase specified by GetTransformServerInfo unless the value specified for the TransformPhases property of the Transformation2 object also specifies the phase. For packages built in Data Transformation Services (DTS) Designer, specify phases on the Phases tab of the Transformation Options dialog box. The one exception is DTSTransformPhase_OnPumpComplete, for which ProcessPhase called (in place of OnTransformComplete) whenever GetTransformServerInfo specifies the phase is supported.

The source and destination column data is described by the DTSTransformColumnInfo structures referenced by pSrcColumnInfo and pDestColumnInfo. Column data should be written in the buffer referenced by DTSColumnData.pvData of the element for the destination column, at the offset specified by DBBINDING.obValue. You can instead store a pointer to the data at this location if you add the DBTYPE_BYREF flag to DBBINDING.wType. For more information and a description of these fields, see Column Information Structures in DTS Transformations.

Transformations that implement both IDTSDataPumpTransform and IDTSDataPumpTransform2 typically implement Execute by calling IDTSDataPumpTransform2::ProcessPhase with NULL for the pPhaseInfo parameter.

The IDTSDataConvert interface provides a DTS-compatible conversion utility. For more information, search include file dtspump.h for IDTSDataConvert. dtspump.h is installed by default to c:\Program Files\Microsoft SQL Server\80\Tools\DevTools\include\.

See Also

DTSTransformPhaseEnum

DTSTransformPhaseInfo Object

IDTSDataPumpTransform::Execute

IDTSDataPumpTransform::OnTransformComplete

IDTSDataPumpTransform2::GetTransformServerInfo

InsertCommitSize Property

TransformPhases Property