Catalog Method for LCConnection

This method returns information about the data sources, metadata objects, stored procedures and fields available through a connection. Some connectors do not support all object types.

The information is returned using the result set of the connection. Any active result set for this connection will be replaced. The format of the result set produced is returned in the supplied fieldlist, and the result set contents can be retrieved with LCConnection.Fetch. For instance, if you catalog Metadata information, each Fetch will return information about one metadata object.

In general, you must connect to the data source (Connect method) before using Catalog. However, some connectors enable you to catalog servers and databases without an active connection.

Use the properties of the LCConnection to provide the context for the information you're looking for. For instance, to catalog databases on a server, you must first set the Server property of the connection, but you don't need to set the Database or Metadata property. The table lists the required context for each type of object you can catalog.

Note: For this method, do not use metadata in the form "owner.tablename" -- instead, assign connection.Owner = "owner" and connection.Metadata = "tablename".

Defined In

LCConnection

Syntax

count =lcConnection.Catalog(objectType, destFieldlist)

Parameters

Parameter

Description

objectType

Long. Type of metadata information to be cataloged. Use an LCOBJECT_XXX constant to define the metadata type. The following list gives the required context and the resulting metadata format for each catalog type. The general fields, Name, Owner, and Comment, are produced for all objects, but only the first output field(name) is guaranteed to have data.

All output fields are data type Text, unless otherwise specified. Field cataloging adds a fourth element, data type.

LCOBJECT_SERVER

Context: None

Output Fields: Server Name, Server Owner, Server Comment

LCOBJECT_DATABASE

Context: SERVER property (if supported by this connector)

Output Fields: Database Name, Database Owner, Database Comment

LCOBJECT_METADATA

Context: Current® connection, ALTERNATE METADATA property

Output Fields: Metadata Name, Metadata Owner, Metadata Comment

LCOBJECT_INDEX

Context: Current® connection

Output Fields: Index Name, Index Owner, Index Comment

LCOBJECT_PROCEDURE

Context: Current® connection

Output Fields: Procedure Name, Procedure Schema, Remarks

LCOBJECT_FIELD

Context: Current® connection, METADATA property, ALTERNATE METADATA property

Output Fields: Field Name, Field Owner, Field Comment, Field Datatype Constant.

The Field Datatype Constant gives the data type of the field using one of the following values:

Note: More detailed information about the field, such as the maximum length of a stream field, can be obtained by using Select on the metadata object.

Value

Constant

Type

0.00

LCTYPE_INVALID

Overview

1.00

LCTYPE_INT

Integer

2.00

LCTYPE_FLOAT

Float

3.00

LCTYPE_CURRENCY

Currency

4.00

LCTYPE_NUMERIC

Numeric

5.00

LCTYPE_DATETIME

Datetime

6.00

LCTYPE_TEXT

Text

7.00

LCTYPE_BINARY

Binary

8.00

LCTYPE_FIELDLIST

Fieldlist

9.00

LCTYPE_CONNECTION

Connection

destFieldlist

LCFieldlist. Output. Fieldlist to contain the metadata of the catalog result set. The fields in the result set will be appended to this fieldlist. If the result set metadata is not required, use Nothing.

Return Value

Value

Description

count

Long. Number of catalog records available in the result set produced. This value is LCCOUNT_UNKNOWN if the number of records cannot be determined by the connector.

Example

Option Public
Uselsx "*lsxlc" 

Sub Initialize
  Dim connect As New LCConnection ("db2") 
 Dim conFldLst As New LCFieldList
  
  ' this section assigns the appropriate properties to connect to DB2
  connect.Database = "Gold"
  connect.Userid = "JDoe"
  connect.Password = "xyzzy"
  connect.Metadata = "customer"

  ' connect to DB2
  connect.Connect

  ' now perform the catalog action -- in this case,
  ' for fields in the 'customer' table.
  If (connect.Catalog (LCOBJECT_FIELD, conFldLst) = 0) Then
    Print "No tables were found (table does not exist)."
  Else
    ' fetch the results 
   Dim nameField As LCField, typeField as LCField
   Set nameField = conFldLst.GetField(1)
   Set typeField = conFldLst.GetField(2)
   Print "The list of columns in the '" & _
              connect.Metadata & "' table include:"
    While (connect.Fetch (conFldLst) > 0)
      Print "     " & field.text(0)
    Wend
  End If
End Sub

Example Output

The list of columns in the 'CUSTOMER' table include:
     ACCOUNTMANAGER
     CONTACTNAME
     COMPANYNAME
     COMPANYADDRESS
     COMPANYCITY
     COMPANYSTATE
     COMPANYPHONE

Catalog Method for LCConnection using Lotus® Connector for DB2®

This method produces a result set containing requested information. The information is determined by the ObjectType parameter. Not all object types are supported.

Parameter

Description

LCOBJECT_SERVER

Is not supported for DB2®.

LCOBJECT_DATABASE

Returns database name, database owner, and a comment.

LCOBJECT_METADATA

Returns metadata name, metadata owner, and a comment.

LCOBJECT_INDEX

Is not supported for DB2®.

LCOBJECT_FIELD

Returns the field name, field owner, a comment, field type * and native data type name.

* This ObjectType returns the input and output parameters of a procedure. A call to LCXCatalog with this ObjectType is in error if a procedure name does not exist.

LCOBJECT_PROCEDURE

Returns the procedure name, and procedure owner (used with stored procedures).

LCOBJECT_PARAMETER

Returns the input and output parameters of a procedure. A call to LCXCatalog with this ObjectType is in error if a procedure name does not exist.