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

Method sendBatchQueryExecModeExec

conn.go:1039–1071  ·  view source on GitHub ↗
(ctx context.Context, b *Batch)

Source from the content-addressed store, hash-verified

1037}
1038
1039func (c *Conn) sendBatchQueryExecModeExec(ctx context.Context, b *Batch) *batchResults {
1040 batch := &pgconn.Batch{}
1041
1042 for _, bi := range b.QueuedQueries {
1043 sd := bi.sd
1044 if sd != nil {
1045 err := c.eqb.Build(c.typeMap, sd, bi.Arguments)
1046 if err != nil {
1047 return &batchResults{ctx: ctx, conn: c, err: err}
1048 }
1049
1050 batch.ExecPrepared(sd.Name, c.eqb.ParamValues, c.eqb.ParamFormats, c.eqb.ResultFormats)
1051 } else {
1052 err := c.eqb.Build(c.typeMap, nil, bi.Arguments)
1053 if err != nil {
1054 return &batchResults{ctx: ctx, conn: c, err: err}
1055 }
1056 batch.ExecParams(bi.SQL, c.eqb.ParamValues, nil, c.eqb.ParamFormats, c.eqb.ResultFormats)
1057 }
1058 }
1059
1060 c.eqb.reset() // Allow c.eqb internal memory to be GC'ed as soon as possible.
1061
1062 mrr := c.pgConn.ExecBatch(ctx, batch)
1063
1064 return &batchResults{
1065 ctx: ctx,
1066 conn: c,
1067 mrr: mrr,
1068 b: b,
1069 qqIdx: 0,
1070 }
1071}
1072
1073func (c *Conn) sendBatchQueryExecModeCacheStatement(ctx context.Context, b *Batch) (pbr *pipelineBatchResults) {
1074 if c.statementCache == nil {

Callers 1

SendBatchMethod · 0.95

Calls 5

ExecPreparedMethod · 0.95
ExecParamsMethod · 0.95
BuildMethod · 0.80
resetMethod · 0.80
ExecBatchMethod · 0.80

Tested by

no test coverage detected