Examples of queryForInt()


Examples of liquibase.executor.Executor.queryForInt()

          throw new LockException("Did not update change log lock correctly.\n\n"
              + updatedRows
              + " rows were updated instead of the expected 1 row using executor "
              + executor.getClass().getName()
              + " there are "
              + executor.queryForInt(new RawSqlStatement("select count(*) from "
                  + database.getDatabaseChangeLogLockTableName())) + " rows in the table");
        }
        database.commit();
        hasChangeLogLock = false;

View Full Code Here

Examples of net.hasor.db.jdbc.core.JdbcTemplate.queryForInt()

        JdbcTemplate hJDBC = app.getInstance("hsql");
        //3.初始化表
        this.initData(mJDBC, hJDBC);
        //
        System.out.println("MySQL User Count :" + mJDBC.queryForInt("select count(*) from TB_User"));
        System.out.println("HSQL User Count :" + hJDBC.queryForInt("select count(*) from TB_User"));
        //
    }
    private void initData(JdbcTemplate mJDBC, JdbcTemplate hJDBC) throws SQLException, IOException {
        String insertUser_1 = "insert into TB_User values(?,'默罕默德','muhammad','123','muhammad@hasor.net','2011-06-08 20:08:08');";
        String insertUser_2 = "insert into TB_User values(?,'安妮.贝隆','belon','123','belon@hasor.net','2011-06-08 20:08:08');";
View Full Code Here

Examples of net.hasor.db.jdbc.core.JdbcTemplate.queryForInt()

        System.out.println("--->>simple_InsertJDBCTest<<--");
        //
        AppContext app = Hasor.createAppContext("net/test/simple/db/jdbc-config.xml", new OneDataSourceWarp());
        JdbcTemplate jdbc = app.getInstance(JdbcTemplate.class);
        //
        System.out.println(jdbc.queryForInt("select count(*) from TB_User where userUUID='deb4f4c8-5ba1-4f76-8b4a-c2be028bf57b'"));
        //
        String insertUser = "insert into TB_User values('deb4f4c8-5ba1-4f76-8b4a-c2be028bf57b','安妮.贝隆','belon','123','belon@hasor.net','2011-06-08 20:08:08');";
        jdbc.execute(insertUser);//执行插入语句
        //
        System.out.println(jdbc.queryForInt("select count(*) from TB_User where userUUID='deb4f4c8-5ba1-4f76-8b4a-c2be028bf57b'"));
View Full Code Here

Examples of net.hasor.db.jdbc.core.JdbcTemplate.queryForInt()

        System.out.println(jdbc.queryForInt("select count(*) from TB_User where userUUID='deb4f4c8-5ba1-4f76-8b4a-c2be028bf57b'"));
        //
        String insertUser = "insert into TB_User values('deb4f4c8-5ba1-4f76-8b4a-c2be028bf57b','安妮.贝隆','belon','123','belon@hasor.net','2011-06-08 20:08:08');";
        jdbc.execute(insertUser);//执行插入语句
        //
        System.out.println(jdbc.queryForInt("select count(*) from TB_User where userUUID='deb4f4c8-5ba1-4f76-8b4a-c2be028bf57b'"));
    }
}
View Full Code Here

Examples of org.springframework.jdbc.core.JdbcOperations.queryForInt()

    String sql = "SELECT COUNT(0) FROM BAR";
    int expectedResult = 666;

    MockControl mc = MockControl.createControl(JdbcOperations.class);
    JdbcOperations jo = (JdbcOperations) mc.getMock();
    jo.queryForInt(sql);
    mc.setReturnValue(expectedResult);
    mc.replay();

    SimpleJdbcTemplate jth = new SimpleJdbcTemplate(jo);
View Full Code Here

Examples of org.springframework.jdbc.core.JdbcOperations.queryForInt()

    int arg1 = 24;
    String arg2 = "foo";

    MockControl mc = MockControl.createControl(JdbcOperations.class);
    JdbcOperations jo = (JdbcOperations) mc.getMock();
    jo.queryForInt(sql, new Object[]{arg1, arg2});
    mc.setDefaultMatcher(new ArrayMatcher());
    mc.setReturnValue(expectedResult);
    mc.replay();

    SimpleJdbcTemplate jth = new SimpleJdbcTemplate(jo);
View Full Code Here

Examples of org.springframework.jdbc.core.JdbcOperations.queryForInt()

    String sql = "SELECT COUNT(0) FROM BAR";
    int expectedResult = 666;

    MockControl mc = MockControl.createControl(JdbcOperations.class);
    JdbcOperations jo = (JdbcOperations) mc.getMock();
    jo.queryForInt(sql);
    mc.setReturnValue(expectedResult);
    mc.replay();

    SimpleJdbcTemplate jth = new SimpleJdbcTemplate(jo);
View Full Code Here

Examples of org.springframework.jdbc.core.JdbcOperations.queryForInt()

    int arg1 = 24;
    String arg2 = "foo";

    MockControl mc = MockControl.createControl(JdbcOperations.class);
    JdbcOperations jo = (JdbcOperations) mc.getMock();
    jo.queryForInt(sql, new Object[]{arg1, arg2});
    mc.setDefaultMatcher(new ArrayMatcher());
    mc.setReturnValue(expectedResult);
    mc.replay();

    SimpleJdbcTemplate jth = new SimpleJdbcTemplate(jo);
View Full Code Here

Examples of org.springframework.jdbc.core.JdbcTemplate.queryForInt()

        assertTrue(userTO.getPropagationTOs().isEmpty());

        Exception exception = null;
        try {
            jdbcTemplate.queryForInt("SELECT id FROM test WHERE id=?", userTO.getUsername());
        } catch (EmptyResultDataAccessException e) {
            exception = e;
        }
        assertNotNull(exception);
View Full Code Here

Examples of org.springframework.jdbc.core.JdbcTemplate.queryForInt()

    // initialize drop procedure, if database has been dropped
    jdbcTemplate.execute(new ResourceUtil(DROP_FUNCTION.getURI()).getContent());

    // drop previous function version, if necessary
    jdbcTemplate.queryForInt("select util.drop_function( ?,? )",
        dbFunction.getSchema(), dbFunction.getFunctionName());

    // load new function body
    jdbcTemplate.execute(new ResourceUtil(dbFunction.getURI()).getContent());
  }
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.