Java SQL ResultSet Int Read getInt(ResultSet p_rset, int p_col)

Here you can find the source of getInt(ResultSet p_rset, int p_col)

Description

static method for handling positional column gets for int values

License

Open Source License

Parameter

Parameter Description
p_rset ResultSet object on which to perform get
p_col int representing the column position in the ResultSet

Return

int containing the value at p_col, otherwise -1

Declaration

public static final int getInt(ResultSet p_rset, int p_col) 

Method Source Code

//package com.java2s;
/**//from  w  ww.j a v  a  2  s .c o m
 * Database functionality abstraction utilities.
 *
 * Supported drivers:
 * - Oracle
 * - PostgreSQL
 * - MySQL (incomplete)
 * - hsql DB (incomplete)
 * - DB2 (incomplete)
 *
 * Copyright (c) 2001-2004 Marc Lavergne. All rights reserved.
 *
 * The following products are free software; Licensee can redistribute and/or 
 * modify them under the terms of   the GNU Lesser General Public License
 * (http://www.gnu.org/copyleft/lesser.html) as published by the Free Software 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-   1307  USA; 
 * either version 2.1 of the   license, or any later version:
 */

import java.sql.*;

public class Main {
    /**
     * static method for handling positional column gets for int values
     * @param p_rset ResultSet object on which to perform get
     * @param p_col int representing the column position in the ResultSet
     * @return int containing the value at p_col, otherwise -1
     */
    public static final int getInt(ResultSet p_rset, int p_col) {
        try {
            return p_rset.getInt(p_col);
        } catch (SQLException e_sql) {
            return -1;
        }
    }
}

Related

  1. getInt(ResultSet res, String name)
  2. getInt(ResultSet results, int parameterIndex)
  3. getInt(ResultSet rs, int columnIndex)
  4. getInt(ResultSet rs, String column)