Skip to content

Commit

Permalink
Issue #350: change startup queries for MySQL:
Browse files Browse the repository at this point in the history
* SELECT NOW() => SELECT CURRENT_TIMESTAMP, which should be working for ProxySQL, as well as downward for MySQL 4.1
* SHOW STATUS => just see if that runs and show errors in the console, the only vital variable we use here is FServerUptime
  • Loading branch information
ansgarbecker committed Jun 17, 2020
1 parent 9ffae88 commit c7c07aa
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions source/dbconnection.pas
Original file line number Diff line number Diff line change
Expand Up @@ -2157,16 +2157,22 @@ procedure TMySQLConnection.SetActive( Value: Boolean );
Log(lcInfo, _('Characterset')+': '+GetCharacterSet);
FConnectionStarted := GetTickCount div 1000;
FServerUptime := -1;
Status := GetResults('SHOW STATUS');
while not Status.Eof do begin
StatusName := LowerCase(Status.Col(0));
if StatusName = 'uptime' then
FServerUptime := StrToIntDef(Status.Col(1), FServerUptime)
else if StatusName = 'ssl_cipher' then
FIsSSL := Status.Col(1) <> '';
Status.Next;
try
// This gives an SQL error on ProxySQL Admin Module
Status := GetResults('SHOW STATUS');
while not Status.Eof do begin
StatusName := LowerCase(Status.Col(0));
if StatusName = 'uptime' then
FServerUptime := StrToIntDef(Status.Col(1), FServerUptime)
else if StatusName = 'ssl_cipher' then
FIsSSL := Status.Col(1) <> '';
Status.Next;
end;
except
on E:EDbError do
Log(lcError, E.Message);
end;
FServerDateTimeOnStartup := GetVar('SELECT NOW()');
FServerDateTimeOnStartup := GetVar('SELECT CURRENT_TIMESTAMP');
FServerOS := GetSessionVariable('version_compile_os');
FRealHostname := GetSessionVariable('hostname');
FServerVersionUntouched := GetSessionVariable('version') + ' - ' + GetSessionVariable('version_comment');
Expand Down

0 comments on commit c7c07aa

Please sign in to comment.