(t *testing.T)
| 1963 | } |
| 1964 | |
| 1965 | func TestConnExecBatchImplicitTransaction(t *testing.T) { |
| 1966 | t.Parallel() |
| 1967 | |
| 1968 | ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) |
| 1969 | defer cancel() |
| 1970 | |
| 1971 | pgConn, err := pgconn.Connect(ctx, os.Getenv("PGX_TEST_DATABASE")) |
| 1972 | require.NoError(t, err) |
| 1973 | defer closeConn(t, pgConn) |
| 1974 | |
| 1975 | if pgConn.ParameterStatus("crdb_version") != "" { |
| 1976 | t.Skip("Skipping due to known server issue: (https://github.com/cockroachdb/cockroach/issues/44803)") |
| 1977 | } |
| 1978 | |
| 1979 | _, err = pgConn.Exec(ctx, "create temporary table t(id int)").ReadAll() |
| 1980 | require.NoError(t, err) |
| 1981 | |
| 1982 | batch := &pgconn.Batch{} |
| 1983 | |
| 1984 | batch.ExecParams("insert into t(id) values(1)", nil, nil, nil, nil) |
| 1985 | batch.ExecParams("insert into t(id) values(2)", nil, nil, nil, nil) |
| 1986 | batch.ExecParams("insert into t(id) values(3)", nil, nil, nil, nil) |
| 1987 | batch.ExecParams("select 1/0", nil, nil, nil, nil) |
| 1988 | _, err = pgConn.ExecBatch(ctx, batch).ReadAll() |
| 1989 | require.Error(t, err) |
| 1990 | |
| 1991 | result := pgConn.ExecParams(ctx, "select count(*) from t", nil, nil, nil, nil).Read() |
| 1992 | require.Equal(t, "0", string(result.Rows[0][0])) |
| 1993 | } |
| 1994 | |
| 1995 | func TestConnLocking(t *testing.T) { |
| 1996 | t.Parallel() |
nothing calls this directly
no test coverage detected