My application requires queries to a MySQL database, so I have to ensure that my customer has a (the right?) version of the MySQL driver on their computer. I've found a method that seems to work, but I feel a little tentative about it. Any suggestions/improvements most welcome and much appreciated:
Quote
:checkMysql
url = "http://tech.plain-english.com/public/mySQLconnector/mysql-connector-odbc-5.1.9-win32.msi"
regpath = "Software\odbc\odbcinst.ini\odbc drivers"
bit64=RegExistKey(@REGmachine, "Software\wow6432Node")
if bit64 then regpath = "Software\wow6432Node\odbc\odbcinst.ini\odbc drivers"
ODBCkeyExists = RegExistKey(@REGmachine, regpath)
if !ODBCKeyExists
message("Cannot find ODBC Key in Registry","Unable to find ODBC settings on this computer. Please contact support.")
Exit
EndIf
items = RegQueryItem(@REGmachine, regpath)
howmany = itemcount(items,@tab)
i = 1
while i <= howmany
driverName = itemextract( i, items, @tab )
bit = itemExtract( 1, driverName, " " )
if bit == "MySQL" then mysqlVersion = itemExtract(3 , driverName, " ")
i = i+1
endWhile
if mySqlVersion == ""
message("MySQL Driver Not Found", "Sorry, we did not detect the MySQL driver on your computer. This will need to be installed before you continue." )
dlNow = askYesNo("Download mySQL Connector","Do you want to download the mySQL ODBC Connector from the Internet now?")
if dlNow
message("About to download...","When you click OK, you'll be prompted to download and save the installation file for the mySQL ODBC Connector.%@crlf%%@crlf%Save it to a convenient location, and then run it to complete the installation.")
ShellExecute(url, "", "", @normal, "")
Endif
Exit
Else
Return
The ODBC Extender contains the function qDriverList. It returns a list of descriptions of the installed drivers.