共用方式為


ScriptBuffer 類別

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

命名空間:  Microsoft.SqlServer.Dts.Pipeline
組件:  Microsoft.SqlServer.TxScript (在 Microsoft.SqlServer.TxScript.dll 中)

語法

'宣告
Public Class ScriptBuffer
'用途
Dim instance As ScriptBuffer
public class ScriptBuffer
public ref class ScriptBuffer
type ScriptBuffer =  class end
public class ScriptBuffer

ScriptBuffer 型別公開下列成員。

建構函式

  名稱 說明
公用方法 ScriptBuffer Initializes a new instance of the ScriptBuffer class.

上層

屬性

  名稱 說明
受保護的屬性 Item Gets or sets the value of a column in the buffer by using its index in the array of buffer column indexes.

上層

方法

  名稱 說明
受保護的方法 AddRow Adds an empty new row to the data flow buffer.
受保護的方法 DirectRow Directs a row to the specified output when a component has more than one available output.
受保護的方法 EndOfRowset Returns a value that indicates whether the end of the rows in a buffer has been reached.
公用方法 Equals (繼承自 Object。)
受保護的方法 Finalize (繼承自 Object。)
公用方法 GetHashCode (繼承自 Object。)
公用方法 GetType (繼承自 Object。)
受保護的方法 IsNull Returns a value that indicates whether the value of the specified column is nullNothingnullptrunitnull 參考 (在 Visual Basic 中為 Nothing).
受保護的方法 MemberwiseClone (繼承自 Object。)
受保護的方法 NextRow Tries to move to the next available row in the buffer and returns a value that indicates whether another row was available.
受保護的方法 SetEndOfRowset Indicates to the data flow that no more rows will be added to the output buffer.
受保護的方法 SetNull Makes the value of the specified column nullNothingnullptrunitnull 參考 (在 Visual Basic 中為 Nothing).
公用方法 ToString (繼承自 Object。)

上層

欄位

  名稱 說明
受保護的欄位 Buffer
受保護的欄位 BufferColumnIndexes An array of column indexes.

上層

備註

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 指令碼元件的程式碼撰寫和偵錯 and 了解指令碼元件物件模型.

範例

The following code sample from 使用指令碼元件建立非同步轉換 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

執行緒安全性

這個型別的任何公用 static (在 Visual Basic 中為 Shared) 成員都是執行緒安全的。並不是所有的執行個體成員都保證可以用於所有的執行緒。