Examples of queryForInt()


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

        dataId,
        PropLoadTestUtil.convertProp2Str(restore.doChange(PropLoadTestUtil.loadPropFromFile("conf/"
            + configName + fileName))));
    Thread.sleep(3000);
    //�ڴ��������
    actual = jtp.queryForInt(testSql);
    Assert.assertEquals(actual, 1);
    tAtomDataSource.destroyDataSource();
  }

  private TAtomDataSource createTAtomDataSource(String appName, String dbKey, String configName) throws IOException,
View Full Code Here

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

    dataSource.setMaxPoolSize(2);
    //��ʼ��
    dataSource.init();
    JdbcTemplate jtp = new JdbcTemplate();
    jtp.setDataSource(dataSource);
    int actual = jtp.queryForInt("select 1 from dual");
    Assert.assertEquals(actual, 1);
    dataSource.destroyDataSource();
  }
}
View Full Code Here

Examples of org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations.queryForInt()

    MockControl mc = MockControl.createControl(NamedParameterJdbcOperations.class);
    NamedParameterJdbcOperations npjo = (NamedParameterJdbcOperations) mc.getMock();
    Map args = new HashMap(2);
    args.put("id", arg1);
    args.put("xy", arg2);
    npjo.queryForInt(sql, args);
    mc.setDefaultMatcher(new ArrayMatcher());
    mc.setReturnValue(expectedResult);
    mc.replay();

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

Examples of org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations.queryForInt()

    String arg2 = "foo";

    MockControl mc = MockControl.createControl(NamedParameterJdbcOperations.class);
    NamedParameterJdbcOperations npjo = (NamedParameterJdbcOperations) mc.getMock();
    SqlParameterSource args = new MapSqlParameterSource().addValue("id", arg1).addValue("xy", arg2);
    npjo.queryForInt(sql, args);
    mc.setDefaultMatcher(new ArrayMatcher());
    mc.setReturnValue(expectedResult);
    mc.replay();

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

Examples of org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations.queryForInt()

    MockControl mc = MockControl.createControl(NamedParameterJdbcOperations.class);
    NamedParameterJdbcOperations npjo = (NamedParameterJdbcOperations) mc.getMock();
    Map args = new HashMap(2);
    args.put("id", arg1);
    args.put("xy", arg2);
    npjo.queryForInt(sql, args);
    mc.setDefaultMatcher(new ArrayMatcher());
    mc.setReturnValue(expectedResult);
    mc.replay();

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

Examples of org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations.queryForInt()

    String arg2 = "foo";

    MockControl mc = MockControl.createControl(NamedParameterJdbcOperations.class);
    NamedParameterJdbcOperations npjo = (NamedParameterJdbcOperations) mc.getMock();
    SqlParameterSource args = new MapSqlParameterSource().addValue("id", arg1).addValue("xy", arg2);
    npjo.queryForInt(sql, args);
    mc.setDefaultMatcher(new ArrayMatcher());
    mc.setReturnValue(expectedResult);
    mc.replay();

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

Examples of org.springframework.jdbc.core.simple.SimpleJdbcTemplate.queryForInt()

            String msg = "Argument 'person' cannot be null.";
            throw new IllegalArgumentException(msg);
        }
       
        final SimpleJdbcTemplate jdbcTemplate = new SimpleJdbcTemplate(RDBMServices.getDataSource());
        final int struct_count = jdbcTemplate.queryForInt("SELECT COUNT(*) FROM up_layout_struct WHERE user_id = ?", person.getID());
        return struct_count == 0 ? false : true;
       
    }
   
    @SuppressWarnings("unchecked")
View Full Code Here

Examples of org.springframework.jdbc.core.simple.SimpleJdbcTemplate.queryForInt()

        Connection connection = dataSource.getConnection();
        new GroovyMigration("1", script).migrate(DatabaseType.H2, connection);
        connection.close();

        SimpleJdbcTemplate jdbcTemplate = new SimpleJdbcTemplate(dataSource);
        assertThat(jdbcTemplate.queryForInt("select count(*) from users"), is(1));
    }
}
View Full Code Here

Examples of org.springframework.jdbc.core.simple.SimpleJdbcTemplate.queryForInt()

        Connection connection = dataSource.getConnection();
        strategy.enableVersioning(DatabaseType.H2, connection);
        connection.close();

        SimpleJdbcTemplate jdbcTemplate = new SimpleJdbcTemplate(dataSource);
        jdbcTemplate.queryForInt("select count(*)" + VERSION_COLUMN + " from " + TABLE_NAME); // Throws exception is table doesn't exist.
    }

    @Test
    public void testDetermineVersionInUnversionedDatabase() throws SQLException
    {
View Full Code Here

Examples of org.springframework.jdbc.core.simple.SimpleJdbcTemplate.queryForInt()

        strategy.enableVersioning(DatabaseType.H2, connection);
        strategy.recordMigration(DatabaseType.H2, connection, v1, new Date(), 768);
        connection.close();

        SimpleJdbcTemplate jdbcTemplate = new SimpleJdbcTemplate(dataSource);
        assertThat(jdbcTemplate.queryForInt("select count(*) from " + TABLE_NAME), is(1));
        assertThat(jdbcTemplate.queryForObject("select " + VERSION_COLUMN + " from " + TABLE_NAME, String.class), is(v1));

        connection = dataSource.getConnection();
        strategy.recordMigration(DatabaseType.H2, connection, v2, new Date(), 231);
        connection.close();
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.