本文整理汇总了Golang中github.com/pingcap/tidb/ast.ShowStmt.Text方法的典型用法代码示例。如果您正苦于以下问题:Golang ShowStmt.Text方法的具体用法?Golang ShowStmt.Text怎么用?Golang ShowStmt.Text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/pingcap/tidb/ast.ShowStmt
的用法示例。
在下文中一共展示了ShowStmt.Text方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: convertShow
func convertShow(converter *expressionConverter, v *ast.ShowStmt) (*stmts.ShowStmt, error) {
oldShow := &stmts.ShowStmt{
DBName: v.DBName,
Flag: v.Flag,
Full: v.Full,
GlobalScope: v.GlobalScope,
Text: v.Text(),
}
if v.Table != nil {
oldShow.TableIdent = table.Ident{
Schema: v.Table.Schema,
Name: v.Table.Name,
}
}
if v.Column != nil {
oldShow.ColumnName = joinColumnName(v.Column)
}
if v.Where != nil {
oldWhere, err := convertExpr(converter, v.Where)
if err != nil {
return nil, errors.Trace(err)
}
oldShow.Where = oldWhere
}
if v.Pattern != nil {
oldPattern, err := convertExpr(converter, v.Pattern)
if err != nil {
return nil, errors.Trace(err)
}
oldShow.Pattern = oldPattern.(*expression.PatternLike)
}
switch v.Tp {
case ast.ShowCharset:
oldShow.Target = stmt.ShowCharset
case ast.ShowCollation:
oldShow.Target = stmt.ShowCollation
case ast.ShowColumns:
oldShow.Target = stmt.ShowColumns
case ast.ShowCreateTable:
oldShow.Target = stmt.ShowCreateTable
case ast.ShowDatabases:
oldShow.Target = stmt.ShowDatabases
case ast.ShowTables:
oldShow.Target = stmt.ShowTables
case ast.ShowEngines:
oldShow.Target = stmt.ShowEngines
case ast.ShowVariables:
oldShow.Target = stmt.ShowVariables
case ast.ShowStatus:
oldShow.Target = stmt.ShowStatus
case ast.ShowWarnings:
oldShow.Target = stmt.ShowWarnings
case ast.ShowNone:
oldShow.Target = stmt.ShowNone
}
return oldShow, nil
}