Obtaining information about a driver and data source
These functions give information about a driver and data source:
-
SQLDataSources
This returns the data source name and description for each data source in the system information.
odbc SQLDataSources $henv SQL_FETCH_NEXT ServerName \ 128 NameLength1Ptr Description 128 NameLength2Ptr
-
SQLDrivers
This returns the description and a list of attributes (keyword/value pairs) for a driver in the installed odbcinst file.
odbc SQLDrivers $henv SQL_FETCH_NEXT DriverDescription \ 128 DescriptionLengthPtr DriverAttributes 128 \ AttributesLengthPtr
-
SQLGetInfo
This returns an item of information regarding the driver or data source that is associated with a connection handle. There are several values which can be specified forfInfoType;
SQL_SEARCH_PATTERN_ESCAPE
is an example.odbc SQLGetInfo $hdbc SQL_SEARCH_PATTERN_ESCAPE \ InfoValuePtr 255 StringLengthPtr
-
SQLGetFunctions
This reports whether a driver supports a particular ODBC function. The SupportedPtr Tcl variable is set to TRUE or FALSE upon function return. Capitalize the function name and precede it with SQL_API_.
Alternatively, use SQL_API_ALL_FUNCTIONS to get a report for all functions. In this case, the SupportedPtr Tcl variable is set to a list in which each list item is a sublist. This lists consists of the SQL_API_ string for a particular value followed by TRUE or FALSE.
"{SQL_API_SQLALLOCCONNECT TRUE} \ {SQL_API_SQLALLOCENV TRUE} ... \ {SQL_API_SQLBINDPARAMETER TRUE}" odbc SQLGetFunctions $hdbc SQL_API_SQLGETFUNCTIONS \ SupportedPtr odbc SQLGetFunctions $hdbc SQL_API_ALL_FUNCTIONS \ SupportedPt
-
SQLGetTypeInfo
This returns information about a given data source’s support for a given data type. This is the first function which returns its results as a "result set". This is opposed to setting the values of Tcl variables specified as function arguments.
Allocate a statement handle with SQLAllocHandle (see "Preparing SQL requests" in this topic), as result sets are associated with a particular statement handle. The procedures for retrieving results are described in "Submitting requests" in this topic.
If the data type is not supported, then the SQLGetTypeInfo invocation succeeds, but the returned result set is empty.
odbc SQLGetTypeInfo $hstmt SQL_INTEGER odbc SQLGetTypeInfo $hstmt SQL_FLOAT