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

Function TestFormatSQLDatum

pkg/ttl/sqlbuilder/sql_test.go:168–391  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

166}
167
168func TestFormatSQLDatum(t *testing.T) {
169 // invalid pk types contains the types that should not exist in primary keys of a TTL table.
170 // We do not need to check sqlbuilder.FormatSQLDatum for these types
171 invalidPKTypes := []struct {
172 types []string
173 err *terror.Error
174 }{
175 {
176 types: []string{"json"},
177 err: dbterror.ErrJSONUsedAsKey,
178 },
179 {
180 types: []string{"blob"},
181 err: dbterror.ErrBlobKeyWithoutLength,
182 },
183 {
184 types: []string{"blob(8)"},
185 err: dbterror.ErrBlobKeyWithoutLength,
186 },
187 {
188 types: []string{"text"},
189 err: dbterror.ErrBlobKeyWithoutLength,
190 },
191 {
192 types: []string{"text(8)"},
193 err: dbterror.ErrBlobKeyWithoutLength,
194 },
195 {
196 types: []string{"int", "json"},
197 err: dbterror.ErrJSONUsedAsKey,
198 },
199 {
200 types: []string{"int", "blob"},
201 err: dbterror.ErrBlobKeyWithoutLength,
202 },
203 {
204 types: []string{"int", "text"},
205 err: dbterror.ErrBlobKeyWithoutLength,
206 },
207 {
208 types: []string{"float"},
209 err: dbterror.ErrUnsupportedPrimaryKeyTypeWithTTL,
210 },
211 {
212 types: []string{"double"},
213 err: dbterror.ErrUnsupportedPrimaryKeyTypeWithTTL,
214 },
215 {
216 types: []string{"int", "float"},
217 err: dbterror.ErrUnsupportedPrimaryKeyTypeWithTTL,
218 },
219 {
220 types: []string{"int", "double"},
221 err: dbterror.ErrUnsupportedPrimaryKeyTypeWithTTL,
222 },
223 }
224
225 cases := []struct {

Callers

nothing calls this directly

Calls 15

MustExecMethod · 0.95
MustGetDBErrorMethod · 0.95
SessionMethod · 0.95
MustQueryMethod · 0.95
CreateMockStoreAndDomainFunction · 0.92
NewTestKitFunction · 0.92
DrainRecordSetFunction · 0.92
FormatSQLDatumFunction · 0.92
RowsFunction · 0.92
InfoSchemaMethod · 0.80
GetDatumMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…