This topic has not yet been rated - Rate this topic

ScriptBuffer Class

Serves as the base class for the read-only classes representing the input and the outputs that are generated by the Script component in the BufferWrapper project item in a Script component project.

System.Object
  Microsoft.SqlServer.Dts.Pipeline.ScriptBuffer

Namespace:  Microsoft.SqlServer.Dts.Pipeline
Assembly:  Microsoft.SqlServer.TxScript (in Microsoft.SqlServer.TxScript.dll)
public class ScriptBuffer

The ScriptBuffer type exposes the following members.

  Name Description
Public method ScriptBuffer Initializes a new instance of the ScriptBuffer class.
Top
  Name Description
Protected property Item Gets or sets the value of a column in the buffer by using its index in the array of buffer column indexes.
Top
  Name Description
Protected method AddRow Adds an empty new row to the data flow buffer.
Protected method DirectRow Directs a row to the specified output when a component has more than one available output.
Protected method EndOfRowset Returns a value that indicates whether the end of the rows in a buffer has been reached.
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method GetHashCode (Inherited from Object.)
Public method GetType (Inherited from Object.)
Protected method IsNull Returns a value that indicates whether the value of the specified column is null.
Protected method MemberwiseClone (Inherited from Object.)
Protected method NextRow Tries to move to the next available row in the buffer and returns a value that indicates whether another row was available.
Protected method SetEndOfRowset Indicates to the data flow that no more rows will be added to the output buffer.
Protected method SetNull Makes the value of the specified column null.
Public method ToString (Inherited from Object.)
Top
  Name Description
Protected field Buffer The script buffer.
Protected field BufferColumnIndexes An array of column indexes.
Top

The ScriptBuffer class serves as the base class for the read-only classes representing the input and the outputs that are generated by the Script component in the BufferWrapper project item in a Script component project. The classes in the BufferWrapper project item provide the developer with a set of methods for working with the data flow buffers, as well as typed accessor properties for each column in the buffers.

The Script component developer does not use the ScriptBuffer class directly, but indirectly, through the derived classes in the BufferWrapper project item that represent the component's input and outputs.

For more information, see Coding and Debugging the Script Component and Understanding the Script Component Object Model.

The following code sample from Creating an Asynchronous Transformation with the Script Component demonstrates several methods and properties of the ScriptBuffer class, including AddRow, NextRow, EndOfRowset, and SetEndOfRowset.

Public Class ScriptMain
    Inherits UserComponent

    Private myRedmondAddressCount As Integer

    Public Overrides Sub CreateNewOutputRows()

        MySummaryOutputBuffer.AddRow()

    End Sub

    Public Overrides Sub MyAddressInput_ProcessInput(ByVal Buffer As MyAddressInputBuffer)

        While Buffer.NextRow()
            MyAddressInput_ProcessInputRow(Buffer)
        End While

        If Buffer.EndOfRowset Then
            MyAddressOutputBuffer.SetEndOfRowset()
            MySummaryOutputBuffer.MyRedmondCount = myRedmondAddressCount
            MySummaryOutputBuffer.SetEndOfRowset()
        End If

    End Sub

    Public Overrides Sub MyAddressInput_ProcessInputRow(ByVal Row As MyAddressInputBuffer)

        With MyAddressOutputBuffer
            .AddRow()
            .AddressID = Row.AddressID
            .City = Row.City
        End With

        If Row.City.ToUpper = "REDMOND" Then
            myRedmondAddressCount += 1
        End If

    End Sub

End Class
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)