MCPcopy
hub / github.com/jackc/pgx / TestPrepareStatementCacheModes

Function TestPrepareStatementCacheModes

conn_test.go:580–595  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

578}
579
580func TestPrepareStatementCacheModes(t *testing.T) {
581 t.Parallel()
582
583 ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
584 defer cancel()
585
586 pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
587 _, err := conn.Prepare(context.Background(), "test", "select $1::text")
588 require.NoError(t, err)
589
590 var s string
591 err = conn.QueryRow(context.Background(), "test", "hello").Scan(&s)
592 require.NoError(t, err)
593 require.Equal(t, "hello", s)
594 })
595}
596
597func TestPrepareWithDigestedName(t *testing.T) {
598 t.Parallel()

Callers

nothing calls this directly

Calls 4

RunWithQueryExecModesFunction · 0.92
PrepareMethod · 0.65
ScanMethod · 0.65
QueryRowMethod · 0.65

Tested by

no test coverage detected