@@ -352,7 +352,7 @@ Connection Methods
352
352
explicitly closed using the function :meth: `~Connection.close() `, the
353
353
subscription will not be deregistered in the database.
354
354
355
- .. method :: Connection.tpc_begin(xid, flags)
355
+ .. method :: Connection.tpc_begin(xid, flags, timeout )
356
356
357
357
Begins a Two-Phase Commit (TPC) on a global transaction using the specified
358
358
transaction identifier (xid).
@@ -364,10 +364,19 @@ Connection Methods
364
364
:data: `oracledb.TPC_BEGIN_NEW `, :data: `oracledb.TPC_BEGIN_PROMOTE `, or
365
365
:data: `oracledb.TPC_BEGIN_RESUME `. The default is :data: `oracledb.TPC_BEGIN_NEW `.
366
366
367
+ The ``timeout ``parameter is the number of seconds to wait for a transaction to
368
+ become available for resumption when :data:`~oracledb.TPC_BEGIN_RESUME` is
369
+ specified in the ``flags `` parameter. When :data: `~oracledb.TPC_BEGIN_NEW ` is
370
+ specified in the ``flags `` parameter, the ``timeout `` parameter indicates the
371
+ number of seconds the transaction can be inactive before it is automatically
372
+ terminated by the system. A transaction is inactive between the time it is
373
+ detached with :meth: `Connection.tpc_end() ` and the time it is resumed with
374
+ :meth: `Connection.tpc_begin() `.The default is 0 seconds.
375
+
367
376
The following code sample demonstrates the ``tpc_begin() `` function::
368
377
369
- connection.tpc_begin(xid=x, flags=oracledb.TPC_BEGIN_NEW)
370
378
x = connection.xid(format_id=1, global_transaction_id="tx1", branch_qualifier="br1")
379
+ connection.tpc_begin(xid=x, flags=oracledb.TPC_BEGIN_NEW, timeout=30)
371
380
372
381
See :ref: `tcp ` for information on TPC.
373
382
@@ -392,8 +401,8 @@ Connection Methods
392
401
393
402
The following code sample demonstrates the ``tpc_commit() `` function::
394
403
395
- connection.tpc_commit(xid=x, one_phase=False)
396
404
x = connection.xid(format_id=1, global_transaction_id="tx1", branch_qualifier="br1")
405
+ connection.tpc_commit(xid=x, one_phase=False)
397
406
398
407
See :ref: `tcp ` for information on TPC.
399
408
@@ -415,8 +424,8 @@ Connection Methods
415
424
416
425
The following code sample demonstrates the ``tpc_end() `` function::
417
426
418
- connection.tpc_end(xid=x, flags=oracledb.TPC_END_NORMAL)
419
427
x = connection.xid(format_id=1, global_transaction_id="tx1", branch_qualifier="br1")
428
+ connection.tpc_end(xid=x, flags=oracledb.TPC_END_NORMAL)
420
429
421
430
See :ref: `tcp ` for information on TPC.
422
431
@@ -430,8 +439,8 @@ Connection Methods
430
439
431
440
The following code sample demonstrates the ``tpc_forget() `` function::
432
441
433
- connection.tpc_forget(xid=x)
434
442
x = connection.xid(format_id=1, global_transaction_id="tx1", branch_qualifier="br1")
443
+ connection.tpc_forget(xid=x)
435
444
436
445
See :ref: `tcp ` for information on TPC.
437
446
@@ -452,8 +461,8 @@ Connection Methods
452
461
453
462
The following code sample demonstrates the ``tpc_prepare() `` function::
454
463
455
- connection.tpc_prepare(xid=x)
456
464
x = connection.xid(format_id=1, global_transaction_id="tx1", branch_qualifier="br1")
465
+ connection.tpc_prepare(xid=x)
457
466
458
467
See :ref: `tcp ` for information on TPC.
459
468
@@ -487,8 +496,8 @@ Connection Methods
487
496
488
497
The following code sample demonstrates the ``tpc_rollback() `` function::
489
498
490
- connection.tpc_rollback(xid=x)
491
499
x = connection.xid(format_id=1, global_transaction_id="tx1", branch_qualifier="br1")
500
+ connection.tpc_rollback(xid=x)
492
501
493
502
See :ref: `tcp ` for information on TPC.
494
503
0 commit comments