954,529 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Detect MySQL ODBC version

Any ideas on detecting the current version of the MySQL ODBC driver?

Currently I am reading the registry to obtain the version:

Function  MySQLVersion:String;
Var TR : TRegistry;
    SL : TStringList;
    I  : Integer;
  Begin
    Result := 'ODBC 3.51';          // Default version
    SL := TStringList.Create;
    TR := TRegistry.Create;
    TR.RootKey := HKEY_LOCAL_MACHINE;
    If Not(TR.KeyExists('SOFTWARE\\MySQL AB\\'))
      Then Exit;
    If TR.OpenKey('SOFTWARE\MySQL AB\',False)
      Then Begin
             TR.GetKeyNames(SL);
             I := StartsLineIndex(SL,'MySQL Connector');   // Find the index of the line starting with 'MySQL Connector'
             If (I>=0)
               Then Result := RightPart(SL[I],'/');    // Get the right side of the string after '/'
           End;
    SL.Free;
    TR.Free;
  End;


This presents a couple of problems:

1: If one version has been uninstalled and a new version installed then both items are left in the registry.

2: Some computers give me (permission?) problems reading the registry.

Any help would be appreciated.

KenAs
Newbie Poster
4 posts since Aug 2007
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: