Exemple #1
0
// stripTrailing strips out trailing comments if any and puts them in a bind variable.
func stripTrailing(sql string, bindVariables map[string]interface{}) string {
	query, comments := sqlparser.SplitTrailingComments(sql)
	if comments != "" {
		bindVariables[trailingComment] = comments
		return query
	}
	return sql
}
Exemple #2
0
func newRequestContext(ctx context.Context, sql string, bindVars map[string]interface{}, keyspace string, tabletType topodatapb.TabletType, session *vtgatepb.Session, notInTransaction bool, options *querypb.ExecuteOptions, router *Router) *requestContext {
	query, comments := sqlparser.SplitTrailingComments(sql)
	return &requestContext{
		ctx:              ctx,
		sql:              query,
		comments:         comments,
		bindVars:         bindVars,
		keyspace:         keyspace,
		tabletType:       tabletType,
		session:          session,
		notInTransaction: notInTransaction,
		options:          options,
		router:           router,
	}
}