github.com/dolthub/go-mysql-server@v0.18.0/sql/plan/trigger_begin_end_block.go (about) 1 // Copyright 2020-2021 Dolthub, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package plan 16 17 import ( 18 "github.com/dolthub/go-mysql-server/sql" 19 ) 20 21 // TriggerBeginEndBlock represents a BEGIN/END block specific to TRIGGER execution, which has special considerations 22 // regarding logic execution through the RowIter function. 23 type TriggerBeginEndBlock struct { 24 *BeginEndBlock 25 } 26 27 var _ sql.Node = (*TriggerBeginEndBlock)(nil) 28 var _ sql.DebugStringer = (*TriggerBeginEndBlock)(nil) 29 var _ sql.CollationCoercible = (*TriggerBeginEndBlock)(nil) 30 var _ RepresentsLabeledBlock = (*TriggerBeginEndBlock)(nil) 31 var _ RepresentsScope = (*TriggerBeginEndBlock)(nil) 32 33 // NewTriggerBeginEndBlock creates a new *TriggerBeginEndBlock node. 34 func NewTriggerBeginEndBlock(block *BeginEndBlock) *TriggerBeginEndBlock { 35 return &TriggerBeginEndBlock{ 36 BeginEndBlock: block, 37 } 38 } 39 40 // WithChildren implements the sql.Node interface. 41 func (b *TriggerBeginEndBlock) WithChildren(children ...sql.Node) (sql.Node, error) { 42 return NewTriggerBeginEndBlock(NewBeginEndBlock(b.BeginEndBlock.Label, NewBlock(children))), nil 43 } 44 45 // CheckPrivileges implements the interface sql.Node. 46 func (b *TriggerBeginEndBlock) CheckPrivileges(ctx *sql.Context, opChecker sql.PrivilegedOperationChecker) bool { 47 return b.Block.CheckPrivileges(ctx, opChecker) 48 }