DBDATASOURCES Function

Returns a list of data sources as a dbcursor. DBDATASOURCES is a global function.

Category: Database

Syntax

dbdatasources(<>)

Without Arguments

Returns a list a data sources as a dbcursor. The data source includes:

NAME

a string containing the name of the data source

DESCRIPTION

a string containing the driver (shown in the ODBC Administrator and DataFlux Connection Administrator)

Type

an integer containing the subsystem type of the connection [1+ ODBC; 2 = DataFlux TKTS]

HAS_CREDENTIALS

a Boolean representing if save connection exists

USER_DESCRIPTION

a string containing the user-defined description of the data source (defined in the ODBC Administrator and DataFlux Connection Administrator)

Example

// list all data sources

// In order for this to work, please ensure that

// GENERATE_ROWS is set to true in advanced properties.

string dbname

string dbtype

hidden integer i

 

dbcursor db_curs

db_curs = dbdatasources() // retrieve list of data sources

while db_curs.next() // loop through results

begin

     dbname = db_curs.valuestring(0)

     dbtype = db_curs.valuestring(1)

     pushrow() // add row to output

end

db_curs.release() // release cursor

seteof(true) // since GENERATE_ROWS is specified, this avoids infinite loop

return false // avoids duplicate row at end, since pushrow() is used