(9)“脚本组件”
“脚本组件”是为了处理比较复杂的业务流程,比如本方案有一个字段是要自增的,所以要编写脚本
设置输入列
设计脚本: ScriptMain:
' Microsoft SQL Server Integration Services user script component
' This is your new script component in Microsoft Visual Basic .NET
' ScriptMain is the entrypoint> Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
Public> Inherits UserComponent
Dim intCounter As Integer = 1 'Set intial value here
Public Overrides Sub 输入0_ProcessInputRow(ByVal Row As 输入0Buffer)
Row.Taxis = intCounter
intCounter = intCounter + 1 ' Set the incremental value here
End Sub
End> BufferWrapper
' THIS IS AUTO-GENERATED CODE THAT WILL BE OVERWRITTEN! DO NOT EDIT!
' Microsoft SQL Server Integration Services buffer wrappers
' This module defines> ' THIS IS AUTO-GENERATED CODE THAT WILL BE OVERWRITTEN! DO NOT EDIT!
Imports System
Imports System.Data
Imports Microsoft.SqlServer.Dts.Pipeline
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Public> Inherits ScriptBuffer
Public Sub New(ByVal Buffer As PipelineBuffer, ByVal BufferColumnIndexes As Integer())
MyBase.New(Buffer, BufferColumnIndexes)
End Sub
Public Property [Taxis]() As Int32
Get
Return CType(Me(0), Int32)
End Get
Set
Me(0) = Value
End Set
End Property
Public Property [Taxis_IsNull] As Boolean
Get
Return IsNull(0)
End Get
Set
SetNull(0)
End Set
End Property
Public Function NextRow() As Boolean
NextRow = MyBase.NextRow()
End Function
Public Function EndOfRowset() As Boolean
EndOfRowset = MyBase.EndOfRowset
End Function
End> ComponentWrapper
' THIS IS AUTO-GENERATED CODE THAT WILL BE OVERWRITTEN! DO NOT EDIT!
' Microsoft SQL Server Integration Services component wrapper
' This module defines the base> ' THIS IS AUTO-GENERATED CODE THAT WILL BE OVERWRITTEN! DO NOT EDIT!
Imports System
Imports System.Data
Imports Microsoft.SqlServer.Dts.Pipeline
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
Public> Inherits ScriptComponent
Public Connections As New Connections(Me)
Public Variables As New Variables(Me)
Public Overrides Sub ProcessInput(ByVal InputID As Integer, ByVal Buffer As PipelineBuffer)
If InputID = 1572 Then
输入0_ProcessInput(New 输入0Buffer(Buffer, GetColumnIndexes(InputID)))
End If
End Sub
Public Overridable Sub 输入0_ProcessInput(ByVal Buffer As 输入0Buffer)
While Buffer.NextRow()
输入0_ProcessInputRow(Buffer)
End While
End Sub
Public Overridable Sub 输入0_ProcessInputRow(ByVal Row As 输入0Buffer)
End Sub
End>
Public> Dim ParentComponent As ScriptComponent
Public Sub New(ByVal Component As ScriptComponent)
ParentComponent = Component
End Sub
End>
Public> Dim ParentComponent As ScriptComponent
Public Sub New(ByVal Component As ScriptComponent)
ParentComponent = Component
End Sub