List of utility methods to do SQL PreparedStatement
PreparedStatement | prepareStatement(Connection conn, String query, List prepare Statement PreparedStatement cstmt = conn.prepareStatement(query);
constrainQueryParams(conn, params);
setPreparedStatementParams(cstmt, params);
return cstmt;
|
PreparedStatement | prepareStatement(Connection con, String sql, Object... params) prepare Statement PreparedStatement ps = null; try { ps = con.prepareStatement(sql, PreparedStatement.RETURN_GENERATED_KEYS); for (int i = 0; i < params.length; i++) { ps.setObject(i + 1, params[i]); } catch (SQLException e) { e.printStackTrace(); ... |
PreparedStatement | prepareStatement(Connection conn, Map psMap, String key, String sql) prepare Statement Object[] obj = (Object[]) psMap.get(key); if (obj == null) { obj = new Object[] { null, null }; psMap.put(key, obj); String lastSql = (String) obj[0]; PreparedStatement ps = (PreparedStatement) obj[1]; if (!sql.equals(lastSql)) { ... |
PreparedStatement | prepareStatement(Connection conn, String name, String sql) prepare statements for this connection. PreparedStatement ps = null; try { ps = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); } finally { if (ps == null) { System.err.println("Warning: couldn't initialize " + name + " from " + sql); return ps; |
PreparedStatement | prepareStatement(Connection conn, String sql) prepare Statement if (uri.startsWith("jdbc:hsqldb") || uri.startsWith("jdbc:postgres")) { return conn.prepareStatement(sql); return conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); |
PreparedStatement | prepareStatement(Connection conn, String sql, boolean isCallable) prepare Statement if (!isCallable) return conn.prepareStatement(sql); else return conn.prepareCall(sql); |
PreparedStatement | prepareStatement(Connection conn, String sql, Object... values) prepare Statement PreparedStatement stmt = conn.prepareStatement(sql);
setPreparedStatementValues(stmt, values);
return stmt;
|
PreparedStatement | prepareStatement(Connection connection, String line) prepare Statement try { return connection.prepareStatement(line); } catch (SQLException e) { return null; |
PreparedStatement | prepareStatement(Connection connection, String sql, boolean returnKeys, Object... values) prepare Statement PreparedStatement statement = connection.prepareStatement(sql,
returnKeys ? Statement.RETURN_GENERATED_KEYS : Statement.NO_GENERATED_KEYS);
setValues(statement, values);
return statement;
|
PreparedStatement | prepareStatement(Connection connection, String sql, Object... values) Returns a PreparedStatement of the given connection, set with the given SQL query and the given parameter values. PreparedStatement statement = connection.prepareStatement(sql);
setValues(statement, values);
return statement;
|