github.com/matrixorigin/matrixone@v1.2.0/pkg/sql/parsers/tree/show.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 type Show interface { 18 Explain 19 } 20 21 type showImpl struct { 22 Show 23 } 24 25 func (s *showImpl) Free() { 26 } 27 28 // SHOW CREATE TABLE statement 29 type ShowCreateTable struct { 30 showImpl 31 Name *UnresolvedObjectName 32 SnapshotName string 33 } 34 35 func (node *ShowCreateTable) Format(ctx *FmtCtx) { 36 ctx.WriteString("show create table ") 37 node.Name.ToTableName().Format(ctx) 38 } 39 40 func (node *ShowCreateTable) GetStatementType() string { return "Show Create Table" } 41 func (node *ShowCreateTable) GetQueryType() string { return QueryTypeOth } 42 43 func NewShowCreate(n *UnresolvedObjectName) *ShowCreateTable { 44 return &ShowCreateTable{Name: n} 45 } 46 47 // SHOW CREATE VIEW statement 48 type ShowCreateView struct { 49 showImpl 50 Name *UnresolvedObjectName 51 SnapshotName string 52 } 53 54 func (node *ShowCreateView) Format(ctx *FmtCtx) { 55 ctx.WriteString("show create view ") 56 node.Name.ToTableName().Format(ctx) 57 } 58 func (node *ShowCreateView) GetStatementType() string { return "Show Create View" } 59 func (node *ShowCreateView) GetQueryType() string { return QueryTypeOth } 60 61 func NewShowCreateView(n *UnresolvedObjectName) *ShowCreateView { 62 return &ShowCreateView{Name: n} 63 } 64 65 // SHOW CREATE DATABASE statement 66 type ShowCreateDatabase struct { 67 showImpl 68 IfNotExists bool 69 Name string 70 } 71 72 func (node *ShowCreateDatabase) Format(ctx *FmtCtx) { 73 ctx.WriteString("show create database") 74 if node.IfNotExists { 75 ctx.WriteString(" if not exists") 76 } 77 ctx.WriteByte(' ') 78 ctx.WriteString(string(node.Name)) 79 } 80 func (node *ShowCreateDatabase) GetStatementType() string { return "Show Create View" } 81 func (node *ShowCreateDatabase) GetQueryType() string { return QueryTypeOth } 82 83 func NewShowCreateDatabase(i bool, n string) *ShowCreateDatabase { 84 return &ShowCreateDatabase{IfNotExists: i, Name: n} 85 } 86 87 // SHOW COLUMNS statement. 88 type ShowColumns struct { 89 showImpl 90 Ext bool 91 Full bool 92 Table *UnresolvedObjectName 93 ColName *UnresolvedName 94 DBName string 95 Like *ComparisonExpr 96 Where *Where 97 } 98 99 func (node *ShowColumns) Format(ctx *FmtCtx) { 100 ctx.WriteString("show") 101 if node.Ext { 102 ctx.WriteString(" extended") 103 } 104 if node.Full { 105 ctx.WriteString(" full") 106 } 107 ctx.WriteString(" columns") 108 if node.Table != nil { 109 ctx.WriteString(" from ") 110 node.Table.Format(ctx) 111 } 112 if node.DBName != "" { 113 ctx.WriteString(" from ") 114 ctx.WriteString(node.DBName) 115 } 116 if node.Like != nil { 117 ctx.WriteByte(' ') 118 node.Like.Format(ctx) 119 } 120 if node.Where != nil { 121 ctx.WriteByte(' ') 122 node.Where.Format(ctx) 123 } 124 } 125 func (node *ShowColumns) GetStatementType() string { return "Show Columns" } 126 func (node *ShowColumns) GetQueryType() string { return QueryTypeOth } 127 128 func NewShowColumns(e bool, f bool, t *UnresolvedObjectName, d string, l *ComparisonExpr, w *Where, cn *UnresolvedName) *ShowColumns { 129 return &ShowColumns{ 130 Ext: e, 131 Full: f, 132 Table: t, 133 ColName: cn, 134 DBName: d, 135 Like: l, 136 Where: w, 137 } 138 } 139 140 // the SHOW DATABASES statement. 141 type ShowDatabases struct { 142 showImpl 143 Like *ComparisonExpr 144 Where *Where 145 SnapshotName string 146 } 147 148 func (node *ShowDatabases) Format(ctx *FmtCtx) { 149 ctx.WriteString("show databases") 150 if node.Like != nil { 151 ctx.WriteByte(' ') 152 node.Like.Format(ctx) 153 } 154 if node.Where != nil { 155 ctx.WriteByte(' ') 156 node.Where.Format(ctx) 157 } 158 } 159 func (node *ShowDatabases) GetStatementType() string { return "Show Databases" } 160 func (node *ShowDatabases) GetQueryType() string { return QueryTypeOth } 161 162 func NewShowDatabases(l *ComparisonExpr, w *Where) *ShowDatabases { 163 return &ShowDatabases{ 164 Like: l, 165 Where: w, 166 } 167 } 168 169 type ShowType int 170 171 const ( 172 ShowEngines = iota 173 ShowCharset 174 ShowCreateUser 175 ShowTriggers 176 ShowConfig 177 ShowEvents 178 ShowPlugins 179 ShowProfile 180 ShowProfiles 181 ShowPrivileges 182 ) 183 184 func (s ShowType) String() string { 185 switch s { 186 case ShowEngines: 187 return "engines" 188 case ShowCharset: 189 return "charset" 190 case ShowCreateUser: 191 return "create user" 192 case ShowTriggers: 193 return "triggers" 194 case ShowConfig: 195 return "config" 196 case ShowEvents: 197 return "events" 198 case ShowPlugins: 199 return "plugins" 200 case ShowProfile: 201 return "profile" 202 case ShowProfiles: 203 return "profiles" 204 case ShowPrivileges: 205 return "privileges" 206 default: 207 return "not implemented" 208 } 209 } 210 211 type ShowTarget struct { 212 showImpl 213 Global bool 214 Type ShowType 215 DbName string 216 Like *ComparisonExpr 217 Where *Where 218 } 219 220 func (node *ShowTarget) Format(ctx *FmtCtx) { 221 ctx.WriteString("show ") 222 if node.Global { 223 ctx.WriteString("global ") 224 } 225 ctx.WriteString(node.Type.String()) 226 if node.DbName != "" { 227 ctx.WriteString(" from ") 228 ctx.WriteString(node.DbName) 229 } 230 if node.Like != nil { 231 ctx.WriteByte(' ') 232 node.Like.Format(ctx) 233 } 234 if node.Where != nil { 235 ctx.WriteByte(' ') 236 node.Where.Format(ctx) 237 } 238 } 239 func (node *ShowTarget) GetStatementType() string { return "Show Target" } 240 func (node *ShowTarget) GetQueryType() string { return QueryTypeOth } 241 242 type ShowTableStatus struct { 243 showImpl 244 DbName string 245 Like *ComparisonExpr 246 Where *Where 247 } 248 249 func (node *ShowTableStatus) Format(ctx *FmtCtx) { 250 ctx.WriteString("show table status") 251 if node.DbName != "" { 252 ctx.WriteString(" from ") 253 ctx.WriteString(node.DbName) 254 } 255 if node.Like != nil { 256 ctx.WriteByte(' ') 257 node.Like.Format(ctx) 258 } 259 if node.Where != nil { 260 ctx.WriteByte(' ') 261 node.Where.Format(ctx) 262 } 263 } 264 func (node *ShowTableStatus) GetStatementType() string { return "Show Table Status" } 265 func (node *ShowTableStatus) GetQueryType() string { return QueryTypeOth } 266 267 type ShowGrants struct { 268 showImpl 269 Username string 270 Hostname string 271 Roles []*Role 272 ShowGrantType ShowGrantType 273 } 274 275 type ShowGrantType int 276 277 const ( 278 GrantForUser = iota 279 GrantForRole 280 ) 281 282 func (node *ShowGrants) Format(ctx *FmtCtx) { 283 if node.ShowGrantType == GrantForRole { 284 ctx.WriteString("show grants") 285 if node.Roles != nil { 286 ctx.WriteString("for") 287 ctx.WriteString(" ") 288 ctx.WriteString(node.Roles[0].UserName) 289 } 290 } else { 291 ctx.WriteString("show grants") 292 if node.Username != "" { 293 ctx.WriteString(" for ") 294 ctx.WriteString(node.Username) 295 if node.Hostname != "" { 296 ctx.WriteString("@") 297 ctx.WriteString(node.Hostname) 298 } 299 } 300 if node.Roles != nil { 301 prefix := "" 302 for _, r := range node.Roles { 303 ctx.WriteString(prefix) 304 r.Format(ctx) 305 prefix = ", " 306 } 307 } 308 } 309 } 310 func (node *ShowGrants) GetStatementType() string { return "Show Grants" } 311 func (node *ShowGrants) GetQueryType() string { return QueryTypeOth } 312 313 // SHOW SEQUENCES statement. 314 type ShowSequences struct { 315 showImpl 316 DBName string 317 Where *Where 318 } 319 320 func (node *ShowSequences) Format(ctx *FmtCtx) { 321 ctx.WriteString("show sequences") 322 if node.DBName != "" { 323 ctx.WriteString(" from ") 324 ctx.WriteString(node.DBName) 325 } 326 if node.Where != nil { 327 ctx.WriteByte(' ') 328 node.Where.Format(ctx) 329 } 330 } 331 func (node *ShowSequences) GetStatementType() string { return "Show Sequences" } 332 func (node *ShowSequences) GetQueryType() string { return QueryTypeOth } 333 334 // SHOW TABLES statement. 335 type ShowTables struct { 336 showImpl 337 Ext bool 338 Open bool 339 Full bool 340 DBName string 341 Like *ComparisonExpr 342 Where *Where 343 SnapshotName string 344 } 345 346 func (node *ShowTables) Format(ctx *FmtCtx) { 347 ctx.WriteString("show") 348 if node.Open { 349 ctx.WriteString(" open") 350 } 351 if node.Full { 352 ctx.WriteString(" full") 353 } 354 ctx.WriteString(" tables") 355 if node.DBName != "" { 356 ctx.WriteString(" from ") 357 ctx.WriteString(node.DBName) 358 } 359 if node.Like != nil { 360 ctx.WriteByte(' ') 361 node.Like.Format(ctx) 362 } 363 if node.Where != nil { 364 ctx.WriteByte(' ') 365 node.Where.Format(ctx) 366 } 367 } 368 func (node *ShowTables) GetStatementType() string { return "Show Tables" } 369 func (node *ShowTables) GetQueryType() string { return QueryTypeOth } 370 371 func NewShowTables(e bool, f bool, n string, l *ComparisonExpr, w *Where) *ShowTables { 372 return &ShowTables{ 373 Ext: e, 374 Full: f, 375 DBName: n, 376 Like: l, 377 Where: w, 378 } 379 } 380 381 // SHOW PROCESSLIST 382 type ShowProcessList struct { 383 showImpl 384 Full bool 385 } 386 387 func (node *ShowProcessList) Format(ctx *FmtCtx) { 388 ctx.WriteString("show") 389 if node.Full { 390 ctx.WriteString(" full") 391 } 392 ctx.WriteString(" processlist") 393 } 394 func (node *ShowProcessList) GetStatementType() string { return "Show Processlist" } 395 func (node *ShowProcessList) GetQueryType() string { return QueryTypeOth } 396 397 func NewShowProcessList(f bool) *ShowProcessList { 398 return &ShowProcessList{Full: f} 399 } 400 401 type ShowErrors struct { 402 showImpl 403 } 404 405 func (node *ShowErrors) Format(ctx *FmtCtx) { 406 ctx.WriteString("show errors") 407 } 408 func (node *ShowErrors) GetStatementType() string { return "Show Errors" } 409 func (node *ShowErrors) GetQueryType() string { return QueryTypeOth } 410 411 func NewShowErrors() *ShowErrors { 412 return &ShowErrors{} 413 } 414 415 type ShowWarnings struct { 416 showImpl 417 } 418 419 func (node *ShowWarnings) Format(ctx *FmtCtx) { 420 ctx.WriteString("show warnings") 421 } 422 func (node *ShowWarnings) GetStatementType() string { return "Show Warnings" } 423 func (node *ShowWarnings) GetQueryType() string { return QueryTypeOth } 424 425 func NewShowWarnings() *ShowWarnings { 426 return &ShowWarnings{} 427 } 428 429 // SHOW collation statement 430 type ShowCollation struct { 431 showImpl 432 Like *ComparisonExpr 433 Where *Where 434 } 435 436 func (node *ShowCollation) Format(ctx *FmtCtx) { 437 ctx.WriteString("show collation") 438 if node.Like != nil { 439 ctx.WriteString(" like ") 440 node.Like.Format(ctx) 441 } 442 if node.Where != nil { 443 ctx.WriteByte(' ') 444 node.Where.Format(ctx) 445 } 446 } 447 func (node *ShowCollation) GetStatementType() string { return "Show Collation" } 448 func (node *ShowCollation) GetQueryType() string { return QueryTypeOth } 449 450 // SHOW VARIABLES statement 451 // System Variables 452 type ShowVariables struct { 453 showImpl 454 Global bool 455 Like *ComparisonExpr 456 Where *Where 457 } 458 459 func (node *ShowVariables) Format(ctx *FmtCtx) { 460 ctx.WriteString("show") 461 if node.Global { 462 ctx.WriteString(" global") 463 } 464 ctx.WriteString(" variables") 465 if node.Like != nil { 466 ctx.WriteByte(' ') 467 node.Like.Format(ctx) 468 } 469 if node.Where != nil { 470 ctx.WriteByte(' ') 471 node.Where.Format(ctx) 472 } 473 } 474 func (node *ShowVariables) GetStatementType() string { return "Show Variables" } 475 func (node *ShowVariables) GetQueryType() string { return QueryTypeOth } 476 477 func NewShowVariables(g bool, l *ComparisonExpr, w *Where) *ShowVariables { 478 return &ShowVariables{ 479 Global: g, 480 Like: l, 481 Where: w, 482 } 483 } 484 485 // SHOW STATUS statement 486 type ShowStatus struct { 487 showImpl 488 Global bool 489 Like *ComparisonExpr 490 Where *Where 491 } 492 493 func (node *ShowStatus) Format(ctx *FmtCtx) { 494 ctx.WriteString("show") 495 if node.Global { 496 ctx.WriteString(" global") 497 } 498 ctx.WriteString(" status") 499 if node.Like != nil { 500 ctx.WriteString(" like ") 501 node.Like.Format(ctx) 502 } 503 if node.Where != nil { 504 ctx.WriteByte(' ') 505 node.Where.Format(ctx) 506 } 507 } 508 func (node *ShowStatus) GetStatementType() string { return "Show Status" } 509 func (node *ShowStatus) GetQueryType() string { return QueryTypeOth } 510 511 func NewShowStatus(g bool, l *ComparisonExpr, w *Where) *ShowStatus { 512 return &ShowStatus{ 513 Global: g, 514 Like: l, 515 Where: w, 516 } 517 } 518 519 // show index statement 520 type ShowIndex struct { 521 showImpl 522 TableName *UnresolvedObjectName 523 DbName string 524 Where *Where 525 } 526 527 func (node *ShowIndex) Format(ctx *FmtCtx) { 528 ctx.WriteString("show index") 529 if node.TableName != nil { 530 ctx.WriteString(" from ") 531 node.TableName.Format(ctx) 532 } 533 if node.DbName != "" { 534 ctx.WriteString(" from ") 535 ctx.WriteString(node.DbName) 536 } 537 if node.Where != nil { 538 ctx.WriteByte(' ') 539 node.Where.Format(ctx) 540 } 541 } 542 func (node *ShowIndex) GetStatementType() string { return "Show Index" } 543 func (node *ShowIndex) GetQueryType() string { return QueryTypeOth } 544 545 func NewShowIndex(t *UnresolvedObjectName, w *Where) *ShowIndex { 546 return &ShowIndex{ 547 TableName: t, 548 Where: w, 549 } 550 } 551 552 // show Function or Procedure statement 553 554 type ShowFunctionOrProcedureStatus struct { 555 showImpl 556 Like *ComparisonExpr 557 Where *Where 558 IsFunction bool 559 } 560 561 func (node *ShowFunctionOrProcedureStatus) Format(ctx *FmtCtx) { 562 if node.IsFunction { 563 ctx.WriteString("show function status") 564 } else { 565 ctx.WriteString("show procedure status") 566 } 567 if node.Like != nil { 568 ctx.WriteString(" like ") 569 node.Like.Format(ctx) 570 } 571 if node.Where != nil { 572 ctx.WriteByte(' ') 573 node.Where.Format(ctx) 574 } 575 } 576 577 func (node *ShowFunctionOrProcedureStatus) GetStatementType() string { 578 return "Show Function Or Procedure Status" 579 } 580 func (node *ShowFunctionOrProcedureStatus) GetQueryType() string { return QueryTypeOth } 581 582 func NewShowFunctionOrProcedureStatus(l *ComparisonExpr, w *Where, i bool) *ShowFunctionOrProcedureStatus { 583 return &ShowFunctionOrProcedureStatus{ 584 Like: l, 585 Where: w, 586 IsFunction: i, 587 } 588 } 589 590 // show node list 591 type ShowNodeList struct { 592 showImpl 593 } 594 595 func (node *ShowNodeList) Format(ctx *FmtCtx) { 596 ctx.WriteString("show node list") 597 } 598 599 func (node *ShowNodeList) GetStatementType() string { return "Show Node List" } 600 func (node *ShowNodeList) GetQueryType() string { return QueryTypeOth } 601 602 func NewShowNodeList() *ShowNodeList { 603 return &ShowNodeList{} 604 } 605 606 // show locks 607 type ShowLocks struct { 608 showImpl 609 } 610 611 func (node *ShowLocks) Format(ctx *FmtCtx) { 612 ctx.WriteString("show locks") 613 } 614 615 func (node *ShowLocks) GetStatementType() string { return "Show Locks" } 616 func (node *ShowLocks) GetQueryType() string { return QueryTypeOth } 617 618 func NewShowLocks() *ShowLocks { 619 return &ShowLocks{} 620 } 621 622 // show table number 623 type ShowTableNumber struct { 624 showImpl 625 DbName string 626 } 627 628 func (node *ShowTableNumber) Format(ctx *FmtCtx) { 629 ctx.WriteString("show table number") 630 if node.DbName != "" { 631 ctx.WriteString(" from ") 632 ctx.WriteString(node.DbName) 633 } 634 } 635 func (node *ShowTableNumber) GetStatementType() string { return "Show Table Number" } 636 func (node *ShowTableNumber) GetQueryType() string { return QueryTypeOth } 637 638 func NewShowTableNumber(dbname string) *ShowTableNumber { 639 return &ShowTableNumber{ 640 DbName: dbname, 641 } 642 } 643 644 // show column number 645 type ShowColumnNumber struct { 646 showImpl 647 Table *UnresolvedObjectName 648 DbName string 649 } 650 651 func (node *ShowColumnNumber) Format(ctx *FmtCtx) { 652 ctx.WriteString("show column number") 653 if node.Table != nil { 654 ctx.WriteString(" from ") 655 node.Table.Format(ctx) 656 } 657 if node.DbName != "" { 658 ctx.WriteString(" from ") 659 ctx.WriteString(node.DbName) 660 } 661 } 662 func (node *ShowColumnNumber) GetStatementType() string { return "Show Column Number" } 663 func (node *ShowColumnNumber) GetQueryType() string { return QueryTypeOth } 664 665 func NewShowColumnNumber(table *UnresolvedObjectName, dbname string) *ShowColumnNumber { 666 return &ShowColumnNumber{ 667 Table: table, 668 DbName: dbname, 669 } 670 } 671 672 // show table values 673 type ShowTableValues struct { 674 showImpl 675 Table *UnresolvedObjectName 676 DbName string 677 } 678 679 func (node *ShowTableValues) Format(ctx *FmtCtx) { 680 ctx.WriteString("show table values") 681 if node.Table != nil { 682 ctx.WriteString(" from ") 683 node.Table.Format(ctx) 684 } 685 if node.DbName != "" { 686 ctx.WriteString(" from ") 687 ctx.WriteString(node.DbName) 688 } 689 } 690 func (node *ShowTableValues) GetStatementType() string { return "Show Table Values" } 691 func (node *ShowTableValues) GetQueryType() string { return QueryTypeOth } 692 693 func NewShowTableValues(table *UnresolvedObjectName, dbname string) *ShowTableValues { 694 return &ShowTableValues{ 695 Table: table, 696 DbName: dbname, 697 } 698 } 699 700 type ShowAccounts struct { 701 showImpl 702 Like *ComparisonExpr 703 } 704 705 func (node *ShowAccounts) Format(ctx *FmtCtx) { 706 ctx.WriteString("show accounts") 707 if node.Like != nil { 708 ctx.WriteByte(' ') 709 node.Like.Format(ctx) 710 } 711 } 712 713 func (node *ShowAccounts) GetStatementType() string { return "Show Accounts" } 714 func (node *ShowAccounts) GetQueryType() string { return QueryTypeOth } 715 716 type ShowAccountUpgrade struct { 717 statementImpl 718 } 719 720 func (node *ShowAccountUpgrade) Format(ctx *FmtCtx) { 721 ctx.WriteString("show upgrade") 722 } 723 724 func (node *ShowAccountUpgrade) GetStatementType() string { return "show upgrade" } 725 func (node *ShowAccountUpgrade) GetQueryType() string { return QueryTypeOth } 726 727 type ShowPublications struct { 728 showImpl 729 Like *ComparisonExpr 730 } 731 732 func (node *ShowPublications) Format(ctx *FmtCtx) { 733 ctx.WriteString("show publications") 734 if node.Like != nil { 735 ctx.WriteByte(' ') 736 node.Like.Format(ctx) 737 } 738 } 739 740 func (node *ShowPublications) GetStatementType() string { return "Show Publications" } 741 func (node *ShowPublications) GetQueryType() string { return QueryTypeOth } 742 743 type ShowSubscriptions struct { 744 showImpl 745 All bool 746 Like *ComparisonExpr 747 } 748 749 func (node *ShowSubscriptions) Format(ctx *FmtCtx) { 750 ctx.WriteString("show subscriptions") 751 if node.All { 752 ctx.WriteString(" all") 753 } 754 if node.Like != nil { 755 ctx.WriteByte(' ') 756 node.Like.Format(ctx) 757 } 758 } 759 func (node *ShowSubscriptions) GetStatementType() string { return "Show Subscriptions" } 760 func (node *ShowSubscriptions) GetQueryType() string { return QueryTypeOth } 761 762 type ShowCreatePublications struct { 763 showImpl 764 Name string 765 } 766 767 func (node *ShowCreatePublications) Format(ctx *FmtCtx) { 768 ctx.WriteString("show create publication ") 769 ctx.WriteString(node.Name) 770 } 771 func (node *ShowCreatePublications) GetStatementType() string { return "Show Create Publication" } 772 func (node *ShowCreatePublications) GetQueryType() string { return QueryTypeOth } 773 774 type ShowTableSize struct { 775 showImpl 776 Table *UnresolvedObjectName 777 DbName string 778 } 779 780 func (node *ShowTableSize) Format(ctx *FmtCtx) { 781 ctx.WriteString("show table size") 782 if node.Table != nil { 783 ctx.WriteString(" from ") 784 node.Table.Format(ctx) 785 } 786 if node.DbName != "" { 787 ctx.WriteString(" from ") 788 ctx.WriteString(node.DbName) 789 } 790 } 791 func (node *ShowTableSize) GetStatementType() string { return "Show Table Size" } 792 func (node *ShowTableSize) GetQueryType() string { return QueryTypeDQL } 793 794 func NewShowTableSize(table *UnresolvedObjectName, dbname string) *ShowTableSize { 795 return &ShowTableSize{ 796 Table: table, 797 DbName: dbname, 798 } 799 } 800 801 // show Roles statement 802 803 type ShowRolesStmt struct { 804 showImpl 805 Like *ComparisonExpr 806 } 807 808 func (node *ShowRolesStmt) Format(ctx *FmtCtx) { 809 ctx.WriteString("show roles") 810 if node.Like != nil { 811 ctx.WriteString(" ") 812 node.Like.Format(ctx) 813 } 814 } 815 816 func (node *ShowRolesStmt) GetStatementType() string { return "Show Roles" } 817 func (node *ShowRolesStmt) GetQueryType() string { return QueryTypeOth } 818 819 // ShowBackendServers indicates SHOW BACKEND SERVERS statement. 820 type ShowBackendServers struct { 821 showImpl 822 } 823 824 func (node *ShowBackendServers) Format(ctx *FmtCtx) { 825 ctx.WriteString("show backend servers") 826 } 827 828 func (node *ShowBackendServers) GetStatementType() string { return "Show Backend Servers" } 829 func (node *ShowBackendServers) GetQueryType() string { return QueryTypeOth } 830 831 type ShowConnectors struct { 832 showImpl 833 } 834 835 func (node *ShowConnectors) Format(ctx *FmtCtx) { 836 ctx.WriteString("show connectors") 837 } 838 func (node *ShowConnectors) GetStatementType() string { return "Show Connectors" } 839 func (node *ShowConnectors) GetQueryType() string { return QueryTypeOth } 840 841 func NewShowConnectors(f bool) *ShowConnectors { 842 return &ShowConnectors{} 843 } 844 845 type EmptyStmt struct { 846 statementImpl 847 } 848 849 func (e *EmptyStmt) String() string { 850 return "" 851 } 852 853 func (e *EmptyStmt) Format(ctx *FmtCtx) { 854 ctx.WriteString("") 855 } 856 857 func (e EmptyStmt) GetStatementType() string { 858 return "InternalCmd" 859 } 860 861 func (e EmptyStmt) GetQueryType() string { 862 return QueryTypeOth 863 }