' This code was generated by a tool.
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
'
'------------------------------------------------------------------------------
Option Strict Off
Option Explicit On
Partial Friend NotInheritable Class MySettings
Inherits System.Configuration.ApplicationSettingsBase
Private Shared m_Value As MySettings
Private Shared m_SyncObject As Object = New Object
_
Public Shared ReadOnly Property Value() As MySettings
Get
If (MySettings.m_Value Is Nothing) Then
System.Threading.Monitor.Enter(MySettings.m_SyncObject)
If (MySettings.m_Value Is Nothing) Then
Try
MySettings.m_Value = New MySettings
Finally
System.Threading.Monitor.Exit(MySettings.m_SyncObject)
End Try
End If
End If
Return MySettings.m_Value
End Get
End Property
End Class
]]>
'The following GUID is for the ID of the typelib if this project is exposed to COM
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
'
]]>]]> _
Public Class InputBuffer
Inherits ScriptBufferPlus
Public Sub New(ByVal Component As ScriptComponent, ByVal ObjectID As Integer, ByVal IsInput As Boolean, ByVal Buffer As PipelineBuffer)
MyBase.New(Component, ObjectID, IsInput, Buffer)
End Sub
Public Overrides ReadOnly Property StaticInputColumns() As String()
Get
Return New String() {}
End Get
End Property
Public Overrides ReadOnly Property StaticOutputColumns() As String()
Get
Return New String() {}
End Get
End Property
Public Overloads Function NextRow() As Boolean
NextRow = MyBase.NextRow()
End Function
Public Overloads Function EndOfRowset() As Boolean
EndOfRowset = MyBase.EndOfRowset
End Function
End Class
_
Public Class OutputBuffer
Inherits ScriptBufferPlus
Public Sub New(ByVal Component As ScriptComponent, ByVal ObjectID As Integer, ByVal IsInput As Boolean, ByVal Buffer As PipelineBuffer)
MyBase.New(Component, ObjectID, IsInput, Buffer)
End Sub
Public Overrides ReadOnly Property StaticInputColumns() As String()
Get
Return New String() {}
End Get
End Property
Public WriteOnly Property [b]() As String
Set
Me(0) = Value
End Set
End Property
Public WriteOnly Property [b_IsNull] As Boolean
Set
If (value)
SetNull(0)
Else
Throw new InvalidOperationException("IsNull property cannot be set to False. Assign a value to the column instead.")
End If
End Set
End Property
Public WriteOnly Property [c]() As String
Set
Me(1) = Value
End Set
End Property
Public WriteOnly Property [c_IsNull] As Boolean
Set
If (value)
SetNull(1)
Else
Throw new InvalidOperationException("IsNull property cannot be set to False. Assign a value to the column instead.")
End If
End Set
End Property
Public Overrides ReadOnly Property StaticOutputColumns() As String()
Get
Return New String() {"b", "c"}
End Get
End Property
Public Overloads Sub AddRow()
MyBase.AddRow()
End Sub
Public Overloads Sub SetEndOfRowset()
MyBase.SetEndOfRowset()
End Sub
Public Overloads Function EndOfRowset() As Boolean
EndOfRowset = MyBase.EndOfRowset
End Function
End Class
]]>
' This code was generated by a tool.
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
'
'------------------------------------------------------------------------------
Option Strict Off
Option Explicit On
Namespace My.Resources
'''
''' A strongly-typed resource class, for looking up localized strings, etc.
'''
'This class was auto-generated by the Strongly Typed Resource Builder
'class via a tool like ResGen or Visual Studio.NET.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
Class MyResources
Private Shared _resMgr As System.Resources.ResourceManager
Private Shared _resCulture As System.Globalization.CultureInfo
Friend Sub New()
MyBase.New
End Sub
'''
''' Returns the cached ResourceManager instance used by this class.
''' _
Public Shared ReadOnly Property ResourceManager() As System.Resources.ResourceManager
Get
If (_resMgr Is Nothing) Then
Dim temp As System.Resources.ResourceManager = New System.Resources.ResourceManager("My.Resources.MyResources", GetType(MyResources).Assembly)
_resMgr = temp
End If
Return _resMgr
End Get
End Property
'''
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
''' _
Public Shared Property Culture() As System.Globalization.CultureInfo
Get
Return _resCulture
End Get
Set
_resCulture = value
End Set
End Property
End Class
End Namespace
]]> _
Public Class UserComponent
Inherits ScriptComponentPlus
Public Connections As New Connections(Me)
Public Variables As New Variables(Me)
Public OutputBuffer As OutputBuffer
Dim InputsFinished As Integer = 0
Public Overrides Sub ProcessInput(ByVal InputID As Integer, ByVal Buffer As PipelineBuffer)
If InputID = MyBase.ComponentMetaData.InputCollection("Input").ID Then
Input_ProcessInput(New InputBuffer(Me, InputID, True, Buffer))
End If
If Buffer.EndOfRowset Then
InputsFinished = InputsFinished + 1
If InputsFinished = 1 Then
FinishOutputs()
MarkOutputsFinished()
End If
End If
End Sub
Public Overridable Sub FinishOutputs()
End Sub
Private Sub MarkOutputsFinished()
If OutputBuffer IsNot Nothing Then
OutputBuffer.SetEndOfRowset
OutputBuffer = Nothing
End If
End Sub
Public Overrides Sub PrimeOutput(ByVal Outputs As Integer, ByVal OutputIDs() As Integer, ByVal Buffers() As PipelineBuffer)
For I As Integer = 0 To Outputs - 1
If OutputIDs(I) = MyBase.ComponentMetaData.OutputCollection("Output").ID Then
OutputBuffer = New OutputBuffer(Me, OutputIDs(I), False, Buffers(I))
End If
Next
CreateNewOutputRows()
End Sub
Public Overridable Sub CreateNewOutputRows()
End Sub
Public Overridable Sub Input_ProcessInput(ByVal Buffer As InputBuffer)
While Buffer.NextRow()
Input_ProcessInputRow(Buffer)
End While
End Sub
Public Overridable Sub Input_ProcessInputRow(ByVal Row As InputBuffer)
End Sub
End Class
Public Class Connections
Dim ParentComponent As ScriptComponent
_
Public Sub New(ByVal Component As ScriptComponent)
ParentComponent = Component
End Sub
End Class
Public Class Variables
Dim ParentComponent As ScriptComponent
_
Public Sub New(ByVal Component As ScriptComponent)
ParentComponent = Component
End Sub
End Class
]]>text/microsoft-resx2.0System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]>{A860303F-1F3F-4691-B57E-529FC101A107};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}DebugAnyCPULibraryScriptComponent_c7fc06ec606b496aa49f24f2f2072fe8.vbprojScriptComponent_c7fc06ec606b496aa49f24f2f2072fe8.vbprojOnBinaryOffOn{104EDA23-1592-4D6B-8258-BC65F871B4C7}truetruetruefalsebin\falsefalse42016,42017,42018,42019,42032falsetruefalsetruebin\falsefalse42016,42017,42018,42019,42032CodeVbMyResourcesResXFileCodeGeneratorResources.Designer.vbMy.ResourcesTrueTrueResources.resxCodeSettingsSingleFileGeneratorSettings.Designer.vbTrueSettings.settingsCodeSSIS_ScriptComponent
]]> _
_
_
_
_
Public Class ScriptMain
Inherits UserComponent
Private Const ColumnSeparator As String = "," + vbLf
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Overrides Sub Input_ProcessInputRow(ByVal Row As InputBuffer)
Dim colsCount As Integer = m_inputIdx.Length
Call Me.OutputBuffer.AddRow()
For colIndex As Integer = 0 To colsCount - 1
Dim inIndex As Integer = m_inputIdx(colIndex)
Dim outIndex As Integer = m_outputIdx(colIndex)
If Row.Buffer.IsNull(inIndex) Then
Continue For
End If
' Get input value.
Dim inValue As Object = Row.Buffer(inIndex)
If TypeOf inValue Is BlobColumn Then
' Translate into more useful object.
Dim blob As BlobColumn = CType(inValue, BlobColumn)
Select Case blob.ColumnInfo.DataType
Case DataType.DT_TEXT, DataType.DT_NTEXT
inValue = Row.Buffer.GetString(inIndex)
Case Else
inValue = blob.GetBlobData(0, CInt(blob.Length))
End Select
End If
' Set output value.
Dim outValue As Object = inValue
Select Case m_outputType(colIndex)
Case DataType.DT_DATE, DataType.DT_FILETIME, DataType.DT_DBDATE, DataType.DT_DBTIMESTAMP
outValue = Convert.ToDateTime(outValue)
Case DataType.DT_GUID
outValue = New Guid(outValue.ToString())
Case DataType.DT_STR, DataType.DT_WSTR, DataType.DT_TEXT, DataType.DT_NTEXT
If TypeOf outValue Is Byte() Then
' Encode as base64 value.
outValue = Convert.ToBase64String(CType(outValue, Byte()))
Else
outValue = outValue.ToString()
End If
Case DataType.DT_IMAGE
If TypeOf outValue Is String Then
' Assume input is base64 value.
outValue = Convert.FromBase64String(CStr(outValue))
End If
End Select
Me.OutputBuffer.Buffer(outIndex) = outValue
Next
End Sub ' Input_ProcessInputRow
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Overrides Sub PreExecute()
Call MyBase.PreExecute()
Dim input As IDTSInput100 = Me.ComponentMetaData.InputCollection(0)
Dim output As IDTSOutput100 = Me.ComponentMetaData.OutputCollection(0)
' Setup dynamic input columns indexes.
Dim colsCount As Integer = input.InputColumnCollection.Count
m_inputIdx = New Integer(colsCount - 1) {}
m_outputIdx = New Integer(colsCount - 1) {}
m_outputType = New DataType(colsCount - 1) {}
For colIndex As Integer = 0 To colsCount - 1
Dim inColumn As IDTSInputColumn100 = input.InputColumnCollection(colIndex)
m_inputIdx(colIndex) = Me.HostComponent.BufferManager.FindColumnByLineageID( _
input.Buffer, _
inColumn.LineageID)
Dim outColumn As IDTSOutputColumn100 = output.OutputColumnCollection(inColumn.Name)
Try
m_outputIdx(colIndex) = -1
m_outputIdx(colIndex) = Me.HostComponent.BufferManager.FindColumnByLineageID( _
output.Buffer, _
outColumn.LineageID)
Catch ex As Exception
' Under SQL 2008 if column is not used in the pipeline,
' it doesn't exist in the buffer.
End Try
m_outputType(colIndex) = outColumn.DataType
Next
End Sub ' PreExecute
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Function Validate(ByRef errMessage As String) As Boolean
Dim result As Boolean
Try
Dim input As IDTSInput100 = Me.ComponentMetaData.InputCollection(0)
Dim output As IDTSOutput100 = Me.ComponentMetaData.OutputCollection(0)
If input.InputColumnCollection.Count = 0 OrElse Me.Columns <> m_prevCols Then
Dim selectedCols() As String = CStr(Me.Columns).Split( _
New String() {ColumnSeparator}, _
StringSplitOptions.RemoveEmptyEntries)
' Remove output columns, which are no longer in use.
Dim colsCount As Integer = output.OutputColumnCollection.Count
For colIndex As Integer = colsCount - 1 To 0 Step -1
Dim outColumn As IDTSOutputColumn100 = output.OutputColumnCollection(colIndex)
If Not IsFound_(selectedCols, outColumn.Name) Then
Call output.OutputColumnCollection.RemoveObjectByID(outColumn.ID)
End If
Next
' Setup input columns based on selection.
Call input.InputColumnCollection.RemoveAll()
Dim virtInput As IDTSVirtualInput100 = input.GetVirtualInput()
For Each col As String In selectedCols
Dim virtColumn As IDTSVirtualInputColumn100 = virtInput.VirtualInputColumnCollection(col)
Call virtInput.SetUsageType(virtColumn.LineageID, DTSUsageType.UT_READONLY)
Dim outColumn As IDTSOutputColumn100
Try
outColumn = output.OutputColumnCollection(col)
Catch ex As Exception
' New column.
outColumn = output.OutputColumnCollection.[New]()
outColumn.Name = col
End Try
Next
End If
Dim codePage As Integer = 0
If m_culture <> 0 Then
Dim ci As CultureInfo = New CultureInfo(m_culture)
codePage = ci.TextInfo.ANSICodePage
End If
' Update output columns with specified type.
For Each outColumn As IDTSOutputColumn100 In output.OutputColumnCollection
Call outColumn.SetDataTypeProperties( _
Me.Type, _
Me.Length, _
Me.Precision, _
Me.Scale, _
codePage)
Next
result = True
Catch ex As Exception
result = False
errMessage = ex.ToString()
End Try
Validate = result
End Function 'Validate
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Returns list of current properties based on current state.
Public Function GetProperties() As String()
Dim result As New ArrayList
' Setup static.
Call result.Add("Columns")
Call result.Add("Type")
' Setup dynamic.
Select Case Me.Type
Case DataType.DT_DECIMAL
Call result.Add("Scale")
Case DataType.DT_STR
Call result.Add("Length")
Call result.Add("CodePage")
Case DataType.DT_WSTR
Call result.Add("Length")
Case DataType.DT_NUMERIC
Call result.Add("Precision")
Call result.Add("Scale")
Case DataType.DT_TEXT
Call result.Add("CodePage")
End Select
Return CType(result.ToArray(GetType(String)), String())
End Function ' GetProperties
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Function GetCultures() As Object()
Dim result As New ArrayList()
Dim cultures() As CultureInfo = CultureInfo.GetCultures(CultureTypes.AllCultures)
For Each ci As CultureInfo In cultures
Call result.Add(ci.DisplayName)
Next
GetCultures = result.ToArray()
End Function ' GetCultures
#Region "Properties"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
_
_
_
Public Property Columns() As String
Get
Columns = m_inputCols
End Get
Set(ByVal value As String)
Dim input As IDTSInput100 = MyBase.ComponentMetaData.InputCollection(0)
If input.IsAttached Then
If String.IsNullOrEmpty(value) Then
' Setup based on input columns collection.
value = GetInputCols_()
End If
Else
' Reset when no input is attached.
value = String.Empty
End If
If String.IsNullOrEmpty(m_prevCols) Then
m_prevCols = value
End If
m_inputCols = value
End Set
End Property ' Columns
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
_
_
_
Public Property Type() As DataType
Get
Type = m_type
End Get
Set(ByVal value As DataType)
If m_type <> value Then
m_type = value
m_length = 0
m_precision = 0
m_scale = 0
m_culture = 0
End If
End Set
End Property ' Type
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
_
_
Public Property Length() As Integer
Get
Length = m_length
End Get
Set(ByVal value As Integer)
m_length = value
End Set
End Property ' Length
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
_
_
Public Property Precision() As Integer
Get
Precision = m_precision
End Get
Set(ByVal value As Integer)
m_precision = value
End Set
End Property ' Precision
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
_
_
Public Property Scale() As Integer
Get
Scale = m_scale
End Get
Set(ByVal value As Integer)
m_scale = value
End Set
End Property ' Scale
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
_
_
_
Public Property CodePage() As String
Get
Dim result As String = String.Empty
If m_culture <> 0 Then
result = New CultureInfo(m_culture).DisplayName
End If
CodePage = result
End Get
Set(ByVal value As String)
m_culture = FindCultureByDisplay_(value)
End Set
End Property ' CodePage
#End Region ' Properties
#Region "Internals"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function GetInputCols_() As String
Dim result As String = String.Empty
Dim input As IDTSInput100 = MyBase.ComponentMetaData.InputCollection(0)
For Each column As IDTSInputColumn100 In input.InputColumnCollection
If Not String.IsNullOrEmpty(result) Then
result += ColumnSeparator
End If
result += column.Name
Next
GetInputCols_ = result
End Function ' GetInputCols_
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function IsFound_(ByVal list() As String, ByVal search As String) As Boolean
Dim result As Boolean = False
For Each item As String In list
If item.Equals(search, StringComparison.OrdinalIgnoreCase) Then
' Found.
result = True
Exit For
End If
Next
IsFound_ = result
End Function ' IsFound_
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function FindCultureByDisplay_(ByVal display As String) As Integer
Dim result As Integer = 0
Dim cultures() As CultureInfo = CultureInfo.GetCultures(CultureTypes.AllCultures)
For Each ci As CultureInfo In cultures
If ci.DisplayName = display Then
' Found.
result = ci.LCID
Exit For
End If
Next
FindCultureByDisplay_ = result
End Function ' FindCultureByDisplay_
#End Region ' Internals
#Region "Attributes"
Private m_inputCols As String = String.Empty
Private m_prevCols As String = String.Empty
Private m_type As DataType = DataType.DT_BYREF_I4
Private m_length As Integer = 50
Private m_precision As Integer
Private m_scale As Integer
Private m_culture As Integer
Private m_inputIdx() As Integer
Private m_outputIdx() As Integer
Private m_outputType() As DataType
#End Region ' Attributes
End Class ' ScriptMain
]]>CozyRoc.SqlServer.SSIS.ScriptComponentHostPlus, CozyRoc.SSISPlus.2008, Version=1.0.0.0, Culture=neutral, PublicKeyToken=16cf490bb80c34eaScriptComponent_c7fc06ec606b496aa49f24f2f2072fe8VisualBasic