Package org.apache.commons.dbutils

Examples of org.apache.commons.dbutils.QueryRunner


    StringBuilder sql = new StringBuilder();
    sql.append("SELECT * FROM werkstueckeeigenschaften WHERE werkstueckeeigenschaften.werkstueckeID = (SELECT werkstueckeID FROM werkstuecke WHERE ProzesseID = ? )");
    try {
      Object[] params = { processId };
      logger.debug(sql.toString() + ", " + processId);
      List<Property> answer = new QueryRunner().query(connection, sql.toString(), MySQLUtils.resultSetToProductPropertyListHandler, params);
      return answer;
    } finally {
      closeConnection(connection);
    }
  }
View Full Code Here


    StringBuilder sql = new StringBuilder();
    sql.append("SELECT * FROM prozesse WHERE ProzesseID = ? ");
    try {
      Object[] params = { processId };
      logger.debug(sql.toString() + ", " + processId);
      ProcessObject answer = new QueryRunner().query(connection, sql.toString(), MySQLUtils.resultSetToProcessHandler, params);
      return answer;
    } finally {
      closeConnection(connection);
    }

View Full Code Here

    StringBuilder sql = new StringBuilder();
    sql.append("SELECT * FROM metadatenkonfigurationen WHERE MetadatenKonfigurationID = ? ");
    try {
      Object[] params = { rulesetId };
      logger.debug(sql.toString() + ", " + rulesetId);
      Regelsatz ret = new QueryRunner().query(connection, sql.toString(), MySQLUtils.resultSetToRulesetHandler, params);
      return ret;
    } finally {
      closeConnection(connection);
    }
  }
View Full Code Here

    // sql.append(" ORDER BY Reihenfolge ASC");

    try {
      Object[] params = { stepId };
      logger.debug(sql.toString() + ", " + stepId);
      StepObject ret = new QueryRunner().query(connection, sql.toString(), MySQLUtils.resultSetToStepObjectHandler, params);
      return ret;
    } finally {
      closeConnection(connection);
    }
  }
View Full Code Here

    StringBuilder sql = new StringBuilder();
    sql.append("SELECT * FROM schritte WHERE SchritteID = ? ");
    try {
      Object[] params = { stepId };
      logger.debug(sql.toString() + ", " + stepId);
      List<String> ret = new QueryRunner().query(connection, sql.toString(), MySQLUtils.resultSetToScriptsHandler, params);
      return ret;
    } finally {
      closeConnection(connection);
    }
  }
View Full Code Here

    StringBuilder sql = new StringBuilder();
    sql.append("SELECT * FROM schritte WHERE SchritteID = ? ");
    try {
      Object[] params = { stepId };
      logger.debug(sql.toString() + ", " + stepId);
      Map<String, String> ret = new QueryRunner().query(connection, sql.toString(), MySQLUtils.resultSetToScriptMapHandler, params);
      return ret;
    } finally {
      closeConnection(connection);
    }
  }
View Full Code Here

  public int updateStep(StepObject step) throws SQLException {
    int ret = -1;
    Connection connection = helper.getConnection();
    try {

      QueryRunner run = new QueryRunner();
      StringBuilder sql = new StringBuilder();
      sql.append("UPDATE schritte SET Titel = ? , ");
      sql.append("Reihenfolge = ? , ");
      sql.append("Bearbeitungsstatus = ? , ");
      Timestamp time = null;
      sql.append("BearbeitungsZeitpunkt = ? , ");
      if (step.getBearbeitungszeitpunkt() != null) {
        time = new Timestamp(step.getBearbeitungszeitpunkt().getTime());

      }
      Timestamp start = null;
      sql.append("BearbeitungsBeginn = ? , ");
      if (step.getBearbeitungsbeginn() != null) {
        start = new Timestamp(step.getBearbeitungsbeginn().getTime());
      }
      Timestamp end = null;
      sql.append("BearbeitungsEnde = ? , ");
      if (step.getBearbeitungsende() != null) {
        end = new Timestamp(step.getBearbeitungsende().getTime());
      }

      sql.append("BearbeitungsBenutzerID = ? , ");
      sql.append("edittype = ?, ");
      sql.append("typAutomatisch = ? ");
      sql.append(" WHERE SchritteID = ? ");
      Object[] param = { step.getTitle(), step.getReihenfolge(), step.getBearbeitungsstatus(), time, start, end,
          step.getBearbeitungsbenutzer(), step.getEditType(), step.isTypAutomatisch(), step.getId() };
      logger.debug("saving step: " + sql.toString() + ", " + param);

      run.update(connection, sql.toString(), param);
      // logger.debug(sql);
      ret = step.getId();
      return ret;
    } finally {
      closeConnection(connection);
View Full Code Here

  public void addHistory(Date date, double order, String value, int type, int processId) throws SQLException {
    Connection connection = helper.getConnection();
    Timestamp datetime = new Timestamp(date.getTime());

    try {
      QueryRunner run = new QueryRunner();
      // String propNames = "numericValue, stringvalue, type, date, processId";
      Object[] param = { order, value, type, datetime, processId };
      String sql = "INSERT INTO " + "history" + " (numericValue, stringvalue, type, date, processId) VALUES ( ?, ?, ?, ? ,?)";
      logger.trace("added history event " + sql + ", " + param);
      run.update(connection, sql, param);
    } finally {
      closeConnection(connection);
    }
  }
View Full Code Here

 
  public void updateProcessStatus(String value, int processId) throws SQLException {
    Connection connection = helper.getConnection();
    try {
      QueryRunner run = new QueryRunner();
      StringBuilder sql = new StringBuilder();
      Object[] param = { value, processId };
      sql.append("UPDATE prozesse SET sortHelperStatus = ? WHERE ProzesseID = ?");
      logger.debug(sql.toString() + ", " + param);
      run.update(connection, sql.toString(), param);
    } finally {
      closeConnection(connection);
    }
  }
View Full Code Here

  }

  public void updateImages(Integer numberOfFiles, int processId) throws SQLException {
    Connection connection = helper.getConnection();
    try {
      QueryRunner run = new QueryRunner();
      StringBuilder sql = new StringBuilder();
      Object[] param = { numberOfFiles, processId };
      sql.append("UPDATE prozesse SET sortHelperImages = ? WHERE ProzesseID = ?");
      logger.debug(sql.toString() + ", " + param);
      run.update(connection, sql.toString(), param);
    } finally {
      closeConnection(connection);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.commons.dbutils.QueryRunner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.