Package org.apache.commons.dbutils

Examples of org.apache.commons.dbutils.QueryRunner


  private static void generateProcesses(MySQLHelper helper, int start, int end) throws SQLException {
    String propNames = "ProzesseID, Titel, IstTemplate, erstellungsdatum, ProjekteID, MetadatenKonfigurationID,inAuswahllisteAnzeigen, sortHelperStatus";
    StringBuilder propValues = new StringBuilder();
    Timestamp datetime = new Timestamp(new Date().getTime());
    Connection connection = helper.getConnection();
    QueryRunner run = new QueryRunner();
    for (int processId = start; processId <= end; processId++) {
      propValues.append("(" + processId + ", 'title" + processId + "', false, '" + datetime + "', 3, 1, false, '020000080' ),");

      if (processId % 5000 == 0) {
        String values = propValues.toString();
        values = values.substring(0, values.length() - 1);
        String sql = "INSERT INTO " + "prozesse" + " (" + propNames + ") VALUES " + values + ";";
        run.update(connection, sql);
        propValues = new StringBuilder();
      }

    }
  }
View Full Code Here


  private static void generateProcessProperties(MySQLHelper helper2, int start, int end) throws SQLException {
    String propNames = "Titel, WERT, IstObligatorisch, DatentypenID, Auswahl, prozesseID, creationDate,container";
    StringBuilder propValues = new StringBuilder();
    Timestamp datetime = new Timestamp(new Date().getTime());
    Connection connection = helper.getConnection();
    QueryRunner run = new QueryRunner();
    for (int processId = start; processId <= end; processId++) {
      propValues.append("('title', '" + processId + "', false, 5, NULL, " + processId + ",'" + datetime + "',0" + "),");
      if (processId % 5000 == 0) {
        String values = propValues.toString();
        values = values.substring(0, values.length() - 1);
        String sql = "INSERT INTO " + "prozesseeigenschaften" + " (" + propNames + ") VALUES " + values + ";";
        run.update(connection, sql);
        propValues = new StringBuilder();
      }
    }
  }
View Full Code Here

    String userNames = "schritteID, BenutzerID";
    StringBuilder userProps = new StringBuilder();
    int stepId = 100000;
    StringBuilder propValues = new StringBuilder();
    Connection connection = helper.getConnection();
    QueryRunner run = new QueryRunner();
    for (int processId = start; processId <= end; processId++) {
      userProps.append("(" + stepId + ", 1 ),");
      propValues.append("(" + stepId++ + ",'start',1,1,1,false, ''," + processId
          + ", false, '', 0, false, false, false, false, false, false, false, false, false, false" + "),");
      userProps.append("(" + stepId + ", 1 ),");
      propValues.append("(" + stepId++ + ",'automatisch01',1,2,0,true, '/bin/bash /opt/digiverso/goobi/scripts/dummy2.sh (stepid)',"
          + processId + ", true, 'dummy', 0, false, false, false, false, false, false, false, false, false, false" + "),");
      userProps.append("(" + stepId + ", 1 ),");
      propValues.append("(" + stepId++ + ",'automatisch02',1,3,0,true, '/bin/bash /opt/digiverso/goobi/scripts/dummy2.sh (stepid)',"
          + processId + ", true, 'dummy', 0, false, false, false, false, false, false, false, false, false, false" + "),");
      userProps.append("(" + stepId + ", 1 ),");
      propValues.append("(" + stepId++ + ",'automatisch03',1,4,0,true, '/bin/bash /opt/digiverso/goobi/scripts/dummy2.sh (stepid)',"
          + processId + ", true, 'dummy', 0, false, false, false, false, false, false, false, false, false, false" + "),");
      userProps.append("(" + stepId + ", 1 ),");
      propValues.append("(" + stepId++ + ",'automatisch04',1,5,0,true, '/bin/bash /opt/digiverso/goobi/scripts/dummy2.sh (stepid)',"
          + processId + ", true, 'dummy', 0, false, false, false, false, false, false, false, false, false, false" + "),");
      userProps.append("(" + stepId + ", 1 ),");
      propValues.append("(" + stepId++ + ",'automatisch05',1,6,0,true, '/bin/bash /opt/digiverso/goobi/scripts/dummy2.sh (stepid)',"
          + processId + ", true, 'dummy', 0, false, false, false, false, false, false, false, false, false, false" + "),");
      userProps.append("(" + stepId + ", 1 ),");
      propValues.append("(" + stepId++ + ",'automatisch06',1,7,0,true, '/bin/bash /opt/digiverso/goobi/scripts/dummy2.sh (stepid)',"
          + processId + ", true, 'dummy', 0, false, false, false, false, false, false, false, false, false, false" + "),");
      userProps.append("(" + stepId + ", 1 ),");
      propValues.append("(" + stepId++ + ",'automatisch07',1,8,0,true, '/bin/bash /opt/digiverso/goobi/scripts/dummy2.sh (stepid)',"
          + processId + ", true, 'dummy', 0, false, false, false, false, false, false, false, false, false, false" + "),");
      userProps.append("(" + stepId + ", 1 ),");
      propValues.append("(" + stepId++ + ",'automatisch08',1,9,0,true, '/bin/bash /opt/digiverso/goobi/scripts/dummy2.sh (stepid)',"
          + processId + ", true, 'dummy', 0, false, false, false, false, false, false, false, false, false, false" + "),");
      userProps.append("(" + stepId + ", 1 ),");
      propValues.append("(" + stepId++ + ",'automatisch09',1,10,0,true, '/bin/bash /opt/digiverso/goobi/scripts/dummy2.sh (stepid)',"
          + processId + ", true, 'dummy', 0, false, false, false, false, false, false, false, false, false, false" + "),");
      userProps.append("(" + stepId + ", 1 ),");
      propValues.append("(" + stepId++ + ",'automatisch10',1,11,0,true, '/bin/bash /opt/digiverso/goobi/scripts/dummy2.sh (stepid)',"
          + processId + ", true, 'dummy', 0, false, false, false, false, false, false, false, false, false, false" + "),");
      if (processId % 5000 == 0) {
        String values = propValues.toString();
        values = values.substring(0, values.length() - 1);
        String sql = "INSERT INTO " + "schritte" + " (" + propNames + ") VALUES " + values + ";";
        run.update(connection, sql);
        propValues = new StringBuilder();

        String userValues = userProps.toString();
        userValues = userValues.substring(0, userValues.length() - 1);
        String userSql = "INSERT INTO " + "schritteberechtigtebenutzer" + " (" + userNames + ") VALUES " + userValues + ";";
        run.update(connection, userSql);
        userProps = new StringBuilder();
      }
    }
  }
