Package org.apache.commons.dbutils

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


        QueryRunner queryRunner = jdbcConnector.getQueryRunner();
        Connection connection = jdbcConnector.getConnection();

        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();
View Full Code Here


        {
            DataSource dataSource = getDefaultDataSource();
            connection = dataSource.getConnection();

            QueryRunner qr = new QueryRunner(dataSource);
            qr.update(connection, "DROP TABLE TestDdl");
        }
        catch (SQLException e)
        {
            // Ignore: table does not exist
        }
View Full Code Here

    }

    public static void executeDdl(Connection connection, String ddl) throws SQLException
    {
        QueryRunner qr = new QueryRunner();
        qr.update(connection, ddl);
    }

    public void executeUpdate(Connection connection, String updateSql) throws SQLException
    {
        QueryRunner qr = new QueryRunner();
View Full Code Here

    }

    public void executeUpdate(Connection connection, String updateSql) throws SQLException
    {
        QueryRunner qr = new QueryRunner();
        int updated = qr.update(connection, updateSql);

        if (logger.isDebugEnabled())
        {
            logger.debug(updated + " rows updated");
        }
View Full Code Here

    {
        QueryRunner qr = new QueryRunner();

        for (Planet planet : testValues)
        {
            int updated = qr.update(connection, getInsertPlanetSql(planet.getName(), planet.getPosition()));

            if (logger.isDebugEnabled())
            {
                logger.debug(updated + " rows updated");
            }
View Full Code Here

    {
        QueryRunner qr = new QueryRunner();

        for (Alien alien : testValues)
        {
            int updated = qr.update(connection, getInsertAlienSql(alien));

            if (logger.isDebugEnabled())
            {
                logger.debug(updated + " rows updated");
            }
View Full Code Here

   */
  protected int execute(String sql, Object[] args) throws DataAccessException {
    QueryRunner qr = getQueryRunner();
    logger.debug("Update SQL:{}", sql);
    try {
      return qr.update(sql, pearParams(args));
    } catch (SQLException e) {
      throw new DataAccessException("update sql error! sql:" + sql + ";", e);
    }
  }

View Full Code Here

        JdbcObjectStore<?> store = muleContext.getRegistry().get("jdbcObjectStore");
        QueryRunner qr = store.getJdbcConnector().getQueryRunner();
       
        try
        {
            qr.update(store.getJdbcConnector().getConnection(), "DELETE FROM IDS");
        }
        catch (Exception e)
        {
        }
       
View Full Code Here

        {
        }
       
        try
        {
            qr.update(store.getJdbcConnector().getConnection(),
                "CREATE TABLE IDS(K VARCHAR(255) NOT NULL PRIMARY KEY, VALUE VARCHAR(255))");
        }
        catch (Exception e)
        {
        }
View Full Code Here

        QueryRunner queryRunner = jdbcConnector.getQueryRunner();
        Connection connection = jdbcConnector.getConnection();

        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();
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.