List of usage examples for java.sql ResultSet getByte
byte getByte(String columnLabel) throws SQLException;
ResultSet
object as a byte
in the Java programming language. From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstOracle.CFAstOracleSchema.java
public static Byte getNullableByte(ResultSet reader, int colidx) { try {/*w ww. j a v a 2 s . c o 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_4.CFAsteriskPgSql.CFAsteriskPgSqlSchema.java
public static Byte getNullableByte(ResultSet reader, int colidx) { try {//w w w. j a v a 2s . c om byte val = reader.getByte(colidx); if (reader.wasNull()) { return (null); } else { return (new Byte(val)); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(CFAsteriskPgSqlSchema.class, "getNullableByte", e); } }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmDb2LUW.CFCrmDb2LUWSchema.java
public static Byte getNullableByte(ResultSet reader, int colidx) { try {// w ww . ja va 2s. c o m byte val = reader.getByte(colidx); if (reader.wasNull()) { return (null); } else { return (new Byte(val)); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(CFCrmDb2LUWSchema.class, "getNullableByte", e); } }
From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetMSSql.CFInternetMSSqlSchema.java
public static Byte getNullableByte(ResultSet reader, int colidx) { try {//from w w w .j a v a 2 s . c o m byte val = reader.getByte(colidx); if (reader.wasNull()) { return (null); } else { return (new Byte(val)); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(CFInternetMSSqlSchema.class, "getNullableByte", e); } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstMySql.CFAstMySqlSchema.java
public static Byte getNullableByte(ResultSet reader, int colidx) { try {//from ww w. j a v a 2 s . c o m byte val = reader.getByte(colidx); if (reader.wasNull()) { return (null); } else { return (new Byte(val)); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(CFAstMySqlSchema.class, "getNullableByte", e); } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSybase.CFAsteriskSybaseSchema.java
public static Byte getNullableByte(ResultSet reader, int colidx) { try {/* w w w . 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(CFAsteriskSybaseSchema.class, "getNullableByte", e); } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskOracle.CFAsteriskOracleSchema.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(CFAsteriskOracleSchema.class, "getNullableByte", e); } }
From source file:org.apache.phoenix.end2end.CursorWithRowValueConstructorIT.java
@Test public void testCursorsWithColsOfTypesTinyintSmallintFloatDouble() throws Exception { long ts = nextTimestamp(); String tenantId = getOrganizationId(); initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), null, ts - 1, getUrl(), null); ensureTableCreated(getUrl(), CUSTOM_ENTITY_DATA_FULL_NAME, CUSTOM_ENTITY_DATA_FULL_NAME, ts - 1); String query = "SELECT a_byte,a_short,a_float,a_double FROM aTable WHERE ?=organization_id AND entity_id IN (?,?,?)"; query = query.replaceFirst("\\?", "'" + tenantId + "'"); query = query.replaceFirst("\\?", "'" + ROW1 + "'"); query = query.replaceFirst("\\?", "'" + ROW2 + "'"); query = query.replaceFirst("\\?", "'" + ROW3 + "'"); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try {/*from w w w. java 2 s . c o m*/ String cursor = "DECLARE testCursor CURSOR FOR " + query; conn.prepareStatement(cursor).execute(); cursor = "OPEN testCursor"; conn.prepareStatement(cursor).execute(); cursor = "FETCH NEXT FROM testCursor"; ResultSet rs = conn.prepareStatement(cursor).executeQuery(); int count = 0; while (rs.next()) { assertTrue( (byte) 1 == (rs.getByte(1)) || (byte) 2 == (rs.getByte(1)) || (byte) 3 == (rs.getByte(1))); assertTrue((short) 128 == (rs.getShort(2)) || (short) 129 == (rs.getShort(2)) || (short) 130 == (rs.getShort(2))); assertTrue(0.01f == (rs.getFloat(3)) || 0.02f == (rs.getFloat(3)) || 0.03f == (rs.getFloat(3))); assertTrue( 0.0001 == (rs.getDouble(4)) || 0.0002 == (rs.getDouble(4)) || 0.0003 == (rs.getDouble(4))); count++; if (count == 3) break; rs = conn.prepareStatement(cursor).executeQuery(); } assertTrue(count == 3); } finally { String sql = "CLOSE testCursor"; conn.prepareStatement(sql).execute(); conn.close(); } }
From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlSchema.java
public static Byte getNullableByte(ResultSet reader, int colidx) { try {//from w w w. ja v a 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(CFEnSyntaxMySqlSchema.class, "getNullableByte", e); } }
From source file:com.flexive.ejb.beans.UserGroupEngineBean.java
/** * {@inheritDoc}/*from ww w . ja va 2s. c o m*/ */ @Override @TransactionAttribute(TransactionAttributeType.SUPPORTS) public List<Role> getRoles(long groupId) throws FxApplicationException { Connection con = null; Statement stmt = null; final String sql = "SELECT DISTINCT ROLE FROM " + TBL_ROLE_MAPPING + " WHERE USERGROUP=" + groupId; final UserGroup aGroup = CacheAdmin.getEnvironment().getUserGroup(groupId); // Permission check if (!mayAccessGroup(aGroup)) { FxNoAccessException nae = new FxNoAccessException("ex.usergroup.noPermissionsToReadRoles", aGroup.getName()); if (LOG.isInfoEnabled()) LOG.info(nae); throw nae; } try { // Obtain a database connection con = Database.getDbConnection(); // Load the roles stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(sql); List<Role> result = new ArrayList<Role>(); while (rs != null && rs.next()) { result.add(Role.getById(rs.getByte(1))); } if (LOG.isDebugEnabled()) { LOG.debug("Roles for group [" + groupId + "]: " + result); } return result; } catch (SQLException exc) { FxLoadException le = new FxLoadException(exc, "ex.usergroup.sqlError", exc.getMessage(), sql); LOG.error(le); throw le; } finally { Database.closeObjects(UserGroupEngineBean.class, con, stmt); } }