Action Method for LCConnection
This method performs an action as defined by the actionType parameter. Not all available actions may be supported. If you use an unsupported action type, this method will generate the error LCFAIL_UNAVAILABLE.
Defined In
LCConnection
Syntax
Call lcConnection.Action(actionType)
Parameters
Parameter |
Description |
---|---|
actionType |
LCACTION_RESET -- Returns the connector to a state equivalent to that just after connection. All outstanding results are committed and all result sets and state information are freed. Supported by all connectors. |
LCACTION_TRUNCATE -- Deletes all records in the property METADATA in the most efficient available manner as determined by the connector. |
|
LCACTION_COMMIT -- Commits all changes in the current transaction. Only supported by connectors with transaction functionality. |
|
LCACTION_ROLLBACK -- Rolls back all changes in the current transaction. Only supported by connectors with transaction functionality. |
|
LCACTION_CLEAR -- Clears the current result set, freeing any locks, but does not affect any other context. Do not count on the Clear action doing a commit or rollback of your changes. If you have changes outstanding, you should use the Action method to commit or revoke them before you use Clear. |
Example
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
Example Output
The table 'customer' has been truncated. This removed all existing records.