Package org.apache.commons.dbutils

Examples of org.apache.commons.dbutils.QueryRunner


   }

   public QueueBrowser getMessages(Connection connection, String storeId, Destination destination, MessageFactory messageFactory,
         MessageStore.HeaderPolicy headerPolicy) throws SQLException, JMSException
   {
      final QueryRunner runner = new QueryRunner();
      final PreparedStatement stmt = createPreparedStatement(
            connection,
            "select stores.destination, stores.domain, messages.message, messages.messageid from stores, messages where stores.storeId=? and destination=? and stores.messageid = messages.messageid order by messages.messageid",
            new Object[] { storeId, messageFactory.getDestinationName(destination) });
View Full Code Here


   }

   public QueueBrowser getMessages(Connection connection, String storeId, final MessageFactory messageFactory, MessageStore.HeaderPolicy headerPolicy)
         throws SQLException, JMSException
   {
      final QueryRunner runner = new QueryRunner();
      final PreparedStatement stmt = createPreparedStatement(
            connection,
            "select stores.destination, stores.domain, messages.message, messages.messageid from stores, messages where stores.storeId=? and stores.messageid = messages.messageid order by messages.messageid",
            new Object[] { storeId });
View Full Code Here

         progressMonitor.setMillisToDecideToPopup(100);
         progressMonitor.setMillisToPopup(400);
      }

      final QueryRunner runner = new QueryRunner();

      for (int i = 0; i < statements.length; i++)
      {
         try
         {
            log.debug("executing: " + statements[i]);

            if (progressMonitor != null)
            {
               progressMonitor.setProgress(statements.length);
               progressMonitor.setNote("Executing statement " + i + " of " + statements.length);
            }

            runner.update(connection, statements[i]);
         }
         catch (SQLException ex)
         {
            log.error(ex.getMessage());
         }
View Full Code Here

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

         runner.update(connection, "insert into storeInfo values ( ? )", new Object[] { storeId });
      }
      catch (SQLException ex)
      {
         log.debug("swallowing " + ex.getMessage());
      }
View Full Code Here

      Hermes.ui.getDefaultMessageSink().add("Initialising message stores... done.");
   }

   public int getDepth(Connection connection, String storeId, Destination destination) throws SQLException, JMSException
   {
      final QueryRunner runner = new QueryRunner();

      return (Integer) runner.query(connection, statements.getDepthStatement(), new Object[] { storeId, JMSUtils.getDestinationName(destination) },
            new ResultSetHandler()
            {
               public Object handle(ResultSet rs) throws SQLException
               {
                  rs.next();
View Full Code Here

    ServletModule createServletModule() {
        return new ServletModule() {
            @Override
            protected void configureServlets() {
                bind(DataSource.class).toInstance(pool);
                bind(QueryRunner.class).toInstance(new QueryRunner(pool));
            }
        };
    }
View Full Code Here

    public QueryRunnerProvider(ServletContext servletContext) throws Exception {
        Class.forName("org.h2.Driver");

        JdbcConnectionPool pool = JdbcConnectionPool.create("jdbc:h2:" + servletContext.getRealPath("/WEB-INF/h2") + ";LOCK_MODE=0", "sa", "");

        qr = new QueryRunner(pool);

        Object obj = qr.query("show tables", new ScalarHandler<Object>());
        if (obj == null) {
            //create tables
            StringBuilder sb = new StringBuilder();
View Full Code Here

    {
        Connection con = null;
        try
        {
            con = getConnection();
            return (List) new QueryRunner().query(con, sql, new ArrayListHandler());
        }
        finally
        {
            JdbcUtils.close(con);
        }
View Full Code Here

    {
        Connection con = null;
        try
        {
            con = getConnection();
            return new QueryRunner().update(con, sql);
        }
        finally
        {
            JdbcUtils.close(con);
        }
View Full Code Here

    {
        Connection con = null;
        try
        {
            con = getConnection();
            return (List)new QueryRunner().query(con, sql, new ArrayListHandler());
        }
        finally
        {
            JdbcUtils.close(con);
        }
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.