Special Facilities
- Last UpdatedJan 24, 2023
- 2 minute read
Query includes some general enquiry facilities for DSN's and ODBC driver names and provides access to them using the same method used for tables of an ODBC data source. The DSN to use to access this information is AdminSpecial and the table names are DSN and Drivers. They make it possible for a User Interface designer to create a selection of available DSN's from which to make a connection. Here are the main Query commands for AdminSpecial and the only supported SQL commands:
external open |synonym| !!TOK as |DSN=AdminSpecial;|
external send $!!TOK |select * from DSN|
external send $!!TOK |select * from Drivers|
external close $!TOK
The external open command requires a valid synonym for ODBC.
Here is an example of a macro to read all of the available DSN’s into a list gadget.
Example:
$* clear the User interface gadgets
var _PARA1 ||
$* clear the user interface gadgets
var _PARA1 ||
var list _TABLE1 clear
exit
$* connect to the AdminSpecial DSN
external open |ODBC| !TOK as |DSN=AdminSpecial;|
handle any
error |$!!ERROR.TEXT|
endhandle
$* select all of the records from the DSN table
external send $!TOK |select * from DSN|
handle any
error |$!!ERROR.TEXT|
endhandle
$* fetch the first column header to the paragraph gadget
var !HEAD delete
var !HEAD external get $!TOK HEADER
handle any
error |$!!ERROR.TEXT|
endhandle
var _PARA1 (trim(vtext(!HEAD[1])))
do
var !INFO delete
var !INFO external get $!TOK NEXT
handle ( 79, 10 )
break $* end of data
endhandle
var list _TABLE1 add (trim(vtext(!INFO[1])))
exit
enddo
$* close the connection
external close $!TOK
handle any
error |$!!ERROR.TEXT|
endhandle
return
Note:
It is important to remember that these facilities are not based on the system ODBC
libraries and that the commands that are shown are the only ones that are supported.