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

Function TestConnSendBatchReadMoreResultsThanQueriesSent

batch_test.go:315–334  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

313}
314
315func 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
336func TestConnSendBatchWithPreparedStatement(t *testing.T) {
337 t.Parallel()

Callers

nothing calls this directly

Calls 6

QueueMethod · 0.95
RunWithQueryExecModesFunction · 0.92
SendBatchMethod · 0.65
ExecMethod · 0.65
CloseMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected