Beispiel #1
0
  /**
   * 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;
    }
  }
Beispiel #2
0
 /**
  * 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 + ";";
   }
 }
Beispiel #3
0
 /**
  * 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);
   }
 }
Beispiel #4
0
 /**
  * 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);
   }
 }