/** * Creates a delete prepared statement * * @param dp The DataPack object which contains the data to render as an sql string * @return The sql string we are parsing */ public String delete(DataPack dp) { synchronized (syncDelete) { String s = "DELETE "; if (dp.getSetClause() != null) { s += dp.getSetClause(); } s += " FROM " + dp.getTableName(); s = getWhereString(dp, s); return s; } }
/** * Creates a select distinct prepared statement * * @param dp The DataPack object which contains the data to render as an sql string * @return The sql prepared statement we are parsing */ public String selectDistinct(DataPack dp) { synchronized (syncSelectDistinct) { String sql = "SELECT DISTINCT " + dp.getSetClause() + " FROM " + dp.getTableName(); sql = getWhereString(dp, sql); return sql + ";"; } }
/** * Creates an insert prepared statement * * @param dp The DataPack object which contains the data to render as an sql string * @return The sql prepared statement we are parsing */ public synchronized String insert(DataPack dp) { synchronized (syncInsert) { String sql = "INSERT INTO " + dp.getTableName() + "(" + dp.getSetClause() + ")" + " VALUES(" + getQuestionMarks(dp.getDataCount()) + ")"; return getWhereString(dp, sql); } }
/** * Creates an update prepared statement * * @param dp The DataPack object which contains the data to render as an sql string * @return The sql prepared statement we are parsing */ public String update(DataPack dp) { synchronized (syncUpdate) { String statement = "UPDATE " + dp.getTableName() + " SET " + dp.getSetClause(); return getWhereString(dp, statement); } }