org.firebirdsql.jdbc
Class FBTpbMapper
java.lang.Object
org.firebirdsql.jdbc.FBTpbMapper
- Serializable
public class FBTpbMapper
extends java.lang.Object
implements Serializable
This class is provides mapping capabilities between standard JDBC
transaction isolation level and Firebird Transaction Parameters Block (TPB).
FBTpbMapper(GDS gds) - Create instance of this class with the default mapping of JDBC
transaction isolation levels to Firebird TPB.
|
FBTpbMapper(GDS gds, Map stringMapping) - Create instance of this class for the specified string mapping.
|
FBTpbMapper(GDS gds, String mappingResource, ClassLoader cl) - Create instance of this class and load mapping from the specified
resource.
|
DEFAULT_MAPPING_RESOURCE
public static final String DEFAULT_MAPPING_RESOURCE
TRANSACTION_NONE
public static final String TRANSACTION_NONE
Indicates that transactions are not supported. This level is not
supported
TRANSACTION_READ_COMMITTED
public static final String TRANSACTION_READ_COMMITTED
Dirty reads are prevented; non-repeatable reads and phantom reads can
occur. This level only prohibits a transaction from reading a row with
uncommitted changes in it.
TRANSACTION_READ_UNCOMMITTED
public static final String TRANSACTION_READ_UNCOMMITTED
Dirty reads, non-repeatable reads and phantom reads can occur. This level
allows a row changed by one transaction to be read by another transaction
before any changes in that row have been committed (a "dirty read"). If
any of the changes are rolled back, the second transaction will have
retrieved an invalid row. This level is not actually supported
TRANSACTION_REPEATABLE_READ
public static final String TRANSACTION_REPEATABLE_READ
Dirty reads and non-repeatable reads are prevented; phantom reads can
occur. This level prohibits a transaction from reading a row with
uncommitted changes in it, and it also prohibits the situation where one
transaction reads a row, a second transaction alters the row, and the
first transaction rereads the row, getting different values the second
time (a "non-repeatable read").
TRANSACTION_SERIALIZABLE
public static final String TRANSACTION_SERIALIZABLE
Dirty reads, non-repeatable reads and phantom reads are prevented. This
level includes the prohibitions in TRANSACTION_REPEATABLE_READ and
further prohibits the situation where one transaction reads all rows that
satisfy a WHERE condition, a second transaction inserts a row that
satisfies that WHERE condition, and the first transaction rereads for the
same condition, retrieving the additional "phantom" row in the second
read.
FBTpbMapper
public FBTpbMapper(GDS gds)
Create instance of this class with the default mapping of JDBC
transaction isolation levels to Firebird TPB.
FBTpbMapper
public FBTpbMapper(GDS gds,
Map stringMapping)
throws FBResourceException
Create instance of this class for the specified string mapping.
stringMapping
- mapping of JDBC transaction isolation to Firebird
mapping. Keys and values of this map must be strings. Keys can have
following values:
"TRANSACTION_SERIALIZABLE"
"TRANSACTION_REPEATABLE_READ"
"TRANSACTION_READ_COMMITTED"
"TRANSACTION_READ_UNCOMMITTED"
Values are specified as comma-separated list of following keywords:
"isc_tpb_consistency"
"isc_tpb_concurrency"
"isc_tpb_read_committed"
"isc_tpb_rec_version"
"isc_tpb_no_rec_version"
"isc_tpb_wait"
"isc_tpb_nowait"
"isc_tpb_read"
"isc_tpb_write"
"isc_tpb_lock_read"
"isc_tpb_lock_write"
"isc_tpb_shared"
"isc_tpb_protected"
It is also allowed to strip "isc_tpb_" prefix from above shown constans.
Meaning of these constants and possible combinations you can find in a
documentation.
FBTpbMapper
public FBTpbMapper(GDS gds,
String mappingResource,
ClassLoader cl)
throws FBResourceException
Create instance of this class and load mapping from the specified
resource.
mappingResource
- name of the resource to load.cl
- class loader that should be used to load specified resource.
getDefaultMapping
public TransactionParameterBuffer getDefaultMapping()
Get default mapping. Default mapping represents a TPB mapping for the
default transaction isolation level (read committed).
- mapping for the default transaction isolation level.
getDefaultTransactionIsolation
public int getDefaultTransactionIsolation()
getMapping
public TransactionParameterBuffer getMapping(int transactionIsolation)
Get mapping for the specified transaction isolation level.
transactionIsolation
- transaction isolation level.
getTransactionIsolationLevel
public static int getTransactionIsolationLevel(String isolationName)
Convert transaction isolation level name into a corresponding constant.
isolationName
- name of the transaction isolation.
getTransactionIsolationName
public static String getTransactionIsolationName(int isolationLevel)
Convert transaction isolation level into string.
isolationLevel
- transaction isolation level as integer constant.
- corresponding string representation.
processMapping
public static TransactionParameterBuffer processMapping(GDS gds,
String mapping)
throws FBResourceException
Process comma-separated list of keywords and convert them into TPB
values.
mapping
- comma-separated list of keywords.
- set containing values corresponding to the specified keywords.
setDefaultTransactionIsolation
public void setDefaultTransactionIsolation(int isolationLevel)
setMapping
public void setMapping(int transactionIsolation,
TransactionParameterBuffer tpb)
Set mapping for the specified transaction isolation.
transactionIsolation
- transaction isolation level.tpb
- TPB parameters.
Copyright B) 2001 David Jencks and other authors. All rights reserved.