Example usage for java.sql ResultSet getShort

List of usage examples for java.sql ResultSet getShort

Introduction

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

Prototype

short getShort(String columnLabel) throws SQLException;

Source Link

Document

Retrieves the value of the designated column in the current row of this ResultSet object as a short in the Java programming language.

Usage

From source file:net.algem.security.UserDaoImpl.java

@Override
/**/*from  w w  w  . j a v a2 s . c o m*/
 * Must return a single mapped User.
 */
public User findByEmail(final String email) {
    String query = "SELECT l.idper,l.login,l.profil FROM " + TABLE
            + " l INNER JOIN email e ON (l.idper = e.idper)" + " WHERE e.email = ?";
    return jdbcTemplate.queryForObject(query, new RowMapper<User>() {
        @Override
        public User mapRow(ResultSet rs, int rowNum) throws SQLException {
            User u = new User();
            u.setId(rs.getInt(1));
            u.setLogin(getLoginFromStringResult(rs.getString(2)));
            u.setProfile(getProfileFromId(rs.getShort(3)));
            u.setEmail(email);
            return u;
        }
    }, email);
}

From source file:net.algem.security.UserDaoImpl.java

@Override
public User find(String login) {
    String query = "SELECT l.idper,l.login,l.profil,per.nom,per.prenom,coalesce(prof.actif, false),coalesce(e.idper,0),coalesce(tech.idper,0)"
            + " FROM " + TABLE + " l INNER JOIN " + PersonIO.TABLE + " per ON (l.idper = per.id)"
            + " LEFT OUTER JOIN prof ON (l.idper = prof.idper)"
            + " LEFT OUTER JOIN eleve e ON (l.idper = e.idper)"
            + " LEFT OUTER JOIN technicien tech ON (l.idper = tech.idper)" + " WHERE trim(l.login) = ?";
    return jdbcTemplate.queryForObject(query, new RowMapper<User>() {
        @Override// w  w  w  .j  av a 2 s.  c o  m
        public User mapRow(ResultSet rs, int rowNum) throws SQLException {
            User u = new User();
            u.setId(rs.getInt(1));
            u.setLogin(getLoginFromStringResult(rs.getString(2)));
            u.setProfile(getProfileFromId(rs.getShort(3)));
            u.setName(rs.getString(4));
            u.setFirstName(rs.getString(5));
            u.setTeacher(rs.getBoolean(6));// active teachers only
            u.setStudent(rs.getInt(7) > 0);
            u.setTech(rs.getInt(8) > 0);

            return u;
        }
    }, login);

}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstPgSql.CFAstPgSqlSchema.java

public static Short getNullableInt16(ResultSet reader, int colidx) {
    try {/*from   www . j  av  a  2s .co m*/
        short val = reader.getShort(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Short(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFAstPgSqlSchema.class, "getNullableInt64", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstDb2LUW.CFAstDb2LUWSchema.java

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

From source file:de.tu_berlin.dima.oligos.db.handler.jdbc.ForeignKeysHandler.java

private ForeignKey handleRow(ResultSet rs) throws SQLException {
    Collection<String> parentColumns = new ArrayList<String>();
    Collection<String> childColumns = new ArrayList<String>();
    String parentSchema = rs.getString(PARENT_SCHEMA);
    if (parentSchema == null)
        parentSchema = "";
    String childSchema = rs.getString(CHILD_SCHEMA);
    if (childSchema == null)
        childSchema = "";
    TableRef parentTable = new TableRef(parentSchema, rs.getString(PARENT_TABLE));
    parentColumns.add(rs.getString(PARENT_COLUMN));
    TableRef childTable = new TableRef(childSchema, rs.getString(CHILD_TABLE));
    childColumns.add(rs.getString(CHILD_COLUMN));
    short seq = rs.getShort(SEQUENCE_NUMBER);
    isPart = seq > 1;//from w ww.  j a va 2 s .  c  o m
    ForeignKey foreignKey = new ForeignKey("", childTable, childColumns, parentTable, parentColumns);
    return foreignKey;
}

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

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

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

public static Short getNullableInt16(ResultSet reader, int colidx) {
    try {/*w ww  .  j  a  va 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(CFAstSybaseSchema.class, "getNullableInt64", e);
    }
}

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

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

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskPgSql.CFAsteriskPgSqlSchema.java

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

From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmDb2LUW.CFCrmDb2LUWSchema.java

public static Short getNullableInt16(ResultSet reader, int colidx) {
    try {//  w  w  w.  java  2  s.  com
        short val = reader.getShort(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Short(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFCrmDb2LUWSchema.class, "getNullableInt64", e);
    }
}