@Override public void rollback() { try { Connection connection = jooqConf.connectionProvider().acquire(); connection.rollback(); } catch (SQLException ex) { //TODO: Change exception throw new RuntimeException(ex); } }
@Override public void releaseSavepoint(Savepoint savepoint) { try { Connection connection = jooqConf.connectionProvider().acquire(); connection.releaseSavepoint(savepoint); } catch (SQLException ex) { //TODO: Change exception throw new RuntimeException(ex); } }
private void commit() throws SQLException { Connection connection = configuration.connectionProvider().acquire(); try { connection.commit(); } finally { configuration.connectionProvider().release(connection); } }
@Override public void rollback(Savepoint savepoint) { try { Connection connection = jooqConf.connectionProvider().acquire(); connection.rollback(savepoint); } catch (SQLException ex) { //TODO: Change exception throw new RuntimeException(ex); } }
private void rollback() throws SQLException { Connection connection = configuration.connectionProvider().acquire(); try { connection.rollback(); } finally { configuration.connectionProvider().release(connection); } }
@Override public Savepoint setSavepoint() { try { Connection connection = jooqConf.connectionProvider().acquire(); return connection.setSavepoint(); } catch (SQLException ex) { //TODO: Change exception throw new RuntimeException(ex); } }
@Override public void commit() { try { Connection connection = jooqConf.connectionProvider().acquire(); connection.commit(); } catch (SQLException ex) { //TODO: Change exception throw new RuntimeException(ex); } }
@Override public ConnectionProvider connectionProvider() { return new MockConnectionProvider(delegate.connectionProvider(), provider); }
@Override public void close() { try { Connection connection = jooqConf.connectionProvider().acquire(); if (!connection.isClosed()) { connection.rollback(); connection.close(); } } catch (SQLException ex) { //TODO: Change exception throw new RuntimeException(ex); } }
@Override public final void close() throws SQLException { repeatedSQL.clear(); configuration.connectionProvider().release(getDelegate()); }
@SuppressFBWarnings("SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING") @Override protected void createSequence(String escapedSchemaName, String seqName) throws SQLException { Connection c = getDsl().configuration().connectionProvider().acquire(); String query = "CALL " + TorodbSchema.TORODB_SCHEMA + ".create_sequence(?,?)"; try (PreparedStatement ps = c.prepareStatement(query)) { ps.setString(1, escapedSchemaName); ps.setString(2, seqName); ps.execute(); } finally { getDsl().configuration().connectionProvider().release(c); } }
@SuppressFBWarnings("SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING") @Override protected void createSchema(String escapedSchemaName) throws SQLException { Connection c = getDsl().configuration().connectionProvider().acquire(); String query = "CREATE SCHEMA \"" + escapedSchemaName + "\""; try (PreparedStatement ps = c.prepareStatement(query)) { ps.executeUpdate(); } finally { getDsl().configuration().connectionProvider().release(c); } }
@Override public final void close() throws SQLException { configuration.connectionProvider().release(getDelegate()); } }
@Override public void close() { ConnectionProvider cp = configuration().connectionProvider(); if (cp instanceof DefaultConnectionProvider) { DefaultConnectionProvider dcp = (DefaultConnectionProvider) cp; if (dcp.finalize) { JDBCUtils.safeClose(dcp.connection); dcp.connection = null; } } }
@SuppressFBWarnings("SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING") private void createSchema(DSLContext dsl, DatabaseInterface databaseInterface) throws SQLException { Connection c = dsl.configuration().connectionProvider().acquire(); try (PreparedStatement ps = c.prepareStatement(databaseInterface.createSchemaStatement(TORODB_SCHEMA))) { ps.executeUpdate(); } try (PreparedStatement ps = c.prepareStatement(databaseInterface.getCollectionsTable().getSQLCreationStatement(databaseInterface))) { ps.execute(); } finally { dsl.configuration().connectionProvider().release(c); } }
@SuppressFBWarnings("SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING") @Override protected void createSchema(String escapedSchemaName) throws SQLException { Connection c = getDsl().configuration().connectionProvider().acquire(); String query = "CREATE DATABASE IF NOT EXISTS `" + escapedSchemaName + "`"; try (PreparedStatement ps = c.prepareStatement(query)) { ps.executeUpdate(); } finally { getDsl().configuration().connectionProvider().release(c); } }
@SuppressFBWarnings("SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING") @Override protected void createStructuresTable(String escapedSchemaName) throws SQLException { Connection c = getDsl().configuration().connectionProvider().acquire(); String query = "CREATE TABLE \"" + escapedSchemaName + "\".structures(" + "sid int PRIMARY KEY," + "_structure text NOT NULL" + ")"; try (PreparedStatement ps = c.prepareStatement(query)) { ps.executeUpdate(); } finally { getDsl().configuration().connectionProvider().release(c); } }
@SuppressFBWarnings("SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING") @Override protected void createStructuresTable(String escapedSchemaName) throws SQLException { Connection c = getDsl().configuration().connectionProvider().acquire(); String query = "CREATE TABLE \"" + escapedSchemaName + "\".structures(" + "sid int PRIMARY KEY," + "_structure jsonb NOT NULL" + ")"; try (PreparedStatement ps = c.prepareStatement(query)) { ps.executeUpdate(); } finally { getDsl().configuration().connectionProvider().release(c); } }
ParsingConnection(Configuration configuration) { super(configuration.connectionProvider().acquire()); this.configuration = configuration; this.ctx = DSL.using(configuration); this.parser = ctx.parser(); }
@Override public <T> T connectionResult(ConnectionCallable<T> callable) { final Connection connection = configuration().connectionProvider().acquire(); try { return callable.run(connection); } catch (Exception e) { throw new DataAccessException("Error while running ConnectionCallable", e); } finally { configuration().connectionProvider().release(connection); } }