本文整理汇总了Golang中github.com/youtube/vitess/go/vt/sqlparser.ParsedQuery类的典型用法代码示例。如果您正苦于以下问题:Golang ParsedQuery类的具体用法?Golang ParsedQuery怎么用?Golang ParsedQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ParsedQuery类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: read
func (tpc *TwoPC) read(ctx context.Context, conn *DBConn, pq *sqlparser.ParsedQuery, bindVars map[string]interface{}) (*sqltypes.Result, error) {
b, err := pq.GenerateQuery(bindVars)
if err != nil {
return nil, err
}
return conn.Exec(ctx, hack.String(b), 10000, false)
}
示例2: generateFinalSQL
func (qre *QueryExecutor) generateFinalSQL(parsedQuery *sqlparser.ParsedQuery, bindVars map[string]interface{}, buildStreamComment []byte) (string, error) {
bindVars["#maxLimit"] = qre.qe.maxResultSize.Get() + 1
sql, err := parsedQuery.GenerateQuery(bindVars)
if err != nil {
return "", NewTabletError(vtrpcpb.ErrorCode_BAD_INPUT, "%s", err)
}
if buildStreamComment != nil {
sql = append(sql, buildStreamComment...)
}
sql = restoreTrailing(sql, bindVars)
return hack.String(sql), nil
}
示例3: generateFinalSql
func (qe *QueryEngine) generateFinalSql(parsed_query *sqlparser.ParsedQuery, bindVars map[string]interface{}, listVars []sqltypes.Value, buildStreamComment []byte) string {
bindVars[MAX_RESULT_NAME] = qe.maxResultSize.Get() + 1
sql, err := parsed_query.GenerateQuery(bindVars, listVars)
if err != nil {
panic(NewTabletError(FAIL, "%s", err))
}
if buildStreamComment != nil {
sql = append(sql, buildStreamComment...)
}
// undo hack done by stripTrailing
sql = restoreTrailing(sql, bindVars)
return hack.String(sql)
}
示例4: generateFinalSql
func (rqc *RequestContext) generateFinalSql(parsedQuery *sqlparser.ParsedQuery, bindVars map[string]interface{}, buildStreamComment []byte) string {
bindVars["#maxLimit"] = rqc.qe.maxResultSize.Get() + 1
sql, err := parsedQuery.GenerateQuery(bindVars)
if err != nil {
panic(NewTabletError(FAIL, "%s", err))
}
if buildStreamComment != nil {
sql = append(sql, buildStreamComment...)
}
// undo hack done by stripTrailing
sql = restoreTrailing(sql, bindVars)
return hack.String(sql)
}