Example usage for org.springframework.jdbc.support.rowset SqlRowSet getInt

List of usage examples for org.springframework.jdbc.support.rowset SqlRowSet getInt

Introduction

In this page you can find the example usage for org.springframework.jdbc.support.rowset SqlRowSet getInt.

Prototype

int getInt(String columnLabel) throws InvalidResultSetAccessException;

Source Link

Document

Retrieve the value of the indicated column in the current row as an int.

Usage

From source file:p1.PointDAO.java

public static ArrayList<Point> getPoints() {

    SqlRowSet srs = jt.queryForRowSet("select * from point");
    int x = 0, y = 0, id = 0;
    while (srs.next()) {

        id = srs.getInt("id");
        x = srs.getInt("x");
        y = srs.getInt("y");
        al.add(new Point(id, x, y));

    }/*from   w ww  . j av a  2 s .  c  om*/

    return al;

}

From source file:p1.PointDAO.java

public static Point getPoint(Point p) {

    SqlRowSet srs = jt.queryForRowSet("select * from point where id=" + p.getId());
    int x = 0, y = 0, id = 0;
    Point p1 = null;/*www.j a  v a 2s . c  om*/
    while (srs.next()) {

        x = srs.getInt("x");
        y = srs.getInt("y");
        p1 = new Point(p.getId(), x, y);

    }

    return p1;
}

From source file:org.restsql.core.impl.SqlUtils.java

public static Object getObjectByColumnNumber(final ColumnMetaData column, final SqlRowSet resultSet) {
    Object value = null;//from w  w w  .j a va2  s  .c o  m
    if (column.getColumnType() == Types.DATE && column.getColumnTypeName().equals("YEAR")) {
        value = new Integer(resultSet.getInt(column.getColumnNumber()));
        if (resultSet.wasNull()) {
            value = null;
        }
    } else {
        value = resultSet.getObject(column.getColumnNumber());
    }
    return value;
}

From source file:org.restsql.core.impl.SqlUtils.java

public static Object getObjectByColumnLabel(final ColumnMetaData column, final SqlRowSet resultSet) {
    Object value = null;//w w w .ja va 2 s .c  om
    if (column.getColumnType() == Types.DATE && column.getColumnTypeName().equals("YEAR")) {
        value = new Integer(resultSet.getInt(column.getColumnLabel()));
        if (resultSet.wasNull()) {
            value = null;
        }
    } else {
        value = resultSet.getObject(column.getColumnLabel());
    }

    return value;
}

From source file:edu.pitt.sis.infsci2730.finalProject.service.TransactionService.java

public int GetTranactionTotalAmount(final String id) throws SQLException {
    SqlRowSet s = TransactionDao.GetTranactionTotalAmount(id);
    if (s.next()) {
        return s.getInt(1);
    }//from w  w w  .  j a v a2s.  c om
    return -1;
}

From source file:CRM.repository.UsersDAO.java

public int getUserCount() {
    String sql = "SELECT COUNT(username) AS rowcount FROM users";
    SqlRowSet rs = template.queryForRowSet(sql);

    if (rs.next()) {
        return rs.getInt("rowcount");
    }//www  .j  av  a  2s .  com

    return 1;
}

From source file:lydichris.smashbracket.persistence.UserPersistence.java

public boolean checkEmailExists(String email) {
    String SQL = "select count(username) from users where email = ?";
    SqlRowSet result = jdbcTemplateObject.queryForRowSet(SQL, email);
    if (result.next()) {
        return result.getInt("count(username)") > 0;
    } else {//w  ww  .ja  v  a2 s . c  om
        return false;
    }
}

From source file:CRM.repository.ClientsDAO.java

public int getClientCount() {
    String sql = "SELECT COUNT(client_id) AS rowcount FROM clients";
    SqlRowSet rs = template.queryForRowSet(sql);
    if (rs.next()) {
        return rs.getInt("rowcount");
    }//  ww w. ja v  a2 s.co m

    return 1;
}

From source file:lydichris.smashbracket.persistence.UserPersistence.java

public boolean checkUsernameExists(String username) {
    String SQL = "select count(username) from users where username = ?";
    SqlRowSet result = jdbcTemplateObject.queryForRowSet(SQL, username);
    if (result.next()) {
        return result.getInt("count(username)") > 0;
    } else {/* w ww  . ja va  2 s .  co m*/
        return false;
    }
}

From source file:CRM.repository.InteractionsDAO.java

public int getInteractionsCount() {
    String sql = "SELECT COUNT(interaction_id) AS rowcount FROM interactions";
    SqlRowSet rs = template.queryForRowSet(sql);
    if (rs.next()) {
        return rs.getInt("rowcount");
    }//from  w w  w  . j  a v a 2  s .c o m
    return 1;
}