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:CRM.repository.InteractionsDAO.java

public Map<Integer, String> getClientsMap() {
    Map<Integer, String> clients = new LinkedHashMap<Integer, String>();
    String sql = "SELECT client_id, first_name,last_name FROM clients";

    SqlRowSet srs = template.queryForRowSet(sql);

    while (srs.next()) {
        clients.put(srs.getInt("client_id"), srs.getString("first_name") + " " + srs.getString("last_name"));
    }/* ww  w  .  j a va  2 s  .c om*/
    return clients;
}

From source file:repository.InteractionsDAO.java

public int getInteractionsCount() {
    String sql = "SELECT COUNT(interactionid) AS irow FROM interactions";
    SqlRowSet rs = template.queryForRowSet(sql);

    if (rs.next()) {
        return rs.getInt("irow");
    }// w w  w.  jav  a2 s .  co  m

    return 1;
}

From source file:repository.InteractionsDAO.java

public Map<Integer, String> getClientInteractMap() {
    Map<Integer, String> Clients = new LinkedHashMap<Integer, String>();
    String sql = "SELECT id, firstname, lastname FROM clients ORDER BY firstname";

    SqlRowSet rs = template.queryForRowSet(sql);

    while (rs.next()) {
        Clients.put(rs.getInt(1), rs.getString(2) + " " + rs.getString(3));
    }//  w w w  .  j  a v  a2 s. c  o  m

    return Clients;
}

From source file:mylife.respository.userDAO.java

/**
 *
 * @return/*from w  w  w .  ja v  a2  s.c o  m*/
 */
public int getuserCount() {
    String sql = "SELECT COUNT(username) AS rowcount FROM users";
    SqlRowSet rs = template.queryForRowSet(sql);

    if (rs.next()) {
        return rs.getInt("rowcount");
    }

    return 1;
}

From source file:mylife.respository.interactionsDAO.java

/**
 *
 * @return// w  w  w. jav a 2  s.  c  o m
 */
public int getinteractionsCount() {
    String sql = "SELECT COUNT(interactioniD) AS rowcount FROM interactions";
    SqlRowSet rs = template.queryForRowSet(sql);

    if (rs.next()) {
        return rs.getInt("rowcount");
    }

    return 1;
}

From source file:mylife.respository.client1DAO.java

/**
 *
 * @return/*from   ww  w . ja va 2 s  .com*/
 */
public int getclient1Count() {
    String sql = "SELECT COUNT(idclient1) AS rowcount FROM client1";
    SqlRowSet rs = template.queryForRowSet(sql);

    if (rs.next()) {
        return rs.getInt("rowcount");
    }

    return 1;
}

From source file:edu.uca.aca2016.impulse.repository.UsersDAO.java

/**
 *getUsersCount method and SQL Query/*from  ww w.  ja v a  2 s .  com*/
 * @return
 */
public int getUsersCount() {
    String sql = "SELECT COUNT(username) AS rowcount FROM users";
    SqlRowSet rs = template.queryForRowSet(sql);

    if (rs.next()) {
        return rs.getInt("rowcount");
    }

    return 1;
}

From source file:mylife.respository.interactionsDAO.java

/**
 *
 * @return/* ww  w. j a  v a2 s  .  com*/
 */
public Map<Integer, String> getclient1Map() {
    Map<Integer, String> client1 = new LinkedHashMap<Integer, String>();
    String sql = "SELECT idclient1, firstname FROM client1 ORDER BY firstname";

    SqlRowSet rs = template.queryForRowSet(sql);

    while (rs.next()) {
        client1.put(rs.getInt(1), rs.getString(2));
    }

    return client1;
}

From source file:edu.uca.aca2016.impulse.repository.ClientDAO.java

/**
 *getClientCount method and SQL Query/*from   w  ww  .  j a  v  a2s  .  c om*/
 * @return
 */
public int getClientCount() {
    String sql = "SELECT COUNT(ClientID) AS rowcount FROM client";
    SqlRowSet rs = template.queryForRowSet(sql);

    if (rs.next()) {
        return rs.getInt("rowcount");
    }

    return 1;
}

From source file:edu.uca.aca2016.impulse.repository.InteractionsDAO.java

/**
 *getInteractionsCount method and SQL Query
 * @return// ww  w. j a  va 2s .  c om
 */
public int getInteractionCount() {
    String sql = "SELECT COUNT(InteractionID) AS rowcount FROM interactions";
    SqlRowSet rs = template.queryForRowSet(sql);

    if (rs.next()) {
        return rs.getInt("rowcount");
    }

    return 1;
}