TransactionAccessMode enum
Whether a transaction is allowed to mutate state.
Equivalent of the SQL-92 READ ONLY / READ WRITE modifier on
SET TRANSACTION. Setting readOnly lets the engine skip locking
(PostgreSQL, MySQL/MariaDB), pick a snapshot path (Oracle), or simply
reject any DML attempt during the transaction.
Engines without an equivalent SQL hint (SQL Server, SQLite, Snowflake) silently treat readOnly as a no-op so callers can program against the abstraction unconditionally.
Example:
final txnId = await service.beginTransaction(
connectionId,
IsolationLevel.repeatableRead,
savepointDialect: SavepointDialect.auto,
accessMode: TransactionAccessMode.readOnly,
);
Sprint 4.1 — see CHANGELOG.md [3.4.0].
Values
- readWrite → const TransactionAccessMode
-
Default. Transaction may execute any DML/DDL allowed by the user's privileges. Equivalent to
READ WRITEon SQL-92 engines.const TransactionAccessMode(0) - readOnly → const TransactionAccessMode
-
Transaction may not execute DML or DDL. Drivers that support the hint use it to skip locking and (where applicable) take a snapshot read path.
Engine matrix:
- PostgreSQL, MySQL, MariaDB, DB2, Oracle: emits
SET TRANSACTION READ ONLY. - SQL Server, SQLite, Snowflake, others: silent no-op (logged at
debug); enforce with explicit
DENYgrants instead.
const TransactionAccessMode(1) - PostgreSQL, MySQL, MariaDB, DB2, Oracle: emits
Properties
- code → int
-
Stable wire code passed to the native FFI
odbc_transaction_begin_v2. Must matchTransactionAccessMode::from_u32on the Rust side.final - hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
TransactionAccessMode> - A constant List of the values in this enum, in order of their declaration.