(t *testing.T)
| 359 | } |
| 360 | |
| 361 | func 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 | } |
nothing calls this directly
no test coverage detected