mysql_get_server_info() returns "5.5.5-10.0.10-MariaDB". Override that with the "version" server variable, which is more exact here.

This commit is contained in:
Ansgar Becker
2014-05-27 13:55:54 +00:00
parent a2c76e7e5f
commit f417a25fe0

View File

@ -825,6 +825,7 @@ begin
rx.Expression := '(-pw\s+")[^"]*(")'; rx.Expression := '(-pw\s+")[^"]*(")';
PlinkCmdDisplay := FConnection.Parameters.SSHPlinkExe + ' ' + rx.Replace(PlinkParameters, '${1}******${2}', True); PlinkCmdDisplay := FConnection.Parameters.SSHPlinkExe + ' ' + rx.Replace(PlinkParameters, '${1}******${2}', True);
FConnection.Log(lcInfo, f_('Attempt to create plink.exe process, waiting %ds for response ...', [FConnection.Parameters.SSHTimeout])); FConnection.Log(lcInfo, f_('Attempt to create plink.exe process, waiting %ds for response ...', [FConnection.Parameters.SSHTimeout]));
FConnection.Log(lcInfo, PlinkCmdDisplay);
// Prepare process // Prepare process
FillChar(StartupInfo, SizeOf(StartupInfo), 0); FillChar(StartupInfo, SizeOf(StartupInfo), 0);
@ -1617,16 +1618,20 @@ begin
Status.Next; Status.Next;
end; end;
FServerVersionUntouched := DecodeAPIString(mysql_get_server_info(FHandle)); FServerVersionUntouched := DecodeAPIString(mysql_get_server_info(FHandle));
log(lcinfo, FServerVersionUntouched);
Vars := GetSessionVariables(False); Vars := GetSessionVariables(False);
while not Vars.Eof do begin while not Vars.Eof do begin
if Vars.Col(0) = 'version_compile_os' then if Vars.Col(0) = 'version_compile_os' then
FServerOS := Vars.Col(1); FServerOS := Vars.Col(1);
if Vars.Col(0) = 'hostname' then if Vars.Col(0) = 'hostname' then
FRealHostname := Vars.Col(1); FRealHostname := Vars.Col(1);
if (Vars.Col(0) = 'version') and (Vars.Col(1) <> '') then
FServerVersionUntouched := Vars.Col(1);
if (Vars.Col(0) = 'version_comment') and (Vars.Col(1) <> '') then if (Vars.Col(0) = 'version_comment') and (Vars.Col(1) <> '') then
FServerVersionUntouched := FServerVersionUntouched + ' - ' + Vars.Col(1); FServerVersionUntouched := FServerVersionUntouched + ' - ' + Vars.Col(1);
Vars.Next; Vars.Next;
end; end;
log(lcinfo, FServerVersionUntouched);
if FDatabase <> '' then begin if FDatabase <> '' then begin
tmpdb := FDatabase; tmpdb := FDatabase;
FDatabase := ''; FDatabase := '';
@ -2098,7 +2103,7 @@ begin
Log(lcDebug, 'Ping server ...'); Log(lcDebug, 'Ping server ...');
if (FHandle=nil) or (PQping(FHandle) <> PQPING_OK) then begin if (FHandle=nil) or (PQping(FHandle) <> PQPING_OK) then begin
// Be sure to release some stuff before reconnecting // Be sure to release some stuff before reconnecting
//log(lcinfo, 'TPGConnection.Ping reconnect: handle:'+inttostr(integer(FHandle=nil))+' '+inttostr(integer(PQping(FHandle)))); log(lcinfo, 'TPGConnection.Ping reconnect: handle:'+inttostr(integer(FHandle=nil))+' '+inttostr(integer(PQping(FHandle))));
//Active := False; //Active := False;
//if Reconnect then //if Reconnect then
// Active := True; // Active := True;
@ -2906,19 +2911,17 @@ end;
function TPGConnection.GetAllDatabases: TStringList; function TPGConnection.GetAllDatabases: TStringList;
begin begin
Result := inherited; // Do not inherit, as in PG we cannot use the
if not Assigned(Result) then begin if not Assigned(FAllDatabases) then try
try // Query is.schemata when using schemata, for databases use pg_database
// Query is.schemata when using schemata, for databases use pg_database //FAllDatabases := GetCol('SELECT datname FROM pg_database WHERE datistemplate=FALSE');
//FAllDatabases := GetCol('SELECT datname FROM pg_database WHERE datistemplate=FALSE'); FAllDatabases := GetCol('SELECT '+QuoteIdent('schema_name')+
FAllDatabases := GetCol('SELECT '+QuoteIdent('schema_name')+ ' FROM '+QuoteIdent('information_schema')+'.'+QuoteIdent('schemata')+
' FROM '+QuoteIdent('information_schema')+'.'+QuoteIdent('schemata')+ ' ORDER BY '+QuoteIdent('schema_name'));
' ORDER BY '+QuoteIdent('schema_name')); except on E:EDatabaseError do
except on E:EDatabaseError do FAllDatabases := TStringList.Create;
FAllDatabases := TStringList.Create;
end;
Result := FAllDatabases;
end; end;
Result := FAllDatabases;
end; end;
@ -3937,7 +3940,7 @@ begin
obj.Name := Results.Col('table_name'); obj.Name := Results.Col('table_name');
obj.Created := 0; obj.Created := 0;
obj.Updated := 0; obj.Updated := 0;
obj.Database := db; //obj.Database := db;
obj.Schema := Results.Col('table_schema'); // Remove when using schemata obj.Schema := Results.Col('table_schema'); // Remove when using schemata
obj.Comment := Results.Col('comment'); obj.Comment := Results.Col('comment');
obj.Rows := StrToIntDef(Results.Col('reltuples'), obj.Rows); obj.Rows := StrToIntDef(Results.Col('reltuples'), obj.Rows);