@@ -191,11 +191,15 @@ func (tx *Transaction) txControl() *queryTx.Control {
191
191
)
192
192
}
193
193
194
- func (tx * Transaction ) Exec (ctx context.Context , q string , opts ... options.Execute ) (
195
- finalErr error ,
196
- ) {
194
+ func (tx * Transaction ) Exec (ctx context.Context , q string , opts ... options.Execute ) (finalErr error ) {
195
+ settings := options .ExecuteSettings (opts ... )
197
196
onDone := trace .QueryOnTxExec (tx .s .trace , & ctx ,
198
- stack .FunctionID ("github.com/ydb-platform/ydb-go-sdk/v3/internal/query.(*Transaction).Exec" ), tx .s , tx , q )
197
+ stack .FunctionID ("github.com/ydb-platform/ydb-go-sdk/v3/internal/query.(*Transaction).Exec" ),
198
+ tx .s ,
199
+ tx ,
200
+ q ,
201
+ settings .Label (),
202
+ )
199
203
defer func () {
200
204
onDone (finalErr )
201
205
}()
@@ -204,7 +208,7 @@ func (tx *Transaction) Exec(ctx context.Context, q string, opts ...options.Execu
204
208
return xerrors .WithStackTrace (errExecuteOnCompletedTx )
205
209
}
206
210
207
- settings , err := tx .executeSettings (opts ... )
211
+ txSettings , err := tx .executeSettings (opts ... )
208
212
if err != nil {
209
213
return xerrors .WithStackTrace (err )
210
214
}
@@ -215,7 +219,7 @@ func (tx *Transaction) Exec(ctx context.Context, q string, opts ...options.Execu
215
219
tx .SetTxID (txMeta .GetId ())
216
220
}),
217
221
}
218
- if settings .TxControl ().Commit () {
222
+ if txSettings .TxControl ().Commit () {
219
223
err = tx .waitOnBeforeCommit (ctx )
220
224
if err != nil {
221
225
return err
@@ -230,7 +234,7 @@ func (tx *Transaction) Exec(ctx context.Context, q string, opts ...options.Execu
230
234
)
231
235
}
232
236
233
- r , err := tx .s .execute (ctx , q , settings , resultOpts ... )
237
+ r , err := tx .s .execute (ctx , q , txSettings , resultOpts ... )
234
238
if err != nil {
235
239
return xerrors .WithStackTrace (err )
236
240
}
@@ -263,11 +267,15 @@ func (tx *Transaction) executeSettings(opts ...options.Execute) (_ executeSettin
263
267
}, opts ... )... ), nil
264
268
}
265
269
266
- func (tx * Transaction ) Query (ctx context.Context , q string , opts ... options.Execute ) (
267
- _ query.Result , finalErr error ,
268
- ) {
270
+ func (tx * Transaction ) Query (ctx context.Context , q string , opts ... options.Execute ) (_ query.Result , finalErr error ) {
271
+ settings := options .ExecuteSettings (opts ... )
269
272
onDone := trace .QueryOnTxQuery (tx .s .trace , & ctx ,
270
- stack .FunctionID ("github.com/ydb-platform/ydb-go-sdk/v3/internal/query.(*Transaction).Query" ), tx .s , tx , q )
273
+ stack .FunctionID ("github.com/ydb-platform/ydb-go-sdk/v3/internal/query.(*Transaction).Query" ),
274
+ tx .s ,
275
+ tx ,
276
+ q ,
277
+ settings .Label (),
278
+ )
271
279
defer func () {
272
280
onDone (finalErr )
273
281
}()
@@ -276,7 +284,7 @@ func (tx *Transaction) Query(ctx context.Context, q string, opts ...options.Exec
276
284
return nil , xerrors .WithStackTrace (errExecuteOnCompletedTx )
277
285
}
278
286
279
- settings , err := tx .executeSettings (opts ... )
287
+ txSettings , err := tx .executeSettings (opts ... )
280
288
if err != nil {
281
289
return nil , xerrors .WithStackTrace (err )
282
290
}
@@ -287,7 +295,7 @@ func (tx *Transaction) Query(ctx context.Context, q string, opts ...options.Exec
287
295
tx .SetTxID (txMeta .GetId ())
288
296
}),
289
297
}
290
- if settings .TxControl ().Commit () {
298
+ if txSettings .TxControl ().Commit () {
291
299
err = tx .waitOnBeforeCommit (ctx )
292
300
if err != nil {
293
301
return nil , err
@@ -301,7 +309,7 @@ func (tx *Transaction) Query(ctx context.Context, q string, opts ...options.Exec
301
309
}),
302
310
)
303
311
}
304
- r , err := tx .s .execute (ctx , q , settings , resultOpts ... )
312
+ r , err := tx .s .execute (ctx , q , txSettings , resultOpts ... )
305
313
if err != nil {
306
314
return nil , xerrors .WithStackTrace (err )
307
315
}
0 commit comments