本文整理匯總了Golang中github.com/youtube/vitess/go/vt/sqlparser.ParsedQuery.GenerateQuery方法的典型用法代碼示例。如果您正苦於以下問題:Golang ParsedQuery.GenerateQuery方法的具體用法?Golang ParsedQuery.GenerateQuery怎麽用?Golang ParsedQuery.GenerateQuery使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/youtube/vitess/go/vt/sqlparser.ParsedQuery
的用法示例。
在下文中一共展示了ParsedQuery.GenerateQuery方法的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)
}