mrproliu commented on code in PR #1209: URL: https://github.com/apache/skywalking-banyandb/pull/1209#discussion_r3541582451
########## pkg/bydbql/binder.go: ########## @@ -0,0 +1,310 @@ +// Licensed to Apache Software Foundation (ASF) under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Apache Software Foundation (ASF) licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package bydbql + +import ( + "fmt" + "math" + "time" + + modelv1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/model/v1" +) + +// BindParams binds positional parameters to the `?` placeholders in the parsed grammar, +// in their order of appearance in the query text. After a successful call, the grammar is +// indistinguishable from one parsed with literal values, so the transformer needs no +// placeholder awareness. Callers must invoke it before Transform even when params is empty, +// so a query holding unbound placeholders is rejected instead of silently misinterpreted. +// Parameter positions in error messages are 1-based. On error the grammar may be partially +// bound and must be discarded; binding is not retryable on the same grammar. +func BindParams(g *Grammar, params []*modelv1.TagValue) error { Review Comment: Added a `paramBound` bool for this for check the parameter already bound or not. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
