Class: cODBCHandler

Properties  Events  Methods    Index of Classes

Implements functionality specific to ODBC.

Hierarchy

cObject
---Array
------cCLIHandler
---------cODBCHandler

Library: Common (Windows and Web Application) Class Library

Package: odbc_drv.pkg

Description

The cODBCHandler class implements functionality specific to Open Database Connectivity (ODBC).

Enumerating Data Sources

Two methods are available to enumerate data sources. They can be used to present lists of available data sources in utilities. A procedure to show all available data sources with driver identification looks like:

Use ODBC_DRV.pkg

Procedure ShowODBCDataSources Integer iDataSourceType
    Handle hoODBCHandler
    String sDataSourceAndDriver

    Get Create U_cODBCHandler To hoODBCHandler
    If (hoODBCHandler > 0) Begin
        Set DataSourceType Of hooDBCHandler To iDataSourceType
        Repeat
            Get DataSources Of hoODBCHandler To sDataSourceAndDriver
            Showln sDataSourceAndDriver
        Until (sDataSourceAndDriver = "")
        Send Destroy Of hoODBCHandler
    End
End_Procedure // ShowODBCDataSources

Showln "All datasources:"
Send ShowODBCDataSources SQL_FETCH_ALL
Showln
Showln "All USER datasources:"
Send ShowODBCDataSources SQL_FETCH_USER
Showln
Showln "All SYSTEM datasources:"
Send ShowODBCDataSources SQL_FETCH_SYSTEM