private void disableReferentialIntegrity(Connection connection) throws SQLException { String sql = disableReferentialIntegritySql(); execute(connection, sql); }
private void enableReferentialIntegrity(Connection connection) throws SQLException { String sql = enableReferentialIntegritySql(); execute(connection, sql); }
@Override public void restore(InputStream stream) { vendor.restore(connectionProvider, stream); }
private void restoreSqlList(ConnectionProvider connectionProvider, Iterable<String> sqlList) { Connection connection = null; String currentSql = null; try { connection = connectionProvider.get(); connection.setAutoCommit(false); disableReferentialIntegrity(connection); for (String sql : sqlList) { currentSql = sql; execute(connection, sql); } enableReferentialIntegrity(connection); connection.commit(); } catch (SQLException e) { throw new SQLRuntimeException(currentSql, e); } finally { Jdbc.close(connection); } }
public static WayRelationalModuleBuilder using(Credential credential) { String vendorName = credential.vendorName(); Vendor vendor = Vendor.valueOf(vendorName); return vendor.newModuleBuilder(credential); }
@Override public void restoreAll(Iterable<? extends InputStream> streamList) { vendor.restoreAll(connectionProvider, streamList); }
void restoreAll(ConnectionProvider connectionProvider, Iterable<? extends InputStream> streamIterable) { Set<String> sqlDistinctSet = StreamSupport.stream(streamIterable.spliterator(), false) .map(new InputStreamToSqlList()) .flatMap(List::stream) .collect(MoreCollectors.toImmutableSet()); restoreSqlList(connectionProvider, sqlDistinctSet); }
private void restoreSqlList(ConnectionProvider connectionProvider, Iterable<String> sqlList) { Connection connection = null; String currentSql = null; try { connection = connectionProvider.get(); connection.setAutoCommit(false); disableReferentialIntegrity(connection); for (String sql : sqlList) { currentSql = sql; execute(connection, sql); } enableReferentialIntegrity(connection); connection.commit(); } catch (SQLException e) { throw new SQLRuntimeException(currentSql, e); } finally { Jdbc.close(connection); } }
public static WayRelationalModuleBuilder using(Credential credential) { String vendorName = credential.vendorName(); Vendor vendor = Vendor.valueOf(vendorName); return vendor.newModuleBuilder(credential, new WayRelationalModuleMysql()); }
@Override public void restoreAll(Iterable<? extends InputStream> streamList) { vendor.restoreAll(connectionProvider, streamList); }
void restoreAll(ConnectionProvider connectionProvider, Iterable<? extends InputStream> streamIterable) { Set<String> sqlDistinctSet = StreamSupport.stream(streamIterable.spliterator(), false) .map(new InputStreamToSqlList()) .flatMap(List::stream) .collect(MoreCollectors.toImmutableSet()); restoreSqlList(connectionProvider, sqlDistinctSet); }
private void restoreSqlList(ConnectionProvider connectionProvider, Iterable<String> sqlList) { Connection connection = null; String currentSql = null; try { connection = connectionProvider.get(); connection.setAutoCommit(false); disableReferentialIntegrity(connection); for (String sql : sqlList) { currentSql = sql; execute(connection, sql); } enableReferentialIntegrity(connection); connection.commit(); } catch (SQLException e) { throw new SQLRuntimeException(currentSql, e); } finally { Jdbc.close(connection); } }
public static WayRelationalModuleBuilder using(Credential credential) { String vendorName = credential.vendorName(); Vendor vendor = Vendor.valueOf(vendorName); return vendor.newModuleBuilder(credential, new WayRelationalModuleMysql()); }
private void enableReferentialIntegrity(Connection connection) throws SQLException { String sql = enableReferentialIntegritySql(); execute(connection, sql); }
private void disableReferentialIntegrity(Connection connection) throws SQLException { String sql = disableReferentialIntegritySql(); execute(connection, sql); }
@Override public void restoreAll(Iterable<? extends InputStream> streamList) { vendor.restoreAll(connectionProvider, streamList); }
void restoreAll(ConnectionProvider connectionProvider, Iterable<? extends InputStream> streamIterable) { Set<String> sqlDistinctSet = MoreStreams.from(streamIterable) .transformAndConcat(new InputStreamToSqlList()) .toImmutableSet(); restoreSqlList(connectionProvider, sqlDistinctSet); }
@Override public void restore(InputStream stream) { vendor.restore(connectionProvider, stream); }
private void enableReferentialIntegrity(Connection connection) throws SQLException { String sql = enableReferentialIntegritySql(); execute(connection, sql); }
private void disableReferentialIntegrity(Connection connection) throws SQLException { String sql = disableReferentialIntegritySql(); execute(connection, sql); }