Skip to content
Permalink
Browse files

Issue #350: change startup queries for MySQL:

* 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 c7c07aab926a1c563c05a3fc1201659a0b6bd7d1
Showing with 15 additions and 9 deletions.
  1. +15 −9 source/dbconnection.pas
@@ -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');

0 comments on commit c7c07aa

Please sign in to comment.
You can’t perform that action at this time.