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.cfcrm.v2_1.CFCrmMSSql.CFCrmMSSqlSchema.java

public static Short getNullableInt16(ResultSet reader, int colidx) {
    try {/* w w  w.ja  v a  2 s  .  c  o m*/
        short val = reader.getShort(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Short(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFCrmMSSqlSchema.class, "getNullableInt64", e);
    }
}

From source file:com.flexive.ejb.beans.UserGroupEngineBean.java

/**
 * {@inheritDoc}/*from   w w  w  . j  a v  a 2 s . c o  m*/
 */
@Override
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
public UserGroup loadMandatorGroup(long mandatorId) throws FxApplicationException {
    Connection con = null;
    Statement stmt = null;
    String sql = "SELECT ID,MANDATOR,NAME,COLOR,AUTOMANDATOR,ISSYSTEM FROM " + TBL_USERGROUPS
            + " WHERE AUTOMANDATOR=" + mandatorId;

    try {

        // Obtain a database connection
        con = Database.getDbConnection();

        // Create the new workflow instance
        stmt = con.createStatement();

        // Build statement
        ResultSet rs = stmt.executeQuery(sql);

        // Does the group exist at all?
        if (rs == null || !rs.next())
            throw new FxNotFoundException("ex.account.group.notFound.id", mandatorId);
        long autoMandator = rs.getLong(5);
        if (rs.wasNull())
            autoMandator = -1;
        return new UserGroup(rs.getLong(1), rs.getLong(2), autoMandator, rs.getBoolean(6), rs.getString(3),
                rs.getString(4));
    } catch (SQLException exc) {
        FxLoadException de = new FxLoadException(exc, "ex.usergroup.sqlError", exc.getMessage(), sql);
        LOG.error(de);
        throw de;
    } finally {
        Database.closeObjects(UserGroupEngineBean.class, con, stmt);
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWSchema.java

public static BigDecimal getNullableUInt64(ResultSet reader, int colidx) {
    try {//  w  w w  .j a  va 2 s.c om
        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(CFAccDb2LUWSchema.class, "getNullableUInt64",
                e);
    }
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmMSSql.CFCrmMSSqlSchema.java

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

From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmMSSql.CFCrmMSSqlSchema.java

public static BigDecimal getNullableUInt64(ResultSet reader, int colidx) {
    try {//  ww w. j a va  2 s  .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(CFCrmMSSqlSchema.class, "getNullableUInt64", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleSchema.java

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

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleSchema.java

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

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskMSSql.CFAsteriskMSSqlSchema.java

public static Integer getNullableInt32(ResultSet reader, int colidx) {
    try {//from   w w  w.ja v  a 2 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(CFAsteriskMSSqlSchema.class, "getNullableInt32",
                e);
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskMSSql.CFAsteriskMSSqlSchema.java

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

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleSchema.java

public static Byte getNullableByte(ResultSet reader, int colidx) {
    try {/*from   www.j a v a 2 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(CFAccOracleSchema.class, "getNullableByte", e);
    }
}