Example usage for java.sql ResultSet getBoolean

List of usage examples for java.sql ResultSet getBoolean

Introduction

In this page you can find the example usage for java.sql ResultSet getBoolean.

Prototype

boolean getBoolean(String columnLabel) throws SQLException;

Source Link

Document

Retrieves the value of the designated column in the current row of this ResultSet object as a boolean in the Java programming language.

Usage

From source file:com.leapfrog.SpringMaven.DAOImpl.UserDAOImpl.java

@Override
public List<User> Search(String pattern) throws SQLException, ClassNotFoundException {

    String query = "SELECT * from tbl_user where user_name LIKE ? ";
    return jdbcTemplate.query(query, new Object[] { "%" + pattern + "%" }, new RowMapper<User>() {

        @Override/*  w  w  w . j  a v  a2 s .c  o  m*/
        public User mapRow(ResultSet rs, int i) throws SQLException {
            User user = new User();

            user.setId(rs.getInt("user_id"));
            user.setUserName(rs.getString("user_name"));
            user.setPassword(rs.getString("password"));
            user.setEmail(rs.getString("email"));
            user.setStatus(rs.getBoolean("status"));

            return user;

        }
    });

}

From source file:com.twitter.hdfsdu.TreeSizeByPathServlet.java

@Override
public Iterable<String> getLines(HttpServletRequest request) {
    String paramPath = request.getParameter("path");
    if (paramPath == null) {
        paramPath = "/";
    }//from  w w w.j  ava  2s.c  o  m
    List<String> lines = Lists.newLinkedList();
    List<NodeData> elems = Lists.newArrayList();
    Integer paramDepth = request.getParameter("depth") == null ? 2
            : Integer.parseInt(request.getParameter("depth"));

    try {
        ResultSet resultSet = getSizeByPath(request);
        NodeData data;
        while (resultSet.next()) {
            data = new NodeData();
            data.fileSize = resultSet.getString("size_in_bytes");
            data.nChildren = resultSet.getLong("file_count");
            data.path = resultSet.getString("path");
            data.leaf = resultSet.getBoolean("leaf");
            elems.add(data);
        }
        JSONObject jsonObject = DataTransformer.getJSONTree(paramPath, paramDepth, elems);

        String ans = null;
        if (jsonObject != null) {
            ans = jsonObject.toJSONString();
        }

        if (ans == null) {
            lines.add("{ \"children\": [] }");
        } else {
            lines.add(ans);
        }
    } catch (SQLException e) {
        e.printStackTrace();
    }
    return lines;
}

From source file:ru.mystamps.web.dao.impl.SeriesInfoDtoRowMapper.java

@Override
public SeriesInfoDto mapRow(ResultSet resultSet, int i) throws SQLException {
    Integer seriesId = resultSet.getInt("id");
    Integer releaseDay = JdbcUtils.getInteger(resultSet, "release_day");
    Integer releaseMonth = JdbcUtils.getInteger(resultSet, "release_month");
    Integer releaseYear = JdbcUtils.getInteger(resultSet, "release_year");
    Integer quantity = resultSet.getInt("quantity");
    Boolean perforated = resultSet.getBoolean("perforated");
    Integer categoryId = resultSet.getInt("category_id");
    String categorySlug = resultSet.getString("category_slug");
    String categoryName = resultSet.getString("category_name");
    Integer countryId = JdbcUtils.getInteger(resultSet, "country_id");
    String countrySlug = resultSet.getString("country_slug");
    String countryName = resultSet.getString("country_name");

    return new SeriesInfoDto(seriesId, categoryId, categorySlug, categoryName, countryId, countrySlug,
            countryName, releaseDay, releaseMonth, releaseYear, quantity, perforated);
}

From source file:com.norconex.collector.http.data.store.impl.jdbc.JDBCCrawlDataSerializer.java

