Again, move code for loading libmysql.dll - the right place is now the connection object itself, which loads the library on demand, in SetActive(). This enables the application to start independently of an existent library, raising an error when pressing the connect button. Also, this is a first step towards multi-dbms.

This commit is contained in:
Ansgar Becker
2011-02-17 00:26:53 +00:00
parent de7ba86e23
commit b50659135c
10 changed files with 479 additions and 799 deletions

View File

@ -33,7 +33,6 @@ uses
uVistaFuncs in '..\..\source\uVistaFuncs.pas',
routine_editor in '..\..\source\routine_editor.pas' {frmRoutineEditor},
table_editor in '..\..\source\table_editor.pas' {frmTableEditor},
mysql_api in '..\..\source\mysql_api.pas',
mysql_connection in '..\..\source\mysql_connection.pas',
trigger_editor in '..\..\source\trigger_editor.pas' {frmTriggerEditor: TFrame},
searchreplace in '..\..\source\searchreplace.pas' {frmSearchReplace},
@ -48,27 +47,12 @@ uses
var
DoStop, prefAllowMultipleInstances: Boolean;
Err: String;
begin
prefAllowMultipleInstances := GetRegValue(REGNAME_MULTI_INSTANCES, DEFAULT_MULTI_INSTANCES);
SecondInstMsgId := RegisterWindowMessage(APPNAME);
DoStop := False;
if not prefAllowMultipleInstances then
DoStop := CheckForSecondInstance;
if not DoStop then begin
case libmysql_status of
LIBMYSQL_MISSING: Err := 'Can''t find a usable libmysql.dll. Please launch '+ExtractFileName(ParamStr(0))+' from the directory where you have installed it.';
LIBMYSQL_INCOMPATIBLE: Err := 'Your libmysql.dll is out-dated or somehow incompatible to '+APPNAME+'. Please use the one from the installer, or just reinstall '+APPNAME+'.';
else Err := '';
end;
if Err <> '' then begin
MessageDlg(Err, mtError, [mbOK], 0);
DoStop := True;
end;
end;
if DoStop then
Application.Terminate
else begin