Example usage for java.sql ResultSet wasNull

List of usage examples for java.sql ResultSet wasNull

Introduction

In this page you can find the example usage for java.sql ResultSet wasNull.

Prototype

boolean wasNull() throws SQLException;

Source Link

Document

Reports whether the last column read had a value of SQL NULL.

Usage

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskDb2LUW.CFAsteriskDb2LUWSchema.java

public static String getNullableString(ResultSet reader, int colidx) {
    try {// w w w .  ja  v a  2s .  co m
        String val = reader.getString(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (val);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFAsteriskDb2LUWSchema.class,
                "getNullableString", e);
    }
}

From source file:edu.ku.brc.specify.toycode.mexconabio.BuildTags.java

/**
 * @param stmt//ww  w . j ava  2 s. c o m
 * @return
 */
private Integer getId(final PreparedStatement stmt) {
    Integer count = null;
    ResultSet rs = null;
    try {
        rs = stmt.executeQuery();
        if (rs.next()) {
            count = rs.getInt(1);
            if (rs.wasNull())
                count = null;
        }

    } catch (Exception ex) {
        ex.printStackTrace();

    } finally {
        try {
            if (rs != null)
                rs.close();
        } catch (Exception ex) {
        }
    }

    return count;
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSybase.CFAstSybaseSchema.java

public static Integer getNullableInt32(ResultSet reader, int colidx) {
    try {//www. j  a  va2s.  c om
        int val = reader.getInt(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Integer(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFAstSybaseSchema.class, "getNullableInt32", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstOracle.CFAstOracleSchema.java

public static Integer getNullableInt32(ResultSet reader, int colidx) {
    try {/*  ww w . j a  v a 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(CFAstOracleSchema.class, "getNullableInt32", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSybase.CFAstSybaseSchema.java

public static Integer getNullableUInt16(ResultSet reader, int colidx) {
    try {/*from www.j  ava  2s  . c o m*/
        int val = reader.getInt(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Integer(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFAstSybaseSchema.class, "getNullableUInt16",
                e);
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskDb2LUW.CFAsteriskDb2LUWSchema.java

public static BigDecimal getNullableUInt64(ResultSet reader, int colidx) {
    try {//from   w  w  w.ja  v a  2s  . c o m
        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(CFAsteriskDb2LUWSchema.class,
                "getNullableUInt64", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstOracle.CFAstOracleSchema.java

public static Integer getNullableUInt16(ResultSet reader, int colidx) {
    try {/*  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(CFAstOracleSchema.class, "getNullableUInt16",
                e);
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSybase.CFAstSybaseSchema.java

public static Byte getNullableByte(ResultSet reader, int colidx) {
    try {/*  w w w.j  a  v  a2  s . c om*/
        byte val = reader.getByte(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Byte(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFAstSybaseSchema.class, "getNullableByte", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstOracle.CFAstOracleSchema.java

public static Byte getNullableByte(ResultSet reader, int colidx) {
    try {//from   w  w  w  .j a v  a  2 s. co m
        byte val = reader.getByte(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Byte(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFAstOracleSchema.class, "getNullableByte", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSybase.CFAstSybaseSchema.java

public static Long getNullableUInt32(ResultSet reader, int colidx) {
    try {//from   w ww .j a  v a2  s  . 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(CFAstSybaseSchema.class, "getNullableUInt32",
                e);
    }
}