(
sql: string,
params: ReadonlyArray<unknown>
)
| 149 | const transforms: Array<TransformRows | undefined> = [] |
| 150 | const queryTexts: Array<string> = [] |
| 151 | |
| 152 | for (const original of statements) { |
| 153 | const statement = transformer === undefined |
| 154 | ? original |
| 155 | : yield* transformer(original, options.getClient(), fiber, span) |
| 156 | const [sql, params] = statement.compile() |
| 157 | queryTexts.push(sql) |
| 158 | transforms.push((statement as StatementWithTransformRows).transformRows) |
| 159 | prepared.push((yield* Cache.get(options.prepareCache, sql)).bind(...params)) |
| 160 | } |
| 161 | |
| 162 | for (const [key, value] of options.spanAttributes) { |
| 163 | span.attribute(key, value) |
| 164 | } |
| 165 | span.attribute(ATTR_DB_OPERATION_NAME, "batch") |
| 166 | span.attribute(ATTR_DB_QUERY_TEXT, queryTexts.join("; ")) |
| 167 | |
| 168 | // D1 batches execute on the binding directly and intentionally cannot participate in SqlClient transactions. |
| 169 | const responses = yield* Effect.tryPromise({ |
| 170 | try: () => |
| 171 | options.db.batch<Record<string, unknown>>(prepared).then((responses) => { |
no test coverage detected
searching dependent graphs…