Format formats the node.
(buf *nodeBuffer)
| 1308 | |
| 1309 | // Format formats the node. |
| 1310 | func (node *Show) Format(buf *nodeBuffer) { |
| 1311 | if node.Type == "tables" && node.ShowTablesOpt != nil { |
| 1312 | opt := node.ShowTablesOpt |
| 1313 | if opt.DbName != "" { |
| 1314 | if opt.Filter != nil { |
| 1315 | buf.Printf("show %s%stables from %s %v", opt.Extended, opt.Full, opt.DbName, opt.Filter) |
| 1316 | } else { |
| 1317 | buf.Printf("show %s%stables from %s", opt.Extended, opt.Full, opt.DbName) |
| 1318 | } |
| 1319 | } else { |
| 1320 | if opt.Filter != nil { |
| 1321 | buf.Printf("show %s%stables %v", opt.Extended, opt.Full, opt.Filter) |
| 1322 | } else { |
| 1323 | buf.Printf("show %s%stables", opt.Extended, opt.Full) |
| 1324 | } |
| 1325 | } |
| 1326 | return |
| 1327 | } |
| 1328 | if node.Scope == "" { |
| 1329 | buf.Printf("show %s", node.Type) |
| 1330 | } else { |
| 1331 | buf.Printf("show %s %s", node.Scope, node.Type) |
| 1332 | } |
| 1333 | if !node.OnTable.Name.IsEmpty() { |
| 1334 | buf.Printf(" on %v", node.OnTable) |
| 1335 | } |
| 1336 | } |
| 1337 | |
| 1338 | // ShowTablesOpt is show tables option |
| 1339 | type ShowTablesOpt struct { |