You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore: delay transaction activation until actual use (#552)
* chore: store temp TransactionOptions in connection state
Store temporary TransactionOptions in the connection state as local options. Local options
only apply to the current transaction. This simplifies the internal state handling of the
driver, as all transaction state should only be read from the connection state, and not
also from a temporary variable.
This also enables the use of a combination of temporary transaction options and using
SQL statements to set further options. The shared library always includes temporary
transaction options, as the BeginTransaction function accepts TransactionOptions as an
input argument. This meant that using SQL statements to set further transaction options
was not supported through the shared library.
* chore: delay transaction activation until actual use
Delay the actual transaction activation until the first actual usage of the transaction.
That is; the first time that a statement is being sent to Spanner. This allows the
application to amend the transaction options after calling BeginTx or executing
`BEGIN TRANSACTION`. The transaction options can be amended by executing a statement
like `SET TRANSACTION READ ONLY`.
t.Fatalf("error mismatch for starting a DML batch while in a read-only transaction\nGot: %v\nWant: %v", spanner.ErrCode(err), codes.FailedPrecondition)
108
108
}
109
109
110
110
// Starting a DML batch while the connection is in a read/write transaction is allowed.
0 commit comments