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

Function TestPrepareWithDigestedName

conn_test.go:597–617  ·  conn_test.go::TestPrepareWithDigestedName
(t *testing.T)

Source from the content-addressed store, hash-verified

595}
596
597func TestPrepareWithDigestedName(t *testing.T) {
598 t.Parallel()
599
600 ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
601 defer cancel()
602
603 pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
604 sql := "select $1::text"
605 sd, err := conn.Prepare(ctx, sql, sql)
606 require.NoError(t, err)
607 require.Equal(t, "stmt_2510cc7db17de3f42758a2a29c8b9ef8305d007b997ebdd6", sd.Name)
608
609 var s string
610 err = conn.QueryRow(ctx, sql, "hello").Scan(&s)
611 require.NoError(t, err)
612 require.Equal(t, "hello", s)
613
614 err = conn.Deallocate(ctx, sql)
615 require.NoError(t, err)
616 })
617}
618
619// https://github.com/jackc/pgx/pull/1795
620func TestDeallocateInAbortedTransaction(t *testing.T) {

Callers

nothing calls this directly

Calls 5

RunWithQueryExecModesFunction · 0.92
PrepareMethod · 0.65
ScanMethod · 0.65
QueryRowMethod · 0.65
DeallocateMethod · 0.45

Tested by

no test coverage detected