|
@@ -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);
|
|
|
|
- If B then
|
|
|
|
- InitialiseMysql;
|
|
|
|
|
|
+ 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;
|
|
|
|
- H,U,P : String;
|
|
|
|
|
|
+var H,U,P : String;
|
|
AMySQL : PMySQL;
|
|
AMySQL : PMySQL;
|
|
|
|
|
|
begin
|
|
begin
|
|
CheckDisConnected;
|
|
CheckDisConnected;
|
|
|
|
|
|
- ADidConnect:=(MySQLLibraryHandle=NilHandle);
|
|
|
|
- if ADidConnect then
|
|
|
|
- InitialiseMysql;
|
|
|
|
|
|
+ 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);
|
|
|
|
- if FDidConnect then
|
|
|
|
- InitialiseMysql;
|
|
|
|
|
|
+ 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;
|