* Removed tracking of the status of InitialiseMySQL, since InitialiseMySQL handles this itself using a refcount

git-svn-id: trunk@8646 -
This commit is contained in:
joost 2007-09-25 22:59:58 +00:00
parent 55e680469f
commit f182b6698b

View File

@ -78,7 +78,6 @@ Type
FHostInfo: String; FHostInfo: String;
FServerInfo: String; FServerInfo: String;
FMySQL : PMySQL; FMySQL : PMySQL;
FDidConnect : Boolean;
function GetClientInfo: string; function GetClientInfo: string;
function GetServerStatus: String; function GetServerStatus: String;
procedure ConnectMySQL(var HMySQL : PMySQL;H,U,P : pchar); procedure ConnectMySQL(var HMySQL : PMySQL;H,U,P : pchar);
@ -190,19 +189,13 @@ end;
function TConnectionName.GetClientInfo: string; function TConnectionName.GetClientInfo: string;
Var
B : Boolean;
begin begin
// To make it possible to call this if there's no connection yet // To make it possible to call this if there's no connection yet
B:=(MysqlLibraryHandle=Nilhandle); InitialiseMysql;
If B then
InitialiseMysql;
Try Try
Result:=strpas(mysql_get_client_info()); Result:=strpas(mysql_get_client_info());
Finally Finally
if B then ReleaseMysql;
ReleaseMysql;
end; end;
end; end;
@ -293,16 +286,13 @@ end;
procedure TConnectionName.ExecuteDirectMySQL(const query : string); procedure TConnectionName.ExecuteDirectMySQL(const query : string);
var ADidConnect : boolean; var H,U,P : String;
H,U,P : String;
AMySQL : PMySQL; AMySQL : PMySQL;
begin begin
CheckDisConnected; CheckDisConnected;
ADidConnect:=(MySQLLibraryHandle=NilHandle); InitialiseMysql;
if ADidConnect then
InitialiseMysql;
H:=HostName; H:=HostName;
U:=UserName; U:=UserName;
@ -315,15 +305,12 @@ begin
mysql_close(AMySQL); mysql_close(AMySQL);
if ADidConnect then ReleaseMysql;
ReleaseMysql;
end; end;
procedure TConnectionName.DoInternalConnect; procedure TConnectionName.DoInternalConnect;
begin begin
FDidConnect:=(MySQLLibraryHandle=NilHandle); InitialiseMysql;
if FDidConnect then
InitialiseMysql;
{$IFDEF mysql50} {$IFDEF mysql50}
if copy(strpas(mysql_get_client_info()),1,3)<>'5.0' then if copy(strpas(mysql_get_client_info()),1,3)<>'5.0' then
Raise EInOutError.CreateFmt(SErrNotversion50,[strpas(mysql_get_client_info())]); Raise EInOutError.CreateFmt(SErrNotversion50,[strpas(mysql_get_client_info())]);
@ -346,8 +333,7 @@ begin
inherited DoInternalDisconnect; inherited DoInternalDisconnect;
mysql_close(FMySQL); mysql_close(FMySQL);
FMySQL:=Nil; FMySQL:=Nil;
if FDidConnect then ReleaseMysql;
ReleaseMysql;
end; end;
function TConnectionName.GetHandle: pointer; function TConnectionName.GetHandle: pointer;