github.com/matrixorigin/matrixone@v0.7.0/pkg/sql/parsers/tree/stmt.go (about) 1 // Copyright 2021 Matrix Origin 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 tree 16 17 import "fmt" 18 19 type Statement interface { 20 fmt.Stringer 21 NodeFormatter 22 StatementType 23 } 24 25 type StatementType interface { 26 // GetStatementType return like insert, update, delete, begin, rename database, rename table, ... 27 GetStatementType() string 28 // GetQueryType return val like DQL, DML, DDL, ... 29 GetQueryType() string 30 } 31 32 type statementImpl struct { 33 Statement 34 } 35 36 const ( 37 // QueryTypeDQL (Data Query Language) Select, MoDump, ValuesStatement, With 38 QueryTypeDQL = "DQL" 39 // QueryTypeDDL (Data Definition Language): CreateDatabase, DropDatabase, DropTable, 40 // Create/Drop/Alter/Rename Database/Table/View/Index/Function, TruncateTable, 41 QueryTypeDDL = "DDL" 42 // QueryTypeDML (Data Manipulation Language): Insert, Update, Delete, Load, Import 43 QueryTypeDML = "DML" 44 // QueryTypeDCL (Data Control Language) 45 // statement: Grant, Revoke 46 // CreateAccount, CreateUser, CreateRole, AlterAccount, AlterUser, DropAccount, DropUser, DropRole 47 QueryTypeDCL = "DCL" 48 // QueryTypeTCL (Transaction Control Language): BeginTransaction, RollbackTransaction, CommitTransaction, Savepoint(Not Support) 49 QueryTypeTCL = "TCL" 50 // QueryTypeOth (Other.) 51 // statement: AnalyzeStmt(Not Support), ExplainStmt, ExplainAnalyze, ExplainFor, 52 // SetVar, SetDefaultRole, SetRole, SetPassword, Declare, Do, TableFunction, Use, PrepareStmt, Execute, Deallocate, Kill 53 // Show ..., ShowCreateTable, ShowColumns(Desc) 54 QueryTypeOth = "Other" 55 )