private void conditionalShutdown() { if(!beenShutDown) { beenShutDown=true; log.debug("Shutdown is shutting down database."); jdbc.getJdbcOperations().execute("SHUTDOWN"); if(file!=null) { log.info("HSQL database (file: "+file+") has been shut down."); } else { log.info("HSQL database has been shut down."); } } }
public void prepare() throws DataAccessException, IOException { jdbc.getJdbcOperations().execute(IOUtils.toString(getClass().getResourceAsStream(PREPARE_SCRIPT))); }
public int[] batchUpdate(String sql, List<Object[]> batchArgs, int[] argTypes) { return BatchUpdateUtils.executeBatchUpdate(sql, batchArgs, argTypes, getJdbcOperations()); }
public void destroy() throws DataAccessException, IOException { jdbc.getJdbcOperations().execute(IOUtils.toString(getClass().getResourceAsStream(DESTROY_SCRIPT))); } }
public <T> T queryForObject(String sql, RowMapper<T> rm, Object... args) throws DataAccessException { return (ObjectUtils.isEmpty(args) ? getJdbcOperations().queryForObject(sql, rm): getJdbcOperations().queryForObject(sql, getArguments(args), rm)); }
public Map<String, Object> queryForMap(String sql, Object... args) throws DataAccessException { return (ObjectUtils.isEmpty(args) ? getJdbcOperations().queryForMap(sql) : getJdbcOperations().queryForMap(sql, getArguments(args))); }
public List<Map<String, Object>> queryForList(String sql, Object... args) throws DataAccessException { return (ObjectUtils.isEmpty(args) ? getJdbcOperations().queryForList(sql) : getJdbcOperations().queryForList(sql, getArguments(args))); }
public <T> T queryForObject(String sql, Class<T> requiredType, Object... args) throws DataAccessException { return (ObjectUtils.isEmpty(args) ? getJdbcOperations().queryForObject(sql, requiredType) : getJdbcOperations().queryForObject(sql, getArguments(args), requiredType)); }
/** * Executes a script from a classpath resource, possibly splitting it in parts * on occurences of the <code>splitOn</code> regular expression and executing each part separately. * * @param resource name of the resource with the sql * @throws DataAccessException on errors while executing the script * @throws IOException on errors while reading the script */ private void execScript(String resource) throws DataAccessException, IOException { String sql = IOUtils.toString(findResource(resource)); if (splitOn != null && !"".equals(splitOn)) for (String part : sql.split(splitOn)) jdbc.getJdbcOperations().execute(part); else jdbc.getJdbcOperations().execute(sql); }
public int queryForInt(String sql, Object... args) throws DataAccessException { return (ObjectUtils.isEmpty(args) ? getJdbcOperations().queryForInt(sql) : getJdbcOperations().queryForInt(sql, getArguments(args))); }
public long queryForLong(String sql, Object... args) throws DataAccessException { return (ObjectUtils.isEmpty(args) ? getJdbcOperations().queryForLong(sql) : getJdbcOperations().queryForLong(sql, getArguments(args))); }
public <T> List<T> query(String sql, RowMapper<T> rm, Object... args) throws DataAccessException { return (ObjectUtils.isEmpty(args) ? getJdbcOperations().query(sql, rm) : getJdbcOperations().query(sql, getArguments(args), rm)); }
public int update(String sql, Object ... args) throws DataAccessException { return (ObjectUtils.isEmpty(args) ? getJdbcOperations().update(sql) : getJdbcOperations().update(sql, getArguments(args))); }