From ac63d5f613d26f39f2d9cf01fa9cc21c158ce985 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Tue, 11 Dec 2018 21:01:51 +0100 Subject: [PATCH] When getting CREATE code of all database objects in completion proposal, skip triggers when SHOW CREATE TRIGGER is not yet supported. Closes #111. --- source/dbconnection.pas | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/dbconnection.pas b/source/dbconnection.pas index 45bfadf2..a5d7eadb 100644 --- a/source/dbconnection.pas +++ b/source/dbconnection.pas @@ -3143,13 +3143,19 @@ procedure TDBConnection.PrefetchCreateCode(Objects: TDBObjectList); var Queries: TStringList; Obj: TDBObject; + UseIt: Boolean; begin // Cache some queries used in GetCreateCode for mass operations. See TMainForm.SynCompletionProposalExecute Queries := TStringList.Create; for Obj in Objects do begin case Parameters.NetTypeGroup of 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)); end; ngMSSQL: begin