public <T> ISqlReadCursor<T> queryForCursor(String sql, ISqlRowMapper<T> mapper, Object[] args, int[] types) { logSql(sql, args); return new JdbcSqlReadCursor<T>(this, mapper, sql, args, types); }
public String queryForClob(final String sql, final Object... args) { logSql(sql, args); return execute(new IConnectionCallback<String>() { public String execute(Connection con) throws SQLException { String result = null; PreparedStatement ps = null; ResultSet rs = null; try { ps = con.prepareStatement(sql); ps.setQueryTimeout(settings.getQueryTimeout()); setValues(ps, args); rs = ps.executeQuery(); if (rs.next()) { result = lobHandler.getClobAsString(rs, 1); } } finally { close(rs); close(ps); } return result; } }); }
public <T> T queryForObject(final String sql, final Class<T> clazz, final Object... args) { logSql(sql, args); return execute(new IConnectionCallback<T>() { public T execute(Connection con) throws SQLException { T result = null; PreparedStatement ps = null; ResultSet rs = null; try { ps = con.prepareStatement(expandSql(sql, args)); ps.setQueryTimeout(settings.getQueryTimeout()); setValues(ps, expandArgs(sql, args)); rs = ps.executeQuery(); if (rs.next()) { result = getObjectFromResultSet(rs, clazz); } } finally { close(rs); close(ps); } return result; } }); }
public byte[] queryForBlob(final String sql, final int jdbcTypeCode, final String jdbcTypeName, final Object... args) { logSql(sql, args); return execute(new IConnectionCallback<byte[]>() { public byte[] execute(Connection con) throws SQLException {
public int update(final String sql, final Object[] args, final int[] types) { logSql(sql, args); return execute(new IConnectionCallback<Integer>() { public Integer execute(Connection con) throws SQLException {
public Map<String, Object> queryForMap(final String sql, final Object... args) { logSql(sql, args); return execute(new IConnectionCallback<Map<String, Object>>() { public Map<String, Object> execute(Connection con) throws SQLException {
for (String statement = source.readSqlStatement(); statement != null; statement = source .readSqlStatement()) { logSql(statement, null); try { boolean hasResults = stmt.execute(statement);