MCPcopy Create free account
hub / github.com/pingcap/tidb / writeDataPoint

Method writeDataPoint

pkg/ttl/sqlbuilder/sql.go:277–304  ·  view source on GitHub ↗
(cols []*model.ColumnInfo, dp []types.Datum)

Source from the content-addressed store, hash-verified

275}
276
277func (b *SQLBuilder) writeDataPoint(cols []*model.ColumnInfo, dp []types.Datum) error {
278 writeBrackets := len(cols) > 1
279 if len(cols) != len(dp) {
280 return errors.Errorf("col count not match %d != %d", len(cols), len(dp))
281 }
282
283 if writeBrackets {
284 b.restoreCtx.WritePlain("(")
285 }
286
287 first := true
288 for i, d := range dp {
289 if first {
290 first = false
291 } else {
292 b.restoreCtx.WritePlain(", ")
293 }
294 if err := writeDatum(b.restoreCtx, d, &cols[i].FieldType); err != nil {
295 return err
296 }
297 }
298
299 if writeBrackets {
300 b.restoreCtx.WritePlain(")")
301 }
302
303 return nil
304}
305
306// ScanQueryGenerator generates SQLs for scan task
307type ScanQueryGenerator struct {

Callers 2

WriteCommonConditionMethod · 0.95
WriteInConditionMethod · 0.95

Calls 3

writeDatumFunction · 0.85
WritePlainMethod · 0.80
ErrorfMethod · 0.65

Tested by

no test coverage detected