| 313 | } |
| 314 | |
| 315 | func TestConnSendBatchReadMoreResultsThanQueriesSent(t *testing.T) { |
| 316 | t.Parallel() |
| 317 | |
| 318 | ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) |
| 319 | defer cancel() |
| 320 | |
| 321 | pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) { |
| 322 | batch := &pgx.Batch{} |
| 323 | batch.Queue("select 1") |
| 324 | br := conn.SendBatch(ctx, batch) |
| 325 | commandTag, err := br.Exec() |
| 326 | require.Equal(t, "SELECT 1", commandTag.String()) |
| 327 | require.NoError(t, err) |
| 328 | commandTag, err = br.Exec() |
| 329 | require.Equal(t, "", commandTag.String()) |
| 330 | require.EqualError(t, err, "no more results in batch") |
| 331 | err = br.Close() |
| 332 | require.NoError(t, err) |
| 333 | }) |
| 334 | } |
| 335 | |
| 336 | func TestConnSendBatchWithPreparedStatement(t *testing.T) { |
| 337 | t.Parallel() |