List of usage examples for java.sql ResultSet wasNull
boolean wasNull() throws SQLException;
NULL
. From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskXMsgClient.CFAsteriskXMsgClientSchema.java
public static Integer getNullableInt32(ResultSet reader, int colidx) { try {/*from ww w . j a va 2 s . co m*/ int val = reader.getInt(colidx); if (reader.wasNull()) { return (null); } else { return (new Integer(val)); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(CFAsteriskXMsgClientSchema.class, "getNullableInt32", e); } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskXMsgClient.CFAsteriskXMsgClientSchema.java
public static Integer getNullableUInt16(ResultSet reader, int colidx) { try {//from w w w . j a v a 2 s. c om int val = reader.getInt(colidx); if (reader.wasNull()) { return (null); } else { return (new Integer(val)); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(CFAsteriskXMsgClientSchema.class, "getNullableUInt16", e); } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskXMsgClient.CFAsteriskXMsgClientSchema.java
public static Long getNullableUInt32(ResultSet reader, int colidx) { try {//w w w.j a v a2s .c o m long val = reader.getLong(colidx); if (reader.wasNull()) { return (null); } else { return (new Long(val)); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(CFAsteriskXMsgClientSchema.class, "getNullableUInt32", e); } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskXMsgClient.CFAsteriskXMsgClientSchema.java
public static Byte getNullableByte(ResultSet reader, int colidx) { try {/*www.j a v a2 s. com*/ byte val = reader.getByte(colidx); if (reader.wasNull()) { return (null); } else { return (new Byte(val)); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(CFAsteriskXMsgClientSchema.class, "getNullableByte", e); } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskXMsgClient.CFAsteriskXMsgClientSchema.java
public static Short getNullableInt16(ResultSet reader, int colidx) { try {//w ww . j a v a 2 s .c om short val = reader.getShort(colidx); if (reader.wasNull()) { return (null); } else { return (new Short(val)); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(CFAsteriskXMsgClientSchema.class, "getNullableInt64", e); } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskXMsgClient.CFAsteriskXMsgClientSchema.java
public static String getNullableString(ResultSet reader, int colidx) { try {// w ww . j a v a 2 s .co m String val = reader.getString(colidx); if (reader.wasNull()) { return (null); } else { return (val); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(CFAsteriskXMsgClientSchema.class, "getNullableString", e); } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskXMsgClient.CFAsteriskXMsgClientSchema.java
public static BigDecimal getNullableUInt64(ResultSet reader, int colidx) { try {/* w w w.ja va2 s . com*/ String strval = reader.getString(colidx); if (reader.wasNull() || (strval == null) || (strval.length() <= 0)) { return (null); } else { BigDecimal retval = new BigDecimal(strval); return (retval); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(CFAsteriskXMsgClientSchema.class, "getNullableUInt64", e); } }
From source file:mitm.common.hibernate.CertificateArrayUserType.java
@Override public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException { Certificate[] certificates = null; byte[] bytes = rs.getBytes(names[CERTIFICATE_ARRAY_COLUMN]); if (!rs.wasNull() && bytes != null) { Object deserialized = SerializationUtils.deserialize(bytes); if (!(deserialized instanceof LinkedList)) { throw new IllegalArgumentException("Object is not a LinkedList."); }/*from w w w . j a v a 2 s . c om*/ try { @SuppressWarnings("unchecked") List<EncodedCertificate> encodedCertificates = (LinkedList<EncodedCertificate>) deserialized; certificates = new Certificate[encodedCertificates.size()]; for (int i = 0; i < certificates.length; i++) { certificates[i] = encodedCertificates.get(i).getCertificate(); } } catch (CertificateException e) { throw new HibernateException(e); } catch (NoSuchProviderException e) { throw new HibernateException(e); } } return certificates; }
From source file:com.tesora.dve.sql.util.JdbcConnectionResourceResponse.java
private List<ResultRow> convertNativeResults(ResultSet mrs) throws Throwable { ResultSetMetaData rsmd = mrs.getMetaData(); ArrayList<ResultRow> converted = new ArrayList<ResultRow>(); while (mrs.next()) { ResultRow rr = new ResultRow(); for (int i = 0; i < rsmd.getColumnCount(); i++) { rr.addResultColumn(mrs.getObject(i + 1), mrs.wasNull()); }/* w w w. j av a 2 s . c om*/ converted.add(rr); } return converted; }
From source file:data.DefaultExchanger.java
protected void putInt(JsonGenerator generator, String fieldName, ResultSet rs, short index) throws SQLException, IOException { generator.writeFieldName(fieldName); int value = rs.getInt(index); if (rs.wasNull()) { generator.writeNull();/* w w w .ja va 2 s.com*/ } else { generator.writeNumber(value); } }