mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 20:50:20 +08:00
Fix access violations on old servers, fixes issue #1417:
a) On a 4.0 server, mysql_real_query("SHOW TABLES FROM nonexistant_db") returns 0/OK . A 5.x server returns 1. On 4.0 servers mysql_num_rows() then causes an access violation. So, we now gracefully avoid calling it when mysql_store_result() returned nil. b) Various hardcoded queries like SHOW ENGINES need to be quiet in any error case.
This commit is contained in:
@ -3773,8 +3773,8 @@ begin
|
||||
Cap.Add( FormatNumber(Results.Col(DBO_AUTOINC)) )
|
||||
else Cap.Add('');
|
||||
Cap.Add(Results.Col(DBO_AUTOINC));
|
||||
Cap.Add(Results.Col(DBO_COLLATION));
|
||||
Cap.Add(Results.Col(DBO_CHECKSUM));
|
||||
Cap.Add(Results.Col(DBO_COLLATION, True));
|
||||
Cap.Add(Results.Col(DBO_CHECKSUM, True));
|
||||
Cap.Add(Results.Col(DBO_CROPTIONS));
|
||||
if Results.ColExists(DBO_TYPE) then
|
||||
Cap.Add(Results.Col(DBO_TYPE))
|
||||
@ -5840,7 +5840,11 @@ begin
|
||||
// Cache datasets
|
||||
if dsShowEngines = nil then begin
|
||||
FreeAndNil(dsShowEngines);
|
||||
dsShowEngines := Connection.GetResults('SHOW ENGINES');
|
||||
try
|
||||
dsShowEngines := Connection.GetResults('SHOW ENGINES');
|
||||
except
|
||||
// Ignore errors on old servers
|
||||
end;
|
||||
end;
|
||||
if dsHaveEngines = nil then begin
|
||||
FreeAndNil(dsHaveEngines);
|
||||
@ -8272,8 +8276,11 @@ end;
|
||||
function TMainform.GetCollations(Items: TWideStrings = nil): TMySQLQuery;
|
||||
begin
|
||||
// Return cached collation list, used in several places, e.g. table editor
|
||||
if dsCollations = nil then
|
||||
if dsCollations = nil then try
|
||||
dsCollations := Connection.GetResults('SHOW COLLATION');
|
||||
except
|
||||
// Ignore errors on old servers
|
||||
end;
|
||||
if Assigned(dsCollations) then begin
|
||||
dsCollations.First;
|
||||
if Assigned(Items) then begin
|
||||
|
Reference in New Issue
Block a user