use of org.firebirdsql.gds.TransactionParameterBuffer in project jaybird by FirebirdSQL.
the class TestFBDriver method testTransactionConfigThroughPropertiesObject.
@Test
public void testTransactionConfigThroughPropertiesObject() throws Exception {
Properties props = getDefaultPropertiesForConnection();
// Note that for proper testing this needs to be different from the mapping in isc_tpb_mapping.properties
props.setProperty("TRANSACTION_READ_COMMITTED", "isc_tpb_read_committed,isc_tpb_no_rec_version,isc_tpb_write,isc_tpb_nowait");
connection = DriverManager.getConnection(getUrl(), props);
FirebirdConnection fbConnection = connection.unwrap(FirebirdConnection.class);
TransactionParameterBuffer tpb = fbConnection.getTransactionParameters(Connection.TRANSACTION_READ_COMMITTED);
assertEquals(4, tpb.size());
assertTrue("expected isc_tpb_read_committed", tpb.hasArgument(ISCConstants.isc_tpb_read_committed));
assertTrue("expected isc_tpb_no_rec_version", tpb.hasArgument(ISCConstants.isc_tpb_no_rec_version));
assertTrue("expected isc_tpb_write", tpb.hasArgument(ISCConstants.isc_tpb_write));
assertTrue("expected isc_tpb_nowait", tpb.hasArgument(ISCConstants.isc_tpb_nowait));
}
use of org.firebirdsql.gds.TransactionParameterBuffer in project jaybird by FirebirdSQL.
the class TestTableReservation method prepareTPB.
protected void prepareTPB(FirebirdConnection connection, int isolationLevel, int lockMode, String tableName, int lockType, boolean readOnly) throws SQLException {
TransactionParameterBuffer tpb = connection.createTransactionParameterBuffer();
// specify new isolation level
tpb.addArgument(isolationLevel);
if (isolationLevel == TransactionParameterBuffer.READ_COMMITTED)
tpb.addArgument(TransactionParameterBuffer.REC_VERSION);
tpb.addArgument(!readOnly ? TransactionParameterBuffer.WRITE : TransactionParameterBuffer.READ);
tpb.addArgument(TransactionParameterBuffer.NOWAIT);
tpb.addArgument(lockMode, tableName);
tpb.addArgument(lockType);
connection.setTransactionParameters(tpb);
}
use of org.firebirdsql.gds.TransactionParameterBuffer in project jaybird by FirebirdSQL.
the class AbstractStatementTest method getTransaction.
private FbTransaction getTransaction() throws SQLException {
TransactionParameterBuffer tpb = new TransactionParameterBufferImpl();
tpb.addArgument(ISCConstants.isc_tpb_read_committed);
tpb.addArgument(ISCConstants.isc_tpb_rec_version);
tpb.addArgument(ISCConstants.isc_tpb_write);
tpb.addArgument(ISCConstants.isc_tpb_wait);
return db.startTransaction(tpb);
}
use of org.firebirdsql.gds.TransactionParameterBuffer in project jaybird by FirebirdSQL.
the class AbstractTransactionTest method getTransaction.
protected final FbTransaction getTransaction() throws SQLException {
TransactionParameterBuffer tpb = new TransactionParameterBufferImpl();
tpb.addArgument(ISCConstants.isc_tpb_read_committed);
tpb.addArgument(ISCConstants.isc_tpb_rec_version);
tpb.addArgument(ISCConstants.isc_tpb_write);
tpb.addArgument(ISCConstants.isc_tpb_wait);
return db.startTransaction(tpb);
}
use of org.firebirdsql.gds.TransactionParameterBuffer in project jaybird by FirebirdSQL.
the class TestFBTpbMapper method testGetMappingForREAD_UNCOMMITED_Returns_READ_COMMITTED.
@Test
public void testGetMappingForREAD_UNCOMMITED_Returns_READ_COMMITTED() {
final FBTpbMapper defaultMapper = FBTpbMapper.getDefaultMapper();
final TransactionParameterBuffer readCommitted = defaultMapper.getMapping(Connection.TRANSACTION_READ_COMMITTED);
assertEquals("Expected same mapping for READ_UNCOMMITTED as for READ_COMMITTED", readCommitted, defaultMapper.getMapping(Connection.TRANSACTION_READ_UNCOMMITTED));
}
Aggregations