Java SQL ResultSet Long Read getLongDateFromResultSet(ResultSet rset, Enum field)

Here you can find the source of getLongDateFromResultSet(ResultSet rset, Enum field)

Description

get Long Date From Result Set

License

Open Source License

Declaration

public static Date getLongDateFromResultSet(ResultSet rset, Enum field) throws SQLException 

Method Source Code

//package com.java2s;
/**//  w  ww. j a v  a  2 s .c  o  m
 Copyright (c) 2013, Amit Lieberman
All rights reserved.
    
           GNU LESSER GENERAL PUBLIC LICENSE
               Version 3, 29 June 2007
    
 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.
    
    
  This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License
    
 * Created with love
 * User: shpandrak
 * Date: 10/20/12
 * Time: 10:37
 */

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;

public class Main {
    public static Date getLongDateFromResultSet(ResultSet rset, Enum field) throws SQLException {
        return getLongDateFromResultSet(rset, field.name());
    }

    public static Date getLongDateFromResultSet(ResultSet rset, String fieldName) throws SQLException {
        long retVal = rset.getLong(fieldName);
        return rset.wasNull() ? null : new Date(retVal);
    }
}

Related

  1. getLong(ResultSet resultSet, String columnName)
  2. getLong(ResultSet rs, String colName)
  3. getLong(ResultSet rs, String column)
  4. getLong(ResultSet rs, String columnName)
  5. getLong(ResultSet rs, String columnName)
  6. getLongFromResultSet(ResultSet rs, String db_name)
  7. getLongFromResultSet(ResultSet rs, String field)
  8. getLongList(ResultSet resultSet, String columnName)
  9. getLongOrNull(ResultSet rs, String column)