-
ODBC Environment Handle
I have a nice routine (in Windows) to check whether particular ODBC drivers are installed, modified from a post on an MSDN forum (of all places: the one time I actually found something useful there). The purpose is to find out which of the acceptable drivers is there, and if so, use the most preferred one. If not, throw an intelligent error before a call is attempted.
However, the Windows prg uses sys(3053), which is described in the VFP help as:
If ODBC isn't loaded, SYS(3053) loads it and returns the ODBC environment handle.
The environment handle returned by SYS(3053) provides access to ODBC through ODBC API calls. Access to the ODBC API is available in Visual FoxPro through DECLARE - DLL, and through external Visual FoxPro API library routines.
Only one ODBC environment handle should be used at any time. A Visual FoxPro program using ODBC calls should use SYS(3053) to get the ODBC environment handle rather than reallocating and freeing the ODBC environment handle through ODBC API calls.
Exercise care when manipulating an ODBC environment handle. For further information about the ODBC API, see the Microsoft ODBC SDK documentation.
Is there something equivalent in Lianja?
thanks,
Hank
PS: For Linux (which I will do later), it seems that registration is in etc/odbc/ but I will have to explore more what's available in LInux, in particular, whether getting a list of installed ODBC drivers can also be approached programmatically.
-
The best solution would be to provide an operating system independent function to return an array of data sources rather than a windows specific hack using DECLARE DLL that will break on Linux and macOS.
SQLODBCDrivers()
SQLODBCDataSources()
Please Submit an ER.
-
Incidentally this information is all in the windows registry on windows but providing registry functions for this would be windows specific which is not an acceptable solution IMO.
-
Wow, that's fantastic.
ER submitted.