/** * Execute the query returning the resulting List. */ public List<T> call() throws Exception { try { return server.findList(query, transaction); } finally { // cleanup the underlying connection transaction.end(); } }
/** * Execute the find Id's query returning the list of Id's. */ public List<Object> call() throws Exception { // we have already made a copy of the query // this way the same query instance is available to the // QueryFutureIds (as so has access to the List before it is done) try { return server.findIdsWithCopy(query, transaction); } finally { transaction.end(); } }
/** * Execute the query returning the row count. */ public Integer call() throws Exception { try { return server.findRowCountWithCopy(query, transaction); } finally { // cleanup the underlying connection transaction.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 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(); } }