@Override
public ICrawlData toCrawlData(String table, ResultSet rs) throws SQLException {
    if (rs == null) {
        return null;
    }/* w w  w . j a  v  a2  s.  c o m*/
    HttpCrawlData data = new HttpCrawlData();
    data.setReference(rs.getString("reference"));
    data.setParentRootReference(rs.getString("parentRootReference"));
    data.setRootParentReference(rs.getBoolean("isRootParentReference"));
    data.setState(HttpCrawlState.valueOf(rs.getString("state")));
    data.setMetaChecksum(rs.getString("metaChecksum"));
    data.setDocumentChecksum(rs.getString("contentChecksum"));
    data.setDepth(rs.getInt("depth"));
    BigDecimal bigLM = rs.getBigDecimal("sitemapLastMod");
    if (bigLM != null) {
        data.setSitemapLastMod(bigLM.longValue());
    }
    BigDecimal bigP = rs.getBigDecimal("sitemapPriority");
    if (bigP != null) {
        data.setSitemapPriority(bigP.floatValue());
    }
    data.setSitemapChangeFreq(rs.getString("sitemapChangeFreq"));
    data.setReferrerReference(rs.getString("referrerReference"));
    data.setReferrerLinkTag(rs.getString("referrerLinkTag"));
    data.setReferrerLinkText(rs.getString("referrerLinkText"));
    data.setReferrerLinkTitle(rs.getString("referrerLinkTitle"));

    return data;
}

From source file:com.ewcms.component.auth.dao.UserDAO.java

@Override
public User getUser(String username) {
    String sql = "Select * From component_auth_user Where username = ?";

    List<User> list = jdbcTemplate.query(sql, new Object[] { username }, new RowMapper<User>() {

        @Override/*from w  w  w . ja v a  2  s.  c  o m*/
        public User mapRow(ResultSet rs, int rowNum) throws SQLException {
            User user = new User();
            user.setUsername(rs.getString("username"));
            user.setName(rs.getString("name"));
            user.setEmail(rs.getString("email"));
            user.setPassword(rs.getString("password"));
            user.setEnabled(rs.getBoolean("enabled"));
            user.setRegisterDate(rs.getTimestamp("register_date"));

            return user;
        }
    });

    return list.isEmpty() ? null : list.get(0);
}

From source file:com.wso2telco.gsma.authenticators.DBUtils.java

/**
 * Get prompt data/*from w w  w .  j a  v a2  s . com*/
 *
 * @param scope
 * @param prompt
 * @param isLoginHintExists
 * @return PromptData
 */
public static PromptData getPromptData(String scope, String prompt, Boolean isLoginHintExists) {
    PromptData promptData = new PromptData();
    Connection connection = null;
    PreparedStatement ps = null;
    ResultSet rs = null;

    String sql = "SELECT * FROM prompt_configuration WHERE scope = ? AND prompt_value = ? AND is_login_hint_exists = ?";

    try {
        connection = getConnectDBConnection();
        ps = connection.prepareStatement(sql);
        ps.setString(1, scope);
        ps.setString(2, prompt);
        ps.setBoolean(3, isLoginHintExists);
        rs = ps.executeQuery();
        while (rs.next()) {
            promptData.setScope(rs.getString("scope"));
            promptData.setLoginHintExists(rs.getBoolean("is_login_hint_exists"));
            promptData.setPromptValue(rs.getString("prompt_value"));
            promptData.setBehaviour(PromptData.behaviorTypes.valueOf(rs.getString("behaviour")));
        }
    } catch (SQLException ex) {
        handleException("Error while retrieving Propmt Data ", ex);
    } finally {
        IdentityDatabaseUtil.closeAllConnections(connection, rs, ps);
        return promptData;
    }
}

From source file:org.tec.webapp.jdbc.entity.impl.UserDbaImpl.java

/** {@inheritDoc} */
@Override()//w w  w  .  j  ava  2s. com
protected UserBean process(ResultSet rs) throws SQLException {
    UserBean user = new User();

    user.setUserId(rs.getInt(COLUMN_USER_ID));
    user.setUserName(rs.getString(COLUMN_USER_NAME));
    //TODO this shouldn't make it passed the server
    user.setPassword(rs.getString(COLUMN_PASSWORD));
    user.setEnabled(rs.getBoolean(COLUMN_ENABLED));
    user.setEmail(rs.getString(COLUMN_EMAIL));

    return user;
}

From source file:net.freechoice.model.orm.Map_Profile.java

@Override
public FC_Profile mapRow(final ResultSet rs, int arg1) throws SQLException {

    FC_Profile prof = new FC_Profile();
    prof.id = rs.getInt(1);//from w w  w.j a  va  2  s .com
    prof.id_user_ = rs.getInt(2);
    prof.date_register = rs.getDate(3);
    prof.site_personal = rs.getString(4);
    prof.name_first = rs.getString(5);
    prof.name_last = rs.getString(6);
    prof.contact_public = rs.getString(7);
    prof.gender = rs.getBoolean(8);
    prof.date_birth = rs.getDate(9);
    return prof;
}