Here you can find the source of getObject(ResultSet set, int columnIndex)
Parameter | Description |
---|---|
set | a parameter |
columnIndex | a parameter |
Parameter | Description |
---|---|
SQLException | an exception |
public static Object getObject(ResultSet set, int columnIndex) throws SQLException
//package com.java2s; // %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt import java.sql.ResultSet; import java.sql.SQLException; public class Main { private static final String NULLDATE = "0000-00-00 00:00:00"; /**/* www . j av a2 s . c om*/ * * Get Object by special column index * * @param set * @param columnIndex * @return * @throws SQLException */ public static Object getObject(ResultSet set, int columnIndex) throws SQLException { Object object = null; try { object = set.getObject(columnIndex); } catch (SQLException e) { if (NULLDATE.equals(set.getString(columnIndex))) { object = null; } else { throw e; } } return object; } /** * * Get Object by special column name * * @param set * @param columnName * @return * @throws SQLException */ public static Object getObject(ResultSet set, String columnName) throws SQLException { Object object = null; try { object = set.getObject(columnName); } catch (SQLException e) { if (NULLDATE.equals(set.getString(columnName))) { object = null; } else { throw e; } } return object; } }