Drop Method for LCConnection
This method deletes (drops) a specified metadata object -- database, table, index, or view. The object isn't just removed from your local memory; it's irretrievably destroyed. Use this method with caution.
Each connector supports only certain object types. For example, for DB2®, this method drops a DB2® object and only LCOBJECT_METADATA and LCOBJECT_INDEX are supported.
Defined In
LCConnection
Syntax
Call lcConnection.Drop(objectType)
Parameters
Parameter |
Description |
---|---|
objectType |
Long. Type of object: Valid types and associated behavior are the following (refer to Appendix C for the specific connector to determine which of the following are supported): |
LCOBJECT_SERVER Drops a server object (obtaining the name from the SERVER property). |
|
LCOBJECT_DATABASE Drops a database object (obtaining the name from the DATABASE property, and optionally the server name from the SERVER property). |
|
LCOBJECT_METADATA Drops a metadata object (obtaining the name from the METADATA property). |
|
LCOBJECT_INDEX Drops an index object (the metadata indexed is in METADATA property, the index name to drop is in INDEX property). |
|
LCOBJECT_FIELD Drops a field object (metadata containing fields is in METADATA property, the fields being removed are in the FieldNames property). |
Example
Option Public
Option Explicit
Uselsx "*lsxlc"
Sub Initialize
Dim src As New LCConnection ("db2")
' set properties to connect to the data source
src.Database = "Gold"
src.Userid = "JDoe"
src.Password = "xyzzy"
src.Metadata = "customer"
src.Connect
On Error Goto NoMetadata
Call src.Drop (LCOBJECT_METADATA)
Print "The '" & src.Metadata & "' table existed and had been deleted."
End
NoMetadata:
Print "The '" & src.Metadata & "' table did not exist."
End
End Sub
Example Output
The 'customer' table existed and had been deleted.