LCConnection の Action メソッド

このメソッドは actionType パラメータに定義されたアクションを実行します。サポートされないアクションもあります。サポートされていないアクション型を使用すると、LCFAIL_UNAVAILABLE エラーが生成されます。

定義位置

LCConnection

構文

Call lcConnection.Action(actionType)

パラメータ

パラメータ

説明

actionType

LCACTION_RESET -- Connector をコネクション直後の状態に戻します。未処理の結果はすべてコミットされ、結果セットとステート情報はすべて消去されます。すべての Connector でサポートされます。

 

LCACTION_TRUNCATE -- Connector が決定する最も効率的な方法で、METADATA プロパティのレコードをすべて削除します。

 

LCACTION_COMMIT -- 現在のトランザクションにおける変更内容をすべてコミットします。トランザクション機能のある Connector でのみサポートされます。

 

LCACTION_ROLLBACK -- 現在のトランザクションにおける変更内容をすべてロールバックします。トランザクション機能のある Connector でのみサポートされます。

 

LCACTION_CLEAR -- 現在の結果セットをクリアして、ロックがあればすべて解除します。ただし他のコンテキストには影響しません。変更内容のコミットやロールバックは Clear アクションでは行われません。未処理の変更があれば、Clear の前に Action メソッドを使用してコミットまたは取り消しを実行します。

Option Public
Option Explicit
Uselsx "*lsxlc" 
Sub Initialize
  Dim session As New LCSession
     ' In an LEI Scripted Agent, use the following syntax instead:
     ' Dim session As New LCSession ("mySession")
  Dim src As New LCConnection ("db2")   

  ' set properties to connect to both data sources
  src.Database = "Gold"
  src.Userid = "JDoe"
  src.Password = "xyzzy"
  src.Metadata = "customer"
  ' now connect
  src.Connect

  ' check to see if the target metadata exists, if so clear it out.

  ' check for LCFAIL_INVALID_METADATA error
  On Error LCFAIL_INVALID_METADATA Goto NoMetadata
  Call src.Action (LCACTION_TRUNCATE)
  Print "the table '" & src.Metadata & "' has been truncated."
  Print "This removed all existing records."
  End

NoMetadata: 
  ' couldn't truncate the table since it didn't exist
  Print "the table '" & src.Metadata & "' does not exist."
  End
End Sub

出力例

The table 'customer' has been truncated. This removed all existing records.