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.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlSchema.java

public static Short getNullableInt16(ResultSet reader, int colidx) {
    try {//  w  w  w  .java 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(CFEnSyntaxMySqlSchema.class, "getNullableInt64",
                e);
    }
}

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlSchema.java

public static String getNullableString(ResultSet reader, int colidx) {
    try {//from www  . ja  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(CFEnSyntaxMySqlSchema.class,
                "getNullableString", e);
    }
}

From source file:act.installer.brenda.SQLConnection.java

private Iterator<BrendaRxnEntry> runSPQuery(final boolean isNatural) throws SQLException {
    String query = isNatural ? QUERY_NATURAL_SUBSTRATES_PRODUCTS : QUERY_SUBSTRATES_PRODUCTS;
    final PreparedStatement stmt = brendaConn.prepareStatement(query);
    final ResultSet results = stmt.executeQuery();

    return new Iterator<BrendaRxnEntry>() {
        @Override//from   w ww .j  av a2s  . com
        public boolean hasNext() {
            return hasNextHelper(results, stmt);
        }

        @Override
        public BrendaRxnEntry next() {
            try {
                results.next();
                Integer literatureSubstrates = results.getInt(4);

                if (results.wasNull()) {
                    literatureSubstrates = null;
                }
                BrendaRxnEntry sp = new BrendaRxnEntry(results.getString(1), results.getString(2),
                        results.getString(3),
                        literatureSubstrates == null ? null : literatureSubstrates.toString(),
                        results.getString(5), results.getString(6), results.getString(7), results.getInt(8),
                        isNatural);
                return sp;
            } catch (SQLException e) {
                throw new RuntimeException(e);
            }

        }
    };
}

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlSchema.java

public static BigDecimal getNullableUInt64(ResultSet reader, int colidx) {
    try {/*from   w w w  .java2s.  co  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(CFEnSyntaxMySqlSchema.class,
                "getNullableUInt64", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstMSSql.CFAstMSSqlSchema.java

public static Integer getNullableInt32(ResultSet reader, int colidx) {
    try {/*from  ww w . ja  va2  s .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(CFAstMSSqlSchema.class, "getNullableInt32", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstMSSql.CFAstMSSqlSchema.java

public static Integer getNullableUInt16(ResultSet reader, int colidx) {
    try {//ww  w. ja v a2  s  .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(CFAstMSSqlSchema.class, "getNullableUInt16", e);
    }
}

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswOracle.CFFswOracleSchema.java

public static Integer getNullableInt32(ResultSet reader, int colidx) {
    try {//from  w w w.  jav a  2s  .  c  om
        int val = reader.getInt(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Integer(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFFswOracleSchema.class, "getNullableInt32", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstMSSql.CFAstMSSqlSchema.java

public static Long getNullableUInt32(ResultSet reader, int colidx) {
    try {/*from  w w  w  .j ava 2  s.co  m*/
        long val = reader.getLong(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Long(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFAstMSSqlSchema.class, "getNullableUInt32", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstMSSql.CFAstMSSqlSchema.java

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

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswOracle.CFFswOracleSchema.java

public static Integer getNullableUInt16(ResultSet reader, int colidx) {
    try {/*from w  w  w.  j  a  v a2s.c om*/
        int val = reader.getInt(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Integer(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFFswOracleSchema.class, "getNullableUInt16",
                e);
    }
}