Package org.apache.commons.dbutils

Examples of org.apache.commons.dbutils.QueryRunner.query()


      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


   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

        MuleClient client = new MuleClient(muleContext);
        client.send("jdbc://writeTest?type=2", new DefaultMuleMessage(TEST_MESSAGE, muleContext));

        QueryRunner qr = jdbcConnector.getQueryRunner();
        Object[] obj2 =
            (Object[]) qr.query(jdbcConnector.getConnection(), "SELECT DATA FROM TEST WHERE TYPE = 2", new ArrayHandler());
        assertNotNull(obj2);
        assertEquals(1, obj2.length);
        assertEquals(TEST_MESSAGE, obj2[0]);
    }
View Full Code Here

        map.put("data", TEST_MESSAGE);
        client.send("jdbc://writeMap?type=2", new DefaultMuleMessage(map, muleContext));

        QueryRunner qr = jdbcConnector.getQueryRunner();
        Object[] obj2 =
            (Object[]) qr.query(jdbcConnector.getConnection(), "SELECT DATA FROM TEST WHERE TYPE = 2", new ArrayHandler());
        assertNotNull(obj2);
        assertEquals(1, obj2.length);
        assertEquals(TEST_MESSAGE, obj2[0]);
    }
View Full Code Here

        long t0 = System.currentTimeMillis();
        while (System.currentTimeMillis() - t0 < 20000)
        {
            Object[] rs =
                (Object[]) qr.query(jdbcConnector.getConnection(), "SELECT COUNT(*) FROM TEST WHERE TYPE = 2", new ArrayHandler());
            assertNotNull(rs);
            assertEquals(1, rs.length);
            if (((Number)rs[0]).intValue() > 0)
            {
                break;
View Full Code Here

            }
            Thread.sleep(100);
        }

        Object[] obj2 =
            (Object[]) qr.query(jdbcConnector.getConnection(), "SELECT DATA FROM TEST WHERE TYPE = 2", new ArrayHandler());
        assertNotNull(obj2);
        assertEquals(1, obj2.length);
        assertEquals(TEST_MESSAGE + " Received", obj2[0]);
    }
}
View Full Code Here

        for (int i = 0; i < TEST_ROWS; i++)
        {
            queryRunner.update(connection, "INSERT INTO TEST(TYPE, DATA) VALUES (1, 'Test " + i + "')");
        }
        List<?> results = (List<?>) queryRunner.query(connection, "SELECT * FROM TEST WHERE TYPE = 1", new ArrayListHandler());
        assertEquals(TEST_ROWS, results.size());

        long t0 = System.currentTimeMillis();
        while (true)
        {
View Full Code Here

        assertEquals(TEST_ROWS, results.size());

        long t0 = System.currentTimeMillis();
        while (true)
        {
            results = (List<?>) queryRunner.query(connection, "SELECT * FROM TEST_OUT", new ArrayListHandler());
            logger.info("Results found: " + results.size());
            if (results.size() >= TEST_ROWS)
            {
                break;
            }
View Full Code Here

            logger.info("Results found: " + results.size());
            if (results.size() >= TEST_ROWS)
            {
                break;
            }
            results = (List<?>) queryRunner.query(connection, "SELECT * FROM TEST WHERE TYPE = 2", new ArrayListHandler());
            logger.info("Locked records found: " + results.size());
            assertTrue(TEST_ROWS >= results.size());           
           
            results = (List<?>) queryRunner.query(connection, "SELECT * FROM TEST WHERE TYPE = 1", new ArrayListHandler());
            logger.info("Original records found: " + results.size());
View Full Code Here

            }
            results = (List<?>) queryRunner.query(connection, "SELECT * FROM TEST WHERE TYPE = 2", new ArrayListHandler());
            logger.info("Locked records found: " + results.size());
            assertTrue(TEST_ROWS >= results.size());           
           
            results = (List<?>) queryRunner.query(connection, "SELECT * FROM TEST WHERE TYPE = 1", new ArrayListHandler());
            logger.info("Original records found: " + results.size());
            assertTrue(TEST_ROWS >= results.size());
           
            assertTrue(System.currentTimeMillis() - t0 < 20000);
            Thread.sleep(500);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.