Package org.firebirdsql.jdbc
Class FBTpbMapper
- java.lang.Object
- 
- org.firebirdsql.jdbc.FBTpbMapper
 
- 
- All Implemented Interfaces:
- java.io.Serializable,- java.lang.Cloneable
 
 public final class FBTpbMapper extends java.lang.Object implements java.io.Serializable, java.lang.CloneableThis class is provides mapping capabilities between standard JDBC transaction isolation level and Firebird Transaction Parameters Block (TPB).- Author:
- Roman Rokytskyy
- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description static java.lang.StringTRANSACTION_NONEIndicates that transactions are not supported.static java.lang.StringTRANSACTION_READ_COMMITTEDDirty reads are prevented; non-repeatable reads and phantom reads can occur.static java.lang.StringTRANSACTION_READ_UNCOMMITTEDDirty reads, non-repeatable reads and phantom reads can occur.static java.lang.StringTRANSACTION_REPEATABLE_READDirty reads and non-repeatable reads are prevented; phantom reads can occur.static java.lang.StringTRANSACTION_SERIALIZABLEDirty reads, non-repeatable reads and phantom reads are prevented.
 - 
Constructor SummaryConstructors Constructor Description FBTpbMapper()Create instance of this class with the default mapping of JDBC transaction isolation levels to Firebird TPB.FBTpbMapper(java.lang.String mappingResource, java.lang.ClassLoader cl)Create instance of this class and load mapping from the specified resource.FBTpbMapper(java.util.Map<java.lang.String,java.lang.String> stringMapping)Create instance of this class for the specified string mapping.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()booleanequals(java.lang.Object obj)static FBTpbMappergetDefaultMapper()TransactionParameterBuffergetDefaultMapping()Get default mapping.TransactionParameterBuffergetMapping(int transactionIsolation)Get mapping for the specified transaction isolation level.static intgetTransactionIsolationLevel(java.lang.String isolationName)Convert transaction isolation level name into a corresponding constant.static java.lang.StringgetTransactionIsolationName(int isolationLevel)Convert transaction isolation level into string.inthashCode()static TransactionParameterBufferprocessMapping(java.lang.String mapping)Process comma-separated list of keywords and convert them into TPB values.static voidprocessMapping(FirebirdConnectionProperties connectionProperties, java.util.Map<java.lang.String,java.lang.String> info)This method extracts TPB mapping information from the connection parameters and adds it to the connectionProperties.static voidprocessMapping(FirebirdConnectionProperties connectionProperties, java.util.Properties info)This method extracts TPB mapping information from the connection parameters and adds it to the connectionProperties.voidsetMapping(int transactionIsolation, TransactionParameterBuffer tpb)Set mapping for the specified transaction isolation.
 
- 
- 
- 
Field Detail- 
TRANSACTION_SERIALIZABLEpublic static final java.lang.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.- See Also:
- Constant Field Values
 
 - 
TRANSACTION_REPEATABLE_READpublic static final java.lang.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").- See Also:
- Constant Field Values
 
 - 
TRANSACTION_READ_COMMITTEDpublic static final java.lang.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.- See Also:
- Constant Field Values
 
 - 
TRANSACTION_READ_UNCOMMITTEDpublic static final java.lang.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- See Also:
- Constant Field Values
 
 - 
TRANSACTION_NONEpublic static final java.lang.String TRANSACTION_NONE Indicates that transactions are not supported. This level is not supported- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
FBTpbMapperpublic FBTpbMapper() Create instance of this class with the default mapping of JDBC transaction isolation levels to Firebird TPB.
 - 
FBTpbMapperpublic FBTpbMapper(java.util.Map<java.lang.String,java.lang.String> stringMapping) throws java.sql.SQLExceptionCreate instance of this class for the specified string mapping.- Parameters:
- stringMapping- mapping of JDBC transaction isolation to Firebird mapping. Keys and values of this map must be strings. Keys can have the following values:- "TRANSACTION_SERIALIZABLE"
- "TRANSACTION_REPEATABLE_READ"
- "TRANSACTION_READ_COMMITTED"
- "TRANSACTION_READ_UNCOMMITTED"
 - "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"
 
