Skip to content

Commit

Permalink
Fix retrieving MySQL events from the current database on older server…
Browse files Browse the repository at this point in the history
…s which return a lower case schema name, by turning the comparison case insensitive. Further more, don't compare the schema at all on newer servers with a fix for MySQL bug 41907. See https://bugs.mysql.com/bug.php?id=41907#c360194 and https://www.heidisql.com/forum.php?t=41682
  • Loading branch information
ansgarbecker committed Jan 18, 2024
1 parent c6394fb commit 79ce5ed
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion source/dbconnection.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6902,6 +6902,7 @@ procedure TMySQLConnection.FetchDbObjects(db: String; var Cache: TDBObjectList);
obj: TDBObject;
Results: TDBQuery;
rx: TRegExpr;
SchemaBug41907Exists, DbNameMatches: Boolean;
begin
// Return a db's table list
try
Expand Down Expand Up @@ -7066,8 +7067,14 @@ procedure TMySQLConnection.FetchDbObjects(db: String; var Cache: TDBObjectList);
end;
end;
if Assigned(Results) then begin
// Work around old MySQL bug: https://bugs.mysql.com/bug.php?id=41907#c360194
// "Noted [fixed] in 5.1.57, 5.5.12, 5.6.3 changelogs."
SchemaBug41907Exists := (ServerVersionInt < 50157) or
((ServerVersionInt >= 50500) and (ServerVersionInt < 50512)) or
((ServerVersionInt >= 50600) and (ServerVersionInt < 50603));
while not Results.Eof do begin
if Results.Col('Db') = db then begin
DbNameMatches := CompareText(Results.Col('Db'), db) = 0;
if (SchemaBug41907Exists and DbNameMatches) or (not SchemaBug41907Exists) then begin
Obj := TDBObject.Create(Self);
Cache.Add(obj);
Obj.Name := Results.Col('Name');
Expand Down

0 comments on commit 79ce5ed

Please sign in to comment.