(ctx context.Context, b *Batch)
| 1103 | } |
| 1104 | |
| 1105 | func (c *Conn) sendBatchQueryExecModeCacheDescribe(ctx context.Context, b *Batch) (pbr *pipelineBatchResults) { |
| 1106 | if c.descriptionCache == nil { |
| 1107 | return &pipelineBatchResults{ctx: ctx, conn: c, err: errDisabledDescriptionCache, closed: true} |
| 1108 | } |
| 1109 | |
| 1110 | distinctNewQueries := []*pgconn.StatementDescription{} |
| 1111 | distinctNewQueriesIdxMap := make(map[string]int) |
| 1112 | |
| 1113 | for _, bi := range b.QueuedQueries { |
| 1114 | if bi.sd == nil { |
| 1115 | sd := c.descriptionCache.Get(bi.SQL) |
| 1116 | if sd != nil { |
| 1117 | bi.sd = sd |
| 1118 | } else { |
| 1119 | if idx, present := distinctNewQueriesIdxMap[bi.SQL]; present { |
| 1120 | bi.sd = distinctNewQueries[idx] |
| 1121 | } else { |
| 1122 | sd = &pgconn.StatementDescription{ |
| 1123 | SQL: bi.SQL, |
| 1124 | } |
| 1125 | distinctNewQueriesIdxMap[sd.SQL] = len(distinctNewQueries) |
| 1126 | distinctNewQueries = append(distinctNewQueries, sd) |
| 1127 | bi.sd = sd |
| 1128 | } |
| 1129 | } |
| 1130 | } |
| 1131 | } |
| 1132 | |
| 1133 | return c.sendBatchExtendedWithDescription(ctx, b, distinctNewQueries, c.descriptionCache) |
| 1134 | } |
| 1135 | |
| 1136 | func (c *Conn) sendBatchQueryExecModeDescribeExec(ctx context.Context, b *Batch) (pbr *pipelineBatchResults) { |
| 1137 | distinctNewQueries := []*pgconn.StatementDescription{} |
no test coverage detected