Skip to content

Commit 7aca628

Browse files
mydeaclaude
andauthored
feat(server-utils): Move to new getSqlQueryAttributes helper for consistency (#25927)
**Why:** `sanitizeSqlQueryWithSummary` grew a third value with `db.operation.name`, and every SQL integration copied the result into the same three attributes by hand. `getSqlQueryAttributes` returns them keyed by attribute name, so integrations spread it and the keys can't drift. The mysql2 diagnostics-channel subscriber and postgres.js drop their own operation regexes for the shared helper, so their `db.operation.name` keeps the statement's case and resolves CTEs like the other integrations (postgres.js still prefers the server-reported command once a query succeeds). postgres.js also no longer reports the sanitizer's `Unknown SQL Query` placeholder as `db.query.text` when there is no query; its public `requestHook` gets `''` in that case. **How to review:** Start with `utils/sql.ts`, then the Prisma tracing helper. Prisma keeps its own `db.query.text`/`db.operation.name` and only falls back to ours; `db.query.summary` is always ours, so the streamed span name stays dialect-aware across Prisma versions. Prisma 5 only reports `db.statement`, so its spans now also get a sanitized `db.query.text` (see the v5 test). Tedious clears the summary and operation name for procedure calls, as before. **Unsure about:** `@sentry/server-utils` exports the renamed helper, but the package is internal (no SemVer guarantee) and Nuxt pins it exactly, so I didn't keep an alias. Stacked on #25850. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent b52901e commit 7aca628

16 files changed

Lines changed: 205 additions & 219 deletions

File tree

‎dev-packages/node-integration-tests/suites/tracing/prisma-orm-v5/test.ts‎

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
DB_QUERY_SUMMARY,
3+
DB_QUERY_TEXT,
34
DB_STATEMENT,
45
DB_SYSTEM,
56
SENTRY_KIND,
@@ -15,6 +16,13 @@ afterAll(() => {
1516
cleanupChildProcesses();
1617
});
1718

19+
// Prisma 5 only reports the raw `db.statement`; `db.query.text` is the SDK's sanitized copy of it.
20+
const INSERT_USER_QUERY_TEXT =
21+
'INSERT INTO "public"."User" ("createdAt","email","name") VALUES ($1,$2,$3) RETURNING "public"."User"."id", "public"."User"."createdAt", "public"."User"."email", "public"."User"."name"';
22+
const SELECT_USER_QUERY_TEXT =
23+
'SELECT "public"."User"."id", "public"."User"."createdAt", "public"."User"."email", "public"."User"."name" FROM "public"."User" WHERE ?=? OFFSET $1';
24+
const DELETE_USER_QUERY_TEXT = 'DELETE FROM "public"."User" WHERE "public"."User"."email"::text LIKE $1';
25+
1826
const ADDITIONAL_DEPENDENCIES = {
1927
'@prisma/client': '5.22.0',
2028
prisma: '5.22.0',
@@ -82,6 +90,7 @@ function expectPrismaV5Spans(container: SerializedStreamedSpanContainer): void {
8290
expect.objectContaining({
8391
attributes: expect.objectContaining({
8492
[DB_STATEMENT]: { type: 'string', value: expect.stringContaining('INSERT INTO') },
93+
[DB_QUERY_TEXT]: { type: 'string', value: INSERT_USER_QUERY_TEXT },
8594
[DB_QUERY_SUMMARY]: { type: 'string', value: 'INSERT "public"."User"' },
8695
[DB_SYSTEM]: { type: 'string', value: 'postgresql' },
8796
[SENTRY_KIND]: { type: 'string', value: 'client' },
@@ -94,6 +103,7 @@ function expectPrismaV5Spans(container: SerializedStreamedSpanContainer): void {
94103
expect.objectContaining({
95104
attributes: expect.objectContaining({
96105
[DB_STATEMENT]: { type: 'string', value: expect.stringContaining('SELECT') },
106+
[DB_QUERY_TEXT]: { type: 'string', value: SELECT_USER_QUERY_TEXT },
97107
[DB_QUERY_SUMMARY]: { type: 'string', value: 'SELECT "public"."User"' },
98108
[DB_SYSTEM]: { type: 'string', value: 'postgresql' },
99109
[SENTRY_KIND]: { type: 'string', value: 'client' },
@@ -106,6 +116,7 @@ function expectPrismaV5Spans(container: SerializedStreamedSpanContainer): void {
106116
expect.objectContaining({
107117
attributes: expect.objectContaining({
108118
[DB_STATEMENT]: { type: 'string', value: expect.stringContaining('DELETE') },
119+
[DB_QUERY_TEXT]: { type: 'string', value: DELETE_USER_QUERY_TEXT },
109120
[DB_QUERY_SUMMARY]: { type: 'string', value: 'DELETE "public"."User"' },
110121
[DB_SYSTEM]: { type: 'string', value: 'postgresql' },
111122
[SENTRY_KIND]: { type: 'string', value: 'client' },
@@ -124,15 +135,16 @@ function expectPrismaV5Spans(container: SerializedStreamedSpanContainer): void {
124135
querySpans.map(span => ({
125136
name: span.name,
126137
summary: span.attributes[DB_QUERY_SUMMARY]?.value,
138+
text: span.attributes[DB_QUERY_TEXT]?.value,
127139
})),
128140
).toEqual([
129-
{ name: 'INSERT "public"."User"', summary: 'INSERT "public"."User"' },
130-
{ name: 'SELECT "public"."User"', summary: 'SELECT "public"."User"' },
131-
{ name: 'BEGIN', summary: 'BEGIN' },
132-
{ name: 'INSERT "public"."User"', summary: 'INSERT "public"."User"' },
133-
{ name: 'SELECT "public"."User"', summary: 'SELECT "public"."User"' },
134-
{ name: 'COMMIT', summary: 'COMMIT' },
135-
{ name: 'DELETE "public"."User"', summary: 'DELETE "public"."User"' },
141+
{ name: 'INSERT "public"."User"', summary: 'INSERT "public"."User"', text: INSERT_USER_QUERY_TEXT },
142+
{ name: 'SELECT "public"."User"', summary: 'SELECT "public"."User"', text: SELECT_USER_QUERY_TEXT },
143+
{ name: 'BEGIN', summary: 'BEGIN', text: 'BEGIN' },
144+
{ name: 'INSERT "public"."User"', summary: 'INSERT "public"."User"', text: INSERT_USER_QUERY_TEXT },
145+
{ name: 'SELECT "public"."User"', summary: 'SELECT "public"."User"', text: SELECT_USER_QUERY_TEXT },
146+
{ name: 'COMMIT', summary: 'COMMIT', text: 'COMMIT' },
147+
{ name: 'DELETE "public"."User"', summary: 'DELETE "public"."User"', text: DELETE_USER_QUERY_TEXT },
136148
]);
137149

138150
// The raw engine span name must never leak through.

‎packages/nuxt/src/runtime/utils/instrumentDatabase.ts‎

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,10 @@ import {
1313
type StartSpanOptions,
1414
} from '@sentry/core';
1515
import { flushIfServerless } from '@sentry/core/server';
16-
import { sanitizeSqlQuery, sanitizeSqlQueryWithSummary, type SqlDialect } from '@sentry/server-utils';
16+
import { getSqlQueryAttributes, sanitizeSqlQuery, type SqlDialect } from '@sentry/server-utils';
1717
import type { Database, PreparedStatement } from 'db0';
1818
import { type DatabaseConnectionConfig, type DatabaseSpanData, getDatabaseSpanData } from './database-span-data';
19-
import {
20-
DB_NAMESPACE,
21-
DB_OPERATION_NAME,
22-
DB_QUERY_SUMMARY,
23-
DB_QUERY_TEXT,
24-
DB_SYSTEM_NAME,
25-
} from '@sentry/conventions/attributes';
19+
import { DB_NAMESPACE, DB_QUERY_SUMMARY, DB_QUERY_TEXT, DB_SYSTEM_NAME } from '@sentry/conventions/attributes';
2620

2721
type MaybeInstrumentedDatabase = Database & {
2822
__sentry_instrumented__?: boolean;
@@ -267,20 +261,18 @@ function createStartSpanOptions(
267261
data: DatabaseSpanData,
268262
dialect: SqlDialect | undefined,
269263
): StartSpanOptions {
270-
const { queryText, querySummary, operationName } = sanitizeSqlQueryWithSummary(query, dialect);
264+
const queryAttributes = getSqlQueryAttributes(query, dialect);
271265

272266
const client = getClient();
273267
const name =
274268
client && hasSpanStreamingEnabled(client)
275-
? querySummary || (data[DB_NAMESPACE] as string | undefined) || DB_SPAN_NAME_FALLBACK
276-
: (queryText ?? DB_SPAN_NAME_FALLBACK);
269+
? queryAttributes[DB_QUERY_SUMMARY] || (data[DB_NAMESPACE] as string | undefined) || DB_SPAN_NAME_FALLBACK
270+
: (queryAttributes[DB_QUERY_TEXT] ?? DB_SPAN_NAME_FALLBACK);
277271

278272
return {
279273
name,
280274
attributes: {
281-
[DB_QUERY_TEXT]: queryText,
282-
[DB_QUERY_SUMMARY]: querySummary,
283-
[DB_OPERATION_NAME]: operationName,
275+
...queryAttributes,
284276
[SENTRY_ORIGIN]: NUXT_DATABASE_ORIGIN,
285277
[SENTRY_OP]: DB_QUERY,
286278
...data,

‎packages/server-utils/src/exports.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export type { ServerRequestHandlerConfig } from './utils/wrapServerRequestHandle
55
export { setAsyncLocalStorageAsyncContextStrategy } from './async-context';
66
export { openTelemetryIntegration, getOtlpTracesEndpoint } from './opentelemetry';
77
export * from './ai';
8-
export { getSqlQuerySummary, sanitizeSqlQuery, sanitizeSqlQueryWithSummary } from './utils/sql';
8+
export { getSqlQuerySummary, sanitizeSqlQuery, getSqlQueryAttributes } from './utils/sql';
99
export type { SqlDialect } from './utils/sql';
1010
export { instrumentPostgresJsSql } from './integrations/postgresjs';
1111
export type { PostgresConnectionContext } from './integrations/postgresjs';

‎packages/server-utils/src/integrations/knex.ts‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { DEBUG_BUILD } from '../debug-build';
3434
import type { OrchestrionChannelContext } from '../orchestrion/types';
3535
import { CHANNELS } from '../orchestrion/channels';
3636
import { bindTracingChannelToSpan } from '../tracing-channel';
37-
import { sanitizeSqlQueryWithSummary, toSqlDialect } from '../utils/sql';
37+
import { getSqlQueryAttributes, toSqlDialect } from '../utils/sql';
3838

3939
// NOTE: this uses the same name as the OTel integration by design. `@sentry/node`'s `knexIntegration`
4040
// picks this subscriber over the vendored OTel path when orchestrion injection is active.
@@ -165,14 +165,15 @@ function subscribeQuery(): void {
165165
const dbSystem = mapSystem(client?.driverName);
166166

167167
const dialect = toSqlDialect(client?.driverName);
168-
const { queryText: dbStatement, querySummary } = sanitizeSqlQueryWithSummary(
168+
const queryAttributes = getSqlQueryAttributes(
169169
query?.sql ? truncate(query.sql, MAX_QUERY_LENGTH) : undefined,
170170
dialect,
171171
);
172172
const attributes: SpanAttributes = {
173173
[SENTRY_OP]: DB,
174174
[SENTRY_KIND]: 'client',
175175
[SENTRY_ORIGIN]: ORIGIN,
176+
...queryAttributes,
176177
'knex.version': data.moduleVersion,
177178
[DB_SYSTEM_NAME]: dbSystem,
178179
[ATTR_DB_SQL_TABLE]: table,
@@ -182,15 +183,13 @@ function subscribeQuery(): void {
182183
[SERVER_ADDRESS]: connection?.host ?? extractHostFromConnectionString(connectionString),
183184
[SERVER_PORT]: connection?.port ?? extractPortFromConnectionString(connectionString),
184185
[NETWORK_TRANSPORT]: connection?.filename === ':memory:' ? 'inproc' : undefined,
185-
[DB_QUERY_TEXT]: dbStatement,
186-
[DB_QUERY_SUMMARY]: querySummary,
187186
};
188187

189188
const sentryClient = getClient();
190189
const spanName =
191190
sentryClient && hasSpanStreamingEnabled(sentryClient)
192-
? querySummary || getSecondaryStreamName(dbSystem, dbNameSpace, operation, table)
193-
: (dbStatement ?? getName(dbNameSpace, operation, table) ?? 'knex.query');
191+
? queryAttributes[DB_QUERY_SUMMARY] || getSecondaryStreamName(dbSystem, dbNameSpace, operation, table)
192+
: (queryAttributes[DB_QUERY_TEXT] ?? getName(dbNameSpace, operation, table) ?? 'knex.query');
194193

195194
return startInactiveSpan({
196195
name: spanName,

‎packages/server-utils/src/integrations/mysql.ts‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as diagnosticsChannel from '../utils/diagnosticsChannel';
22
import {
33
DB_NAMESPACE,
4-
DB_OPERATION_NAME,
54
DB_QUERY_SUMMARY,
65
DB_QUERY_TEXT,
76
DB_SYSTEM_NAME,
@@ -24,7 +23,7 @@ import {
2423
hasSpanStreamingEnabled,
2524
startInactiveSpan,
2625
} from '@sentry/core';
27-
import { sanitizeSqlQueryWithSummary } from '../utils/sql';
26+
import { getSqlQueryAttributes } from '../utils/sql';
2827
import type { OrchestrionChannelContext } from '../orchestrion/types';
2928
import { CHANNELS } from '../orchestrion/channels';
3029
import { bindTracingChannelToSpan } from '../tracing-channel';
@@ -82,13 +81,13 @@ function instrumentMysql(): void {
8281
// handler with the caller's context lost. `deferSpanEnd` replays this scope onto the emitter.
8382
data._sentryCallerScope = getCurrentScope();
8483

85-
const { queryText, querySummary, operationName } = sanitizeSqlQueryWithSummary(sql, 'mysql');
84+
const queryAttributes = getSqlQueryAttributes(sql, 'mysql');
8685

8786
const client = getClient();
8887
const name =
8988
client && hasSpanStreamingEnabled(client)
90-
? querySummary || database || DB_SYSTEM_NAME_VALUE_MYSQL
91-
: (queryText ?? 'mysql.query');
89+
? queryAttributes[DB_QUERY_SUMMARY] || database || DB_SYSTEM_NAME_VALUE_MYSQL
90+
: (queryAttributes[DB_QUERY_TEXT] ?? 'mysql.query');
9291

9392
return startInactiveSpan({
9493
name,
@@ -101,9 +100,7 @@ function instrumentMysql(): void {
101100
[DB_CONNECTION_STRING]: getJDBCString(host, portIsNumber ? portNumber : undefined, database),
102101
[DB_NAMESPACE]: database,
103102
[DB_USER]: user,
104-
[DB_QUERY_TEXT]: queryText,
105-
[DB_QUERY_SUMMARY]: querySummary,
106-
[DB_OPERATION_NAME]: operationName,
103+
...queryAttributes,
107104
[SERVER_ADDRESS]: host,
108105
[SERVER_PORT]: portIsNumber ? portNumber : undefined,
109106
},

‎packages/server-utils/src/integrations/mysql2/index.ts‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
startInactiveSpan,
99
waitForTracingChannelBinding,
1010
} from '@sentry/core';
11-
import { sanitizeSqlQueryWithSummary } from '../../utils/sql';
11+
import { getSqlQueryAttributes } from '../../utils/sql';
1212
import { subscribeMysql2DiagnosticChannels } from './mysql2-dc-subscriber';
1313
import type { OrchestrionChannelContext } from '../../orchestrion/types';
1414
import type { ChannelName } from '../../orchestrion/channels';
@@ -18,7 +18,6 @@ import { mysql2ModuleNames } from '../../orchestrion/config/mysql2';
1818
import { invokeOrchestrionInstrumentation } from '../../orchestrion/instrumentation';
1919
import {
2020
DB_NAMESPACE,
21-
DB_OPERATION_NAME,
2221
DB_QUERY_SUMMARY,
2322
DB_QUERY_TEXT,
2423
DB_SYSTEM_NAME,
@@ -78,13 +77,15 @@ function subscribeQueryChannel(channelName: ChannelName): void {
7877
bindTracingChannelToSpan(diagnosticsChannel.tracingChannel<Mysql2QueryChannelContext>(channelName), data => {
7978
const statement = getQueryText(data.arguments);
8079
const connectionAttributes = getConnectionAttributes(data.self?.config);
81-
const { queryText, querySummary, operationName } = sanitizeSqlQueryWithSummary(statement, 'mysql');
80+
const queryAttributes = getSqlQueryAttributes(statement, 'mysql');
8281

8382
const client = getClient();
8483
const name =
8584
client && hasSpanStreamingEnabled(client)
86-
? querySummary || (connectionAttributes[DB_NAMESPACE] as string | undefined) || DB_SYSTEM_VALUE_MYSQL
87-
: (queryText ?? 'mysql2.query');
85+
? queryAttributes[DB_QUERY_SUMMARY] ||
86+
(connectionAttributes[DB_NAMESPACE] as string | undefined) ||
87+
DB_SYSTEM_VALUE_MYSQL
88+
: (queryAttributes[DB_QUERY_TEXT] ?? 'mysql2.query');
8889

8990
return startInactiveSpan({
9091
name,
@@ -94,9 +95,7 @@ function subscribeQueryChannel(channelName: ChannelName): void {
9495
[SENTRY_ORIGIN]: ORIGIN,
9596
[SENTRY_OP]: DB,
9697
[DB_SYSTEM_NAME]: DB_SYSTEM_VALUE_MYSQL,
97-
[DB_QUERY_TEXT]: queryText || undefined,
98-
[DB_QUERY_SUMMARY]: querySummary,
99-
[DB_OPERATION_NAME]: operationName,
98+
...queryAttributes,
10099
...connectionAttributes,
101100
},
102101
});

‎packages/server-utils/src/integrations/mysql2/mysql2-dc-subscriber.ts‎

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { TracingChannel } from 'node:diagnostics_channel';
22
import {
33
DB_NAMESPACE,
4-
DB_OPERATION_NAME,
54
DB_QUERY_SUMMARY,
65
DB_QUERY_TEXT,
76
DB_SYSTEM_NAME,
@@ -13,7 +12,7 @@ import {
1312
import { DB } from '@sentry/conventions/op';
1413
import { getClient, hasSpanStreamingEnabled, startInactiveSpan } from '@sentry/core';
1514
import { bindTracingChannelToSpan } from '../../tracing-channel';
16-
import { sanitizeSqlQueryWithSummary } from '../../utils/sql';
15+
import { getSqlQueryAttributes } from '../../utils/sql';
1716

1817
// Channel names published by mysql2 >= 3.20.0 (see mysql2 `lib/tracing.js`).
1918
// Hardcoded so the subscriber does not have to import mysql2 — the channels
@@ -26,9 +25,6 @@ export const MYSQL2_DC_CHANNEL_POOL_CONNECT = 'mysql2:pool:connect';
2625
const ORIGIN = 'auto.db.mysql2.native_channel';
2726
const DB_SYSTEM_NAME_VALUE_MYSQL = 'mysql';
2827

29-
// Leading keyword of a SQL statement (SELECT, INSERT, …) → `db.operation.name`.
30-
const SQL_OPERATION_RE = /^\s*(\w+)/;
31-
3228
/**
3329
* Shape of the context object mysql2 >= 3.20.0 publishes on its query/execute
3430
* tracing channels (see mysql2 `lib/base/connection.js`).
@@ -96,14 +92,13 @@ function setupQueryChannel(tracingChannel: MySQL2TracingChannelFactory, channelN
9692
// mysql2 does not sanitize its channel payload, so the statement may carry
9793
// raw user values (on the `query` channel they are inlined). Strip every
9894
// literal before it leaves the process; `values` is never attached.
99-
const { queryText, querySummary } = sanitizeSqlQueryWithSummary(data.query, 'mysql');
100-
const operation = queryText?.match(SQL_OPERATION_RE)?.[1]?.toUpperCase();
95+
const queryAttributes = getSqlQueryAttributes(data.query, 'mysql');
10196

10297
const client = getClient();
10398
const name =
10499
client && hasSpanStreamingEnabled(client)
105-
? querySummary || data.database || DB_SYSTEM_NAME_VALUE_MYSQL
106-
: queryText || 'mysql2.query';
100+
? queryAttributes[DB_QUERY_SUMMARY] || data.database || DB_SYSTEM_NAME_VALUE_MYSQL
101+
: (queryAttributes[DB_QUERY_TEXT] ?? 'mysql2.query');
107102

108103
return startInactiveSpan({
109104
name,
@@ -112,9 +107,7 @@ function setupQueryChannel(tracingChannel: MySQL2TracingChannelFactory, channelN
112107
[SENTRY_ORIGIN]: ORIGIN,
113108
[SENTRY_OP]: DB,
114109
[DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_MYSQL,
115-
[DB_QUERY_TEXT]: queryText,
116-
[DB_QUERY_SUMMARY]: querySummary,
117-
[DB_OPERATION_NAME]: operation,
110+
...queryAttributes,
118111
[DB_NAMESPACE]: data.database || undefined,
119112
[SERVER_ADDRESS]: data.serverAddress,
120113
[SERVER_PORT]: data.serverPort,

‎packages/server-utils/src/integrations/neon.ts‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
import { DB } from '@sentry/conventions/op';
1313
import type { IntegrationFn, Span } from '@sentry/core';
1414
import { defineIntegration, getActiveSpan, startInactiveSpan } from '@sentry/core';
15-
import { sanitizeSqlQueryWithSummary } from '../utils/sql';
15+
import { getSqlQueryAttributes } from '../utils/sql';
1616
import { CHANNELS } from '../orchestrion/channels';
1717
import { neonModuleNames } from '../orchestrion/config/neon';
1818
import { invokeOrchestrionInstrumentation } from '../orchestrion/instrumentation';
@@ -99,10 +99,11 @@ function httpQuerySpanOptions(args: unknown[]): Parameters<typeof startInactiveS
9999
const statements = (Array.isArray(queryData) ? queryData : [queryData])
100100
.map(getQueryText)
101101
.filter((text): text is string => !!text)
102-
.map(text => sanitizeSqlQueryWithSummary(text));
103-
const queryText = joinDefined(statements.map(s => s.queryText));
104-
const querySummary = joinDefined(statements.map(s => s.querySummary));
105-
const operationName = batchSize === undefined ? statements[0]?.operationName : getBatchOperationName(statements);
102+
.map(text => getSqlQueryAttributes(text));
103+
const queryText = joinDefined(statements.map(s => s[DB_QUERY_TEXT]));
104+
const querySummary = joinDefined(statements.map(s => s[DB_QUERY_SUMMARY]));
105+
const operationName =
106+
batchSize === undefined ? statements[0]?.[DB_OPERATION_NAME] : getBatchOperationName(statements);
106107
const name = querySummary || DB_SYSTEM_POSTGRESQL;
107108

108109
return {
@@ -122,8 +123,8 @@ function httpQuerySpanOptions(args: unknown[]): Parameters<typeof startInactiveS
122123
}
123124

124125
// OTel names a batch `BATCH <op>` when every statement shares one operation, plain `BATCH` otherwise.
125-
function getBatchOperationName(statements: { operationName: string | undefined }[]): string {
126-
const operations = new Set(statements.map(s => s.operationName?.toUpperCase()));
126+
function getBatchOperationName(statements: ReturnType<typeof getSqlQueryAttributes>[]): string {
127+
const operations = new Set(statements.map(s => s[DB_OPERATION_NAME]?.toUpperCase()));
127128
const [operation] = operations;
128129
return operations.size === 1 && operation ? `BATCH ${operation}` : 'BATCH';
129130
}

0 commit comments

Comments
 (0)