List of utility methods to do SQL Execute
void | exec(Connection conn, String sql) exec PreparedStatement pstmt = null; try { pstmt = conn.prepareStatement(sql); pstmt.execute(); } finally { close(pstmt); |
void | exec(Connection psql, String sql) exec Statement statement = psql.createStatement(); statement.execute(sql); statement.close(); |
boolean | execSql(String sql, Connection conn) exec Sql PreparedStatement ps = conn.prepareStatement(sql); boolean result = false; try { ps.execute(); } finally { ps.close(); return result; ... |
int | execStatement(Connection con, String strStatement) Purpose: execute statement, can be used to do update or insert Assumptions: Note: this version does not take into account special characters. ResultSet rs = null; PreparedStatement st = null; try { st = con.prepareStatement(strStatement); return st.executeUpdate(); } finally { try { closeAll(rs, st, null); ... |
void | execte(Connection conn, String sql) execte Statement stat = conn.createStatement(); stat.execute(sql); stat.close(); |
void | execute(Connection conn, String SQL) execute Statement stmt = conn.createStatement(); try { stmt.execute(SQL.toString()); } catch (Exception ex) { System.out.println("Exception running SQL: " + SQL.toString()); throw ex; |
void | execute(Connection conn, String sql, Object[] args) Executes the given sql string. PreparedStatement stmt = null; try { stmt = conn.prepareStatement(sql); for (int i = 0; i < args.length;) { Object obj = args[i++]; if (obj instanceof Long) { stmt.setLong(i, ((Long) obj).longValue()); } else if (obj instanceof Double) { ... |
List | execute(Connection conn, String sql, Object[] params) execute List<Object[]> result = new ArrayList<Object[]>(); PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(sql); for (int i = 0; i < params.length; i++) { Object obj = params[i]; ps.setObject(i + 1, obj); ... |
int | execute(Connection conn, String string) execute PreparedStatement st = conn.prepareStatement(string); try { return st.executeUpdate(); } finally { st.close(); |
boolean | execute(Connection connection, String sql) Executes provided sql string PreparedStatement statement = null; try { statement = connection.prepareStatement(sql); return statement.execute(); } finally { closeQuietly(statement); |