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

Function TestExecFailureWithArguments

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

Source from the content-addressed store, hash-verified

296}
297
298func TestExecFailureWithArguments(t *testing.T) {
299 t.Parallel()
300
301 ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
302 defer cancel()
303
304 pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
305 _, err := conn.Exec(context.Background(), "selct $1;", 1)
306 if err == nil {
307 t.Fatal("Expected SQL syntax error")
308 }
309 assert.False(t, pgconn.SafeToRetry(err))
310
311 _, err = conn.Exec(context.Background(), "select $1::varchar(1);", "1", "2")
312 require.Error(t, err)
313 })
314}
315
316func TestExecContextWithoutCancelation(t *testing.T) {
317 t.Parallel()

Callers

nothing calls this directly

Calls 4

RunWithQueryExecModesFunction · 0.92
SafeToRetryFunction · 0.92
ExecMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected