/** * If we created a transaction commit it. We have successfully processed all * the rows. */ protected void commitTransactionIfCreated() { if (createdTransaction) { transaction.commit(); logger.info("Committed transaction"); } }
/** * If we created a transaction commit it. We have successfully processed all * the rows. */ protected void commitTransactionIfCreated() { if (createdTransaction) { transaction.commit(); logger.info("Committed transaction"); } }
/** * If we created a transaction commit it. We have successfully processed all * the rows. */ protected void commitTransactionIfCreated() { if (createdTransaction) { transaction.commit(); logger.info("Committed transaction"); } }
/** * Execute all the DDL statements in the script. */ public void runScript(boolean expectErrors, String content) { StringReader sr = new StringReader(content); List<String> statements = parseStatements(sr); Transaction t = server.createTransaction(); try { Connection connection = t.getConnection(); out.println("runScript"); out.flush(); runStatements(expectErrors, statements, connection); out.println("... end of script"); out.flush(); t.commit(); } catch (Exception e){ String msg = "Error: "+e.getMessage(); throw new PersistenceException(msg, e); } finally { t.end(); } }
/** * Execute all the DDL statements in the script. */ public void runScript(boolean expectErrors, String content) { StringReader sr = new StringReader(content); List<String> statements = parseStatements(sr); Transaction t = server.createTransaction(); try { Connection connection = t.getConnection(); out.println("runScript"); out.flush(); runStatements(expectErrors, statements, connection); out.println("... end of script"); out.flush(); t.commit(); } catch (Exception e){ String msg = "Error: "+e.getMessage(); throw new PersistenceException(msg, e); } finally { t.end(); } }
/** * Execute all the DDL statements in the script. */ public int runScript(boolean expectErrors, String content, String scriptName) { DdlRunner runner = new DdlRunner(expectErrors, scriptName); Transaction transaction = server.createTransaction(); Connection connection = transaction.getConnection(); try { if (expectErrors) { connection.setAutoCommit(true); } int count = runner.runAll(content, connection); if (expectErrors) { connection.setAutoCommit(false); } transaction.commit(); return count; } catch (SQLException e) { throw new PersistenceException("Failed to run script", e); } finally { transaction.end(); } }