View Full Code Here

                .forEach(System.out::println);

            System.out.println();
            System.out.println("Fetching data into a lambda expression with Apache DbUtils");
            System.out.println("-------------------------------------------------------");
            new QueryRunner()
                .query(c, sql,
                    new ArrayListHandler())
                .stream()
                .map(array -> new Schema(
                    (String) array[0],
View Full Code Here

      this.statements = statements;
   }

   public Collection<String> getStores(Connection connection) throws SQLException
   {
      final QueryRunner runner = new QueryRunner();
      final ArrayList<String> stores = new ArrayList<String>();

      Hermes.ui.getDefaultMessageSink().add("Getting message stores....");

      runner.query(connection, statements.getStoresStatement(), new ResultSetHandler()
      {
         public Object handle(ResultSet rs) throws SQLException
         {
            while (rs.next())
            {
View Full Code Here

      return stores;
   }

   public void remove(Connection connection, String storeId) throws SQLException
   {
      final QueryRunner runner = new QueryRunner();

      for (final String statment : statements.getRemoveStoreStatements())
      {
         runner.update(connection, statment, new Object[] { storeId });
      }
   }
View Full Code Here

      pstmt.setAsciiStream(2, messageAsXML, messageAsXMLString.length());

      pstmt.execute();
      pstmt.close();

      final QueryRunner runner = new QueryRunner();

      runner.update(connection, "insert into stores values (?, ?, ?, ?)", new Object[] { storeId, destinationName, domain.getId(), messageId });
   }
View Full Code Here

      runner.update(connection, "insert into stores values (?, ?, ?, ?)", new Object[] { storeId, destinationName, domain.getId(), messageId });
   }

   public void remove(Connection connection, String storeId, String destination) throws SQLException, JMSException
   {
      final QueryRunner runner = new QueryRunner();

      if (runner.update(connection, "delete from messages where messageid in (select messageid from stores where storeid=? and destination=?)", new Object[] {
            storeId, destination }) > 0)
      {
         runner.update(connection, "delete from stores where storeid=? and destination=?", new Object[] { storeId, destination });
      }
   }
View Full Code Here

      }
   }

   public void remove(Connection connection, String storeId, Message message) throws SQLException, JMSException
   {
      final QueryRunner runner = new QueryRunner();

      if (runner.update(connection, "delete from stores where storeid=? and messageid=?", new Object[] { storeId, message.getJMSMessageID() }) > 0)
      {
         runner.update(connection, "delete from messages where messageid=?", new Object[] { message.getJMSMessageID() });
      }
      else
      {
         throw new SQLException("No message id=" + message.getJMSMessageID() + " exists in store=" + storeId);
      }
View Full Code Here

   }

   public Collection<Destination> getDestinations(Connection connection, String storeId) throws SQLException, JMSException
   {
      final Collection<Destination> destinations = new ArrayList<Destination>();
      final QueryRunner runner = new QueryRunner();

      Hermes.ui.getDefaultMessageSink().add("Getting message store destinations....");

      runner.query(connection, "select distinct destination, domain from stores where storeId=? ", new Object[] { storeId },
            new ResultSetHandler()
            {
               public Object handle(ResultSet rs) throws SQLException
               {
                  while (rs.next())
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.