MCPcopy Create free account
hub / github.com/araddon/qlbridge / TestSqlFingerPrinting

Function TestSqlFingerPrinting

rel/sql_test.go:361–375  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

359}
360
361func TestSqlFingerPrinting(t *testing.T) {
362 t.Parallel()
363 // Fingerprinting allows the select statement to have a cached plan regardless
364 // of prepared statement
365 sql1 := parseOrPanic(t, `SELECT name, item_id, email, price
366 FROM users WHERE user_id = "12345"`).(*rel.SqlSelect)
367 sql2 := parseOrPanic(t, `select name, ITEM_ID, email, price
368 FROM users WHERE user_id = "789456"`).(*rel.SqlSelect)
369 fw1 := expr.NewFingerPrinter()
370 fw2 := expr.NewFingerPrinter()
371 sql1.WriteDialect(fw1)
372 sql2.WriteDialect(fw2)
373 assert.Equal(t, fw1.String(), fw2.String())
374 assert.Equal(t, sql1.FingerPrintID(), sql2.FingerPrintID(), "Should have equal fingerprints")
375}

Callers

nothing calls this directly

Calls 6

NewFingerPrinterFunction · 0.92
parseOrPanicFunction · 0.85
WriteDialectMethod · 0.65
EqualMethod · 0.65
StringMethod · 0.65
FingerPrintIDMethod · 0.45

Tested by

no test coverage detected