Package org.springframework.jdbc.core

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


            schemaPrefix, schemaPrefix, schemaPrefix, key);
    Assert.assertTrue(query, jt.queryForInt(query) == 1);
    query = String
        .format("select count(*) from %sdocument d inner join %sanno_base ab on ab.document_id = d.document_id inner join %sanno_sentence s on s.anno_base_id = ab.anno_base_id where d.instance_id=%s",
            schemaPrefix, schemaPrefix, schemaPrefix, key);
    Assert.assertTrue(query, jt.queryForInt(query) > 1);
    query = String
        .format("select count(*) from %sdocument d inner join %sanno_base ab on ab.document_id = d.document_id inner join %sanno_token s on s.anno_base_id = ab.anno_base_id where d.instance_id=%s",
            schemaPrefix, schemaPrefix, schemaPrefix, key);
    Assert.assertTrue(query, jt.queryForInt(query) > 1);
  }
View Full Code Here


            schemaPrefix, schemaPrefix, schemaPrefix, key);
    Assert.assertTrue(query, jt.queryForInt(query) > 1);
    query = String
        .format("select count(*) from %sdocument d inner join %sanno_base ab on ab.document_id = d.document_id inner join %sanno_token s on s.anno_base_id = ab.anno_base_id where d.instance_id=%s",
            schemaPrefix, schemaPrefix, schemaPrefix, key);
    Assert.assertTrue(query, jt.queryForInt(query) > 1);
  }

}
View Full Code Here

        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

      }
    } finally {
      DataSourceUtils.releaseConnection(con, ds);
    }

    int count = jdbcTemplate.queryForInt("select count(*) from records");
    Assert.assertEquals("Did not load the data correctly", 200, count);

    stopTunnelServer();
    removeService(VCAP_MYSQL_SERVICE);
    logger.info("Time elapsed: " + (System.currentTimeMillis() - start) / 1000.0d + " sec");
View Full Code Here

      }
    } finally {
      DataSourceUtils.releaseConnection(con, ds);
    }

    int count = jdbcTemplate.queryForInt("select count(*) from records");
    Assert.assertEquals("Did not load the data correctly", 200, count);

    stopTunnelServer();
    removeService(VCAP_POSTGRES_SERVICE);
    logger.info("Time elapsed: " + (System.currentTimeMillis() - start) / 1000.0d + " sec");
View Full Code Here

        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

        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

        JdbcTemplate jt = JuConnUtils.asJdbcTemplate(conn);

        jt.execute(String.format("DROP SCHEMA `%s`", schemaInfo.getName()));
       
        for (String user : users) {
          int cnt = jt.queryForInt(String.format("select count(*) from mysql.user where user = '%s'", user));
          if (cnt > 0) {
            jt.execute(String.format("DROP USER `%s`", user));
          }
        }
      }
View Full Code Here

   */
  int internalGetRecentMEBEntries(final Integer userId)
  {
    final JdbcTemplate jdbc = new JdbcTemplate(dataSource);
    try {
      int counter = jdbc.queryForInt("SELECT COUNT(*) FROM t_meb_entry where owner_fk=" + userId + " and status='RECENT'");
      if (accessChecker.isLoggedInUserMemberOfAdminGroup() == true) {
        counter += jdbc.queryForInt("SELECT COUNT(*) FROM t_meb_entry where owner_fk is null");
      }
      return counter;
    } catch (final Exception ex) {
View Full Code Here

  {
    final JdbcTemplate jdbc = new JdbcTemplate(dataSource);
    try {
      int counter = jdbc.queryForInt("SELECT COUNT(*) FROM t_meb_entry where owner_fk=" + userId + " and status='RECENT'");
      if (accessChecker.isLoggedInUserMemberOfAdminGroup() == true) {
        counter += jdbc.queryForInt("SELECT COUNT(*) FROM t_meb_entry where owner_fk is null");
      }
      return counter;
    } catch (final Exception ex) {
      log.error(ex.getMessage(), ex);
      return 0;
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.