When getting CREATE code of all database objects in completion proposal, skip triggers when SHOW CREATE TRIGGER is not yet supported. Closes #111.

This commit is contained in:
Ansgar Becker
2018-12-11 21:01:51 +01:00
parent d0cf9306d0
commit ac63d5f613

View File

@ -3143,13 +3143,19 @@ procedure TDBConnection.PrefetchCreateCode(Objects: TDBObjectList);
var var
Queries: TStringList; Queries: TStringList;
Obj: TDBObject; Obj: TDBObject;
UseIt: Boolean;
begin begin
// Cache some queries used in GetCreateCode for mass operations. See TMainForm.SynCompletionProposalExecute // Cache some queries used in GetCreateCode for mass operations. See TMainForm.SynCompletionProposalExecute
Queries := TStringList.Create; Queries := TStringList.Create;
for Obj in Objects do begin for Obj in Objects do begin
case Parameters.NetTypeGroup of case Parameters.NetTypeGroup of
ngMySQL: begin ngMySQL: begin
if Obj.NodeType <> lntView then UseIt := Obj.NodeType <> lntView;
// SHOW CREATE TRIGGER was introduced in MySQL 5.1.21
// See #111
if Obj.NodeType = lntTrigger then
UseIt := UseIt and (ServerVersionInt >= 50121);
if UseIt then
Queries.Add('SHOW CREATE '+UpperCase(Obj.ObjType)+' '+QuoteIdent(Obj.Database)+'.'+QuoteIdent(Obj.Name)); Queries.Add('SHOW CREATE '+UpperCase(Obj.ObjType)+' '+QuoteIdent(Obj.Database)+'.'+QuoteIdent(Obj.Name));
end; end;
ngMSSQL: begin ngMSSQL: begin