'Catalog example:
Option Public
Option Declare
Uselsx "*LSXLC"
%INCLUDE "lsconst.lss"
Sub Initialize
Dim session As New LCSession
Dim connect As New LCConnection ("order")
Dim cnt As Long
Dim conFldLst As New LCFieldList (1, LCFIELDF_TRUNC_DATA + LCFIELDF_TRUNC_PREC)
Dim conFld As New LCField (LCTYPE_TEXT, 1)
Dim field As New LCField (LCTYPE_TEXT, 1)
Dim wintitle As String
Dim result As String
Dim mb As Long
On Error Goto ErrorHandler
wintitle = "Catalog Example"
connect.ConnectorName = "db2"
REM this section assigns the appropriate properties to connect to DB2
connect.Database = "somedb"
connect.Userid = "user"
connect.Password = "password"
REM connect to DB2
connect.Connect
REM now perform the catalog action - in this case for metadata
cnt = connect.Catalog(LCOBJECT_METADATA,conFldLst)
If (cnt = 0) Then
mb = MB_IconInformation + MB_OK
Messagebox "No metadata was found.", mb, wintitle
End
Else
REM fetch the results
cnt = connect.Fetch(conFldLst, 1, 1)
End If
REM now get each field and build a list using the variable called result
REM this list can get very large depending on how many tables this DB2 database has
Set field = conFldLst.GetField(1)
result = ""
While ((session.status = LCSUCCESS) And (cnt >0))
result = result + field.text(0) + ","
cnt = connect.Fetch(conFldLst, 1, 1)
Wend
Print "Here is the metadata: " & result, wintitle
End
ErrorHandler:
Dim Msg As String
Dim MsgCode As Long
Dim status As Integer
If session.status <> LCSUCCESS Then
status = session.GetStatus (result, msgcode, msg)
Else
result = "Error " & Err() & ": " & Error()
End If
Messagebox (result), mb, wintitle
End
End Sub
Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | |||