Please enable JavaScript to view this site.

A-Shell Consolidated Reference

Navigation: ASQL > Opcodes and Operations

SQLOP_DATA_SOURCES

Scroll Prev Top Next More

xcall SQL, SQLOP_DATA_SOURCES, cmdhdr, dsname, dsdescr

(ODBC only.) Retrieves one data source name and description at a time, according to the opflags options.

Parameters

cmdhdr (ST_SQL_CMDHDR), [in/out]

The fields of interest to this opcode in the cmdhdr structure (defined in SQL.DEF) are listed below.

Field

Dir

Notes

handle

in

handle to connection (returned from SQLOP_INIT_CONN)

dbmsconid

in

DBMS Connector ID

opflags

in

determines how next data source selected; see SQL_FETCH_xxx flags below

cmdarg1,2

n/a

 

rc

out

return code (0 = ok, see SQLERR_xxx)

rcext

out

extended error code; SQL_NO_DATA (100) indicates no more data sources to return

info1,2

n/a

 

sqlstate

out

ANSI standard SQL state code

reshdl

n/a

 

psthdl

n/a

 

 

opflags Symbol

Value

Notes

SQL_FETCH_NEXT

1

Fetch the next data source.

SQL_FETCH_FIRST

2

Fetch the first data source.

SQL_FETCH_FIRST_USER

31

Fetch the first user data source

SQL_FETCH_FIRST_SYSTEM

32

Fetch the first system data source

 

dsname [string, out]

Returns the name of the data source.

dsdescr [string, out]

Returns the description of the data source.

Notes

When the opflags field is set to SQL_FETCH_FIRST, it fetches the first data source of either type, and subsequent calls using SQL_FETCH_NEXT will fetch the next data source of either type. To limit the scan to either user or system data sources, start with SQL_FETCH_FIRST_USER or SQL_FETCH_FIRST_SYSTEM; subsequent calls using SQL_FETCH_NEXT will then return only the specified type.

When there are no more data sources to return, the rc field will be set to 0 and rcext will be set to 100 (SQL_NO_DATA). Subsequent calls using SQL_FETCH_NEXT may (or may not, depending on the driver manager) loop back to the beginning.

The SQLCON.SBX routine (which implements a generic database connection dialog) uses SQLOP_DATA_SOURCES to provide a list of available sources for the user to select from.