use of io.shardingjdbc.core.jdbc.core.connection.ShardingConnection in project sharding-jdbc by shardingjdbc.
the class ConnectionAdapterTest method assertCommit.
@Test
public // TODO 缺少断言,做柔性事务时补充
void assertCommit() throws SQLException {
try (ShardingConnection actual = getShardingDataSource().getConnection()) {
actual.setAutoCommit(false);
actual.createStatement().executeQuery(sql);
actual.commit();
}
}
use of io.shardingjdbc.core.jdbc.core.connection.ShardingConnection in project sharding-jdbc by shardingjdbc.
the class ConnectionAdapterTest method assertSetAutoCommit.
@Test
public void assertSetAutoCommit() throws SQLException {
try (ShardingConnection actual = getShardingDataSource().getConnection()) {
assertTrue(actual.getAutoCommit());
actual.setAutoCommit(false);
actual.createStatement().executeQuery(sql);
assertAutoCommit(actual, false);
actual.setAutoCommit(true);
assertAutoCommit(actual, true);
}
}
use of io.shardingjdbc.core.jdbc.core.connection.ShardingConnection in project sharding-jdbc by shardingjdbc.
the class PreparedStatementAdapterTest method init.
@Before
public void init() {
ShardingConnection shardingConnection = getShardingDataSource().getConnection();
shardingConnections.add(shardingConnection);
preparedStatements.add(shardingConnection.prepareStatement(JDBCTestSQL.SELECT_GROUP_BY_USER_ID_SQL));
}
use of io.shardingjdbc.core.jdbc.core.connection.ShardingConnection in project sharding-jdbc by shardingjdbc.
the class ResultSetGetterAdapterTest method init.
@Before
public void init() throws SQLException {
ShardingConnection shardingConnection = getShardingDataSource().getConnection();
shardingConnections.add(shardingConnection);
Statement statement = shardingConnection.createStatement();
statements.add(statement);
ResultSet resultSet = statement.executeQuery(JDBCTestSQL.SELECT_ORDER_BY_USER_ID_SQL);
resultSet.next();
resultSets.put(getCurrentDatabaseType(), resultSet);
}
Aggregations