PipelineBuffer.DirectErrorRow 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将 PipelineBuffer 行发送到其 IDTSOutput100 属性为 true
的 IsErrorOut。
重载
DirectErrorRow(Int32, Int32, Int32) |
将行 PipelineBuffer 发送到 IDTSOutput100 其属性为 true 的 IsErrorOut 行。 |
DirectErrorRow(Int32, Int32, Int32, Int32) |
将行 PipelineBuffer 发送到 IDTSOutput100 其属性为 true 的 IsErrorOut 行。 |
DirectErrorRow(Int32, Int32, Int32)
将行 PipelineBuffer 发送到 IDTSOutput100 其属性为 true 的 IsErrorOut 行。
public:
void DirectErrorRow(int outputID, int errorCode, int errorColumn);
public void DirectErrorRow (int outputID, int errorCode, int errorColumn);
member this.DirectErrorRow : int * int * int -> unit
Public Sub DirectErrorRow (outputID As Integer, errorCode As Integer, errorColumn As Integer)
参数
- outputID
- Int32
发送 IDTSOutput100 行的错误 PipelineBuffer 的 ID。
- errorCode
- Int32
处理行时发生的错误号。
- errorColumn
- Int32
导致错误的 PipelineBuffer 列的 ID。
示例
下面的代码示例演示如何使用 DirectErrorRow 该方法将缓冲区中的行定向到同步错误输出。
public override void ProcessInput(int inputID, PipelineBuffer buffer)
{
IDTSInput100 input = ComponentMetaData.InputCollection.GetObjectByID(inputID);
/// This code sample assumes the component has 2 outputs, one the default,
/// the other the error output. If the errorOutputIndex returned from GetErrorOutputInfo
/// is 0, then the default output is the second output in the collection.
int defaultOutputID = -1;
int errorOutputID = -1;
int errorOutputIndex = -1;
GetErrorOutputInfo(ref errorOutputID,ref errorOutputIndex);
if (errorOutputIndex == 0)
defaultOutputID = ComponentMetaData.OutputCollection[1].ID;
else
defaultOutputID = ComponentMetaData.OutputCollection[0].ID;
while (buffer.NextRow())
{
try
{
/// TODO: Implement code to process the columns in the buffer row.
/// Ideally, your code should detect potential exceptions prior to them occurring, rather
/// than having a generic try/catch block such as this.
/// However, since the error or truncation implementation is specific to each component
/// this sample focuses on actually directing the row, and not a single error or truncation.
/// Unless an exception occurs, direct the row to the default
buffer.DirectRow(defaultOutputID);
}
catch
{
/// Yes. Has the user specified to redirect the row?
if (input.ErrorRowDisposition == DTSRowDisposition.RD_RedirectRow)
{
/// Yes, direct the row to the error output.
/// TODO: Add code to include the errorColumnID
buffer.DirectErrorRow(errorOutputID, 0, errorColumnID);
}
else if (input.ErrorRowDisposition == DTSRowDisposition.RD_FailComponent || input.ErrorRowDisposition == DTSRowDisposition.RD_NotUsed)
{
/// No, the user specified to fail the component, or the error row disposition was not set.
throw new Exception("An error occurred, and the DTSRowDisposition is either not set, or is set to fail component.");
}
else
{
/// No, the user specified to ignore the failure so
/// direct the row to the default output.
buffer.DirectRow(defaultOutputID);
}
}
}
}
Public Overrides Sub ProcessInput(ByVal inputID As Integer, ByVal buffer As PipelineBuffer)
Dim input As IDTSInput100 = ComponentMetaData.InputCollection.GetObjectByID(inputID)
Dim defaultOutputID As Integer = -1
Dim errorOutputID As Integer = -1
Dim errorOutputIndex As Integer = -1
GetErrorOutputInfo(errorOutputID, errorOutputIndex)
If errorOutputIndex = 0 Then
defaultOutputID = ComponentMetaData.OutputCollection(1).ID
Else
defaultOutputID = ComponentMetaData.OutputCollection(0).ID
End If
While buffer.NextRow
Try
buffer.DirectRow(defaultOutputID)
Catch
If input.ErrorRowDisposition = DTSRowDisposition.RD_RedirectRow Then
buffer.DirectErrorRow(errorOutputID, 0, errorColumnID)
Else
If input.ErrorRowDisposition = DTSRowDisposition.RD_FailComponent OrElse input.ErrorRowDisposition = DTSRowDisposition.RD_NotUsed Then
Throw New Exception("An error occurred, and the DTSRowDisposition is either not set, or is set to fail component.")
Else
buffer.DirectRow(defaultOutputID)
End If
End If
End Try
End While
End Sub
注解
此方法由具有IDTSOutput100属性设置为true
的对象的IsErrorOut数据流组件使用。 当组件在处理缓冲区行时遇到错误,并在输入、输出或列上指定时 RD_RedirectRow ,由组件调用它。
适用于
DirectErrorRow(Int32, Int32, Int32, Int32)
将行 PipelineBuffer 发送到 IDTSOutput100 其属性为 true 的 IsErrorOut 行。
public:
void DirectErrorRow(int row, int outputID, int errorCode, int errorColumn);
public void DirectErrorRow (int row, int outputID, int errorCode, int errorColumn);
member this.DirectErrorRow : int * int * int * int -> unit
Public Sub DirectErrorRow (row As Integer, outputID As Integer, errorCode As Integer, errorColumn As Integer)
参数
- row
- Int32
要定向到错误输出的行的索引。
- outputID
- Int32
发送 IDTSOutput100 行的错误 PipelineBuffer 的 ID。
- errorCode
- Int32
处理行时发生的错误号。
- errorColumn
- Int32
导致错误的 PipelineBuffer 列的 ID。
注解
如果数据流组件具有 IDTSOutput100 其各自的 IsErrorOut 属性设置为 true
的对象,数据流组件将调用此方法。 组件在处理缓冲区行时遇到错误,并在输入、输出或列上指定时 RD_RedirectRow ,组件调用此方法。