Пример #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
}
Пример #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,
	}
}