TransactionIsolation enum

Represents a connection to an Oracle database.

This class provides a high-level interface for interacting with Oracle databases, including executing queries, managing transactions, calling stored procedures, and handling LOB (Large Object) operations.

Connection Lifecycle:

  1. Create connection with OracleConnection.connect
  2. Execute queries and operations
  3. Close connection with close when done

Example - Basic Connection:

final config = OracleConfig.fromEnvironment();
final connection = await OracleConnection.connect(
  dpiOracle: dpiOracle,
  context: context,
  config: config,
);

try {
  final results = await connection.query('SELECT * FROM employees');
  for (final row in results) {
    print('Employee: ${row['name']}');
  }
} finally {
  await connection.close();
}

Example - Transaction Management:

try {
  await connection.execute('UPDATE accounts SET balance = balance - 100 WHERE id = 1');
  await connection.execute('UPDATE accounts SET balance = balance + 100 WHERE id = 2');
  await connection.commit();  // Commit transaction
} catch (e) {
  await connection.rollback();  // Rollback on error
  rethrow;
}

Example - Stored Procedure with OUT Parameters:

final outVar = await connection.createVar(
  oracleType: DPI_ORACLE_TYPE_VARCHAR,
  nativeType: DPI_NATIVE_TYPE_BYTES,
  size: 100,
);

await connection.callproc(
  'get_employee_name',
  parameters: [employeeId],
  keywordParameters: {'name': outVar},
);

final employeeName = await outVar.getValue();
print('Employee: $employeeName');

Thread Safety: This class is NOT thread-safe. Each connection should be used from a single isolate. For concurrent operations, use OracleConnectionPool.

UTF-8 Support: All string operations fully support UTF-8, including multi-byte characters (accented characters, CJK text, emojis, etc.).

See also:

Inheritance
Available extensions

Values

readCommitted → const TransactionIsolation

Read Committed - default Oracle isolation level Prevents dirty reads, allows non-repeatable reads and phantom reads

serializable → const TransactionIsolation

Serializable - highest isolation level Prevents dirty reads, non-repeatable reads, and phantom reads

readOnly → const TransactionIsolation

Read Only - read-only transaction No DML allowed, only SELECT

Properties

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<TransactionIsolation>
A constant List of the values in this enum, in order of their declaration.