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

Method WriteCommonCondition

pkg/ttl/sqlbuilder/sql.go:152–168  ·  view source on GitHub ↗

WriteCommonCondition writes a new condition

(cols []*model.ColumnInfo, op string, dp []types.Datum)

Source from the content-addressed store, hash-verified

150
151// WriteCommonCondition writes a new condition
152func (b *SQLBuilder) WriteCommonCondition(cols []*model.ColumnInfo, op string, dp []types.Datum) error {
153 switch b.state {
154 case writeSelOrDel:
155 b.restoreCtx.WritePlain(" WHERE ")
156 b.state = writeWhere
157 case writeWhere:
158 b.restoreCtx.WritePlain(" AND ")
159 default:
160 return errors.Errorf("invalid state: %v", b.state)
161 }
162
163 b.writeColNames(cols, len(cols) > 1)
164 b.restoreCtx.WritePlain(" ")
165 b.restoreCtx.WritePlain(op)
166 b.restoreCtx.WritePlain(" ")
167 return b.writeDataPoint(cols, dp)
168}
169
170// WriteExpireCondition writes a condition with the time column
171func (b *SQLBuilder) WriteExpireCondition(expire time.Time) error {

Callers 3

buildSQLMethod · 0.95
TestEscapeFunction · 0.95
TestSQLBuilderFunction · 0.95

Calls 4

writeColNamesMethod · 0.95
writeDataPointMethod · 0.95
WritePlainMethod · 0.80
ErrorfMethod · 0.65

Tested by 2

TestEscapeFunction · 0.76
TestSQLBuilderFunction · 0.76