- Throws:
- java.sql.SQLException- if mapping contains incorrect values.
 
 - 
FBTpbMapperpublic FBTpbMapper(java.lang.String mappingResource, java.lang.ClassLoader cl) throws java.sql.SQLExceptionCreate instance of this class and load mapping from the specified resource.- Parameters:
- mappingResource- name of the resource to load.
- cl- class loader that should be used to load specified resource.
- Throws:
- java.sql.SQLException- if resource cannot be loaded or contains incorrect values.
 
 
- 
 - 
Method Detail- 
getDefaultMapperpublic static FBTpbMapper getDefaultMapper() 
 - 
getTransactionIsolationNamepublic static java.lang.String getTransactionIsolationName(int isolationLevel) Convert transaction isolation level into string.- Parameters:
- isolationLevel- transaction isolation level as integer constant.
- Returns:
- corresponding string representation.
 
 - 
getTransactionIsolationLevelpublic static int getTransactionIsolationLevel(java.lang.String isolationName) Convert transaction isolation level name into a corresponding constant.- Parameters:
- isolationName- name of the transaction isolation.
- Returns:
- corresponding constant.
 
 - 
processMappingpublic static void processMapping(FirebirdConnectionProperties connectionProperties, java.util.Properties info) throws java.sql.SQLException This method extracts TPB mapping information from the connection parameters and adds it to the connectionProperties. The following format is supported:infocontains separate mappings for each of following transaction isolation levels:"TRANSACTION_SERIALIZABLE","TRANSACTION_REPEATABLE_READ"and"TRANSACTION_READ_COMMITTED".- Parameters:
- connectionProperties- FirebirdConnectionProperties to set transaction state
- info- connection parameters passed into a driver.
- Throws:
- java.sql.SQLException- if specified mapping is incorrect.
- See Also:
- processMapping(FirebirdConnectionProperties, Map)
 
 - 
processMappingpublic static void processMapping(FirebirdConnectionProperties connectionProperties, java.util.Map<java.lang.String,java.lang.String> info) throws java.sql.SQLException This method extracts TPB mapping information from the connection parameters and adds it to the connectionProperties. The following format is supported:infocontains separate mappings for each of following transaction isolation levels:"TRANSACTION_SERIALIZABLE","TRANSACTION_REPEATABLE_READ"and"TRANSACTION_READ_COMMITTED".- Parameters:
- connectionProperties- FirebirdConnectionProperties to set transaction state
- info- connection parameters passed into a driver.
- Throws:
- java.sql.SQLException- if specified mapping is incorrect.
- See Also:
- processMapping(FirebirdConnectionProperties, Properties)
 
 - 
processMappingpublic static TransactionParameterBuffer processMapping(java.lang.String mapping) throws java.sql.SQLException Process comma-separated list of keywords and convert them into TPB values.- Parameters:
- mapping- comma-separated list of keywords.
- Returns:
- set containing values corresponding to the specified keywords.
- Throws:
- java.sql.SQLException- if mapping contains keyword that is not a TPB parameter.
 
 - 
getMappingpublic TransactionParameterBuffer getMapping(int transactionIsolation) Get mapping for the specified transaction isolation level.- Parameters:
- transactionIsolation- transaction isolation level.
- Returns:
- set with TPB parameters.
- Throws:
- java.lang.IllegalArgumentException- if specified transaction isolation level is unknown.
 
 - 
setMappingpublic void setMapping(int transactionIsolation, TransactionParameterBuffer tpb)Set mapping for the specified transaction isolation.- Parameters:
- transactionIsolation- transaction isolation level.
- tpb- TPB parameters.
- Throws:
- java.lang.IllegalArgumentException- if incorrect isolation level is specified.
 
 - 
getDefaultMappingpublic TransactionParameterBuffer getDefaultMapping() Get default mapping. Default mapping represents a TPB mapping for the default transaction isolation level (read committed).- Returns:
- mapping for the default transaction isolation level.
 
 - 
equalspublic boolean equals(java.lang.Object obj) - Overrides:
- equalsin class- java.lang.Object
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 - 
clonepublic java.lang.Object clone() - Overrides:
- clonein class- java.lang.Object
 
 
- 
 
-