public int update(String sql, Object... args) throws SQLException { PreparedStatement ps = connection.prepareStatement(sql); try { setParameters(ps, args); return ps.executeUpdate(); } finally { try { ps.close(); } catch (SQLException e) { //ignore } } }
public List<Map<String, Object>> selectAll(String sql, Object... args) throws SQLException { PreparedStatement ps = connection.prepareStatement(sql); try { setParameters(ps, args); ResultSet rs = ps.executeQuery(); return getResults(rs); } finally { try { ps.close(); } catch (SQLException e) { //ignore } } }
/** * Executes an UPDATE statement. * * @param sql The SQL * @param args The arguments to be set on the statement. * @return The number of rows impacted or BATCHED_RESULTS if the statements are being batched. * @throws SQLException If statement preparation or execution fails */ public int update(String sql, Object... args) throws SQLException { PreparedStatement ps = connection.prepareStatement(sql); try { setParameters(ps, args); return ps.executeUpdate(); } finally { try { ps.close(); } catch (SQLException e) { //ignore } } }
/** * Executes a SELECT statement that returns multiple rows. * * @param sql The SQL * @param args The arguments to be set on the statement. * @return The list of rows expected. * @throws SQLException If statement preparation or execution fails */ public List<Map<String, Object>> selectAll(String sql, Object... args) throws SQLException { PreparedStatement ps = connection.prepareStatement(sql); try { setParameters(ps, args); ResultSet rs = ps.executeQuery(); return getResults(rs); } finally { try { ps.close(); } catch (SQLException e) { //ignore } } }
setParameters(ps, args); ps.executeUpdate(); if (useGeneratedKeySupport) {
setParameters(ps, args); ps.executeUpdate(); if (useGeneratedKeySupport) {
/** * Executes an UPDATE statement. * * @param sql The SQL * @param args The arguments to be set on the statement. * @return The number of rows impacted or BATCHED_RESULTS if the statements are being batched. * @throws SQLException If statement prepration or execution fails */ public int update(String sql, Object... args) throws SQLException { PreparedStatement ps = connection.prepareStatement(sql); try { setParameters(ps, args); return ps.executeUpdate(); } finally { try { ps.close(); } catch (SQLException e) { //ignore } } }
/** * Executes a SELECT statement that returns multiple rows. * * @param sql The SQL * @param args The arguments to be set on the statement. * @return The number of rows impacted or BATCHED_RESULTS if the statements are being batched. * @throws SQLException If statement prepration or execution fails */ public List<Map<String, Object>> selectAll(String sql, Object... args) throws SQLException { PreparedStatement ps = connection.prepareStatement(sql); try { setParameters(ps, args); ResultSet rs = ps.executeQuery(); return getResults(rs); } finally { try { ps.close(); } catch (SQLException e) { //ignore } } }
setParameters(ps, args); ps.executeUpdate(); if (useGeneratedKeySupport) {