List of usage examples for java.sql ResultSet wasNull
boolean wasNull() throws SQLException;
NULL
. From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstMySql.CFAstMySqlServiceTypeTable.java
protected CFAstServiceTypeBuff unpackServiceTypeResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackServiceTypeResultSetToBuff"; int idxcol = 1; CFAstServiceTypeBuff buff = schema.getFactoryServiceType().newBuff(); {// w ww . ja v a2 s .c o m String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedAt(null); } else { buff.setCreatedAt(CFAstMySqlSchema.convertTimestampString(colString)); } } idxcol++; { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedByUserId(null); } else { buff.setCreatedByUserId(UUID.fromString(colString)); } } idxcol++; { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedAt(null); } else { buff.setUpdatedAt(CFAstMySqlSchema.convertTimestampString(colString)); } } idxcol++; { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedByUserId(null); } else { buff.setUpdatedByUserId(UUID.fromString(colString)); } } idxcol++; buff.setRequiredServiceTypeId(resultSet.getInt(idxcol)); idxcol++; buff.setRequiredDescription(resultSet.getString(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswMySql.CFFswMySqlServiceTypeTable.java
protected CFFswServiceTypeBuff unpackServiceTypeResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackServiceTypeResultSetToBuff"; int idxcol = 1; CFFswServiceTypeBuff buff = schema.getFactoryServiceType().newBuff(); {/*from www .j a va 2 s.c om*/ String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedAt(null); } else { buff.setCreatedAt(CFFswMySqlSchema.convertTimestampString(colString)); } } idxcol++; { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedByUserId(null); } else { buff.setCreatedByUserId(UUID.fromString(colString)); } } idxcol++; { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedAt(null); } else { buff.setUpdatedAt(CFFswMySqlSchema.convertTimestampString(colString)); } } idxcol++; { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedByUserId(null); } else { buff.setUpdatedByUserId(UUID.fromString(colString)); } } idxcol++; buff.setRequiredServiceTypeId(resultSet.getInt(idxcol)); idxcol++; buff.setRequiredDescription(resultSet.getString(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMSSql.CFEnSyntaxMSSqlServiceTypeTable.java
protected CFEnSyntaxServiceTypeBuff unpackServiceTypeResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackServiceTypeResultSetToBuff"; int idxcol = 1; CFEnSyntaxServiceTypeBuff buff = schema.getFactoryServiceType().newBuff(); {/* w ww .j a v a 2 s . c om*/ String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedByUserId(null); } else { buff.setCreatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedAt(null); } else { buff.setCreatedAt(CFEnSyntaxMSSqlSchema.convertTimestampString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedByUserId(null); } else { buff.setUpdatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedAt(null); } else { buff.setUpdatedAt(CFEnSyntaxMSSqlSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredServiceTypeId(resultSet.getInt(idxcol)); idxcol++; buff.setRequiredDescription(resultSet.getString(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
From source file:org.zenoss.zep.dao.impl.EventDaoHelper.java
private EventActor deserializeEventActor(ResultSet rs) throws SQLException { final EventActor.Builder actorBuilder = EventActor.newBuilder(); String elementUuid = uuidConverter.fromDatabaseType(rs, COLUMN_ELEMENT_UUID); if (elementUuid != null) { actorBuilder.setElementUuid(elementUuid); }//from www .j ava2 s .c o m final int elementTypeId = rs.getInt(COLUMN_ELEMENT_TYPE_ID); if (!rs.wasNull()) { actorBuilder.setElementTypeId(ModelElementType.valueOf(elementTypeId)); } final String elementIdentifier = rs.getString(COLUMN_ELEMENT_IDENTIFIER); if (elementIdentifier != null) { actorBuilder.setElementIdentifier(elementIdentifier); } final String elementTitle = rs.getString(COLUMN_ELEMENT_TITLE); if (elementTitle != null) { actorBuilder.setElementTitle(elementTitle); } // titleOrId else if (elementIdentifier != null) { actorBuilder.setElementTitle(elementIdentifier); } String subUuid = uuidConverter.fromDatabaseType(rs, COLUMN_ELEMENT_SUB_UUID); if (subUuid != null) { actorBuilder.setElementSubUuid(subUuid); } final int subTypeId = rs.getInt(COLUMN_ELEMENT_SUB_TYPE_ID); if (!rs.wasNull()) { actorBuilder.setElementSubTypeId(ModelElementType.valueOf(subTypeId)); } final String subIdentifier = rs.getString(COLUMN_ELEMENT_SUB_IDENTIFIER); if (subIdentifier != null) { actorBuilder.setElementSubIdentifier(subIdentifier); } final String subTitle = rs.getString(COLUMN_ELEMENT_SUB_TITLE); if (subTitle != null) { actorBuilder.setElementSubTitle(subTitle); } // titleOrId else if (subIdentifier != null) { actorBuilder.setElementSubTitle(subIdentifier); } return actorBuilder.build(); }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmDb2LUW.CFCrmDb2LUWSecDeviceTable.java
protected CFCrmSecDeviceBuff unpackSecDeviceResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackSecDeviceResultSetToBuff"; int idxcol = 1; CFCrmSecDeviceBuff buff = schema.getFactorySecDevice().newBuff(); {//w w w.j av a 2 s .c o m String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedByUserId(null); } else { buff.setCreatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedAt(null); } else { buff.setCreatedAt(CFCrmDb2LUWSchema.convertTimestampString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedByUserId(null); } else { buff.setUpdatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedAt(null); } else { buff.setUpdatedAt(CFCrmDb2LUWSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredSecUserId(CFCrmDb2LUWSchema.convertUuidString(resultSet.getString(idxcol))); idxcol++; buff.setRequiredDevName(resultSet.getString(idxcol)); idxcol++; { String colVal = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setOptionalPubKey(null); } else { buff.setOptionalPubKey(colVal); } } idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
From source file:annis.sqlgen.MatrixSqlGenerator.java
@Override public List<AnnotatedMatch> extractData(ResultSet resultSet) throws SQLException, DataAccessException { List<AnnotatedMatch> matches = new ArrayList<AnnotatedMatch>(); Map<List<Long>, AnnotatedSpan[]> matchesByGroup = new HashMap<List<Long>, AnnotatedSpan[]>(); while (resultSet.next()) { long id = resultSet.getLong("id"); String coveredText = resultSet.getString("span"); Array arrayAnnotation = resultSet.getArray("annotations"); Array arrayMeta = resultSet.getArray("metadata"); List<Annotation> annotations = extractAnnotations(arrayAnnotation); List<Annotation> metaData = extractAnnotations(arrayMeta); // create key Array sqlKey = resultSet.getArray("key"); Validate.isTrue(!resultSet.wasNull(), "Match group identifier must not be null"); Validate.isTrue(sqlKey.getBaseType() == Types.BIGINT, "Key in database must be from the type \"bigint\" but was \"" + sqlKey.getBaseTypeName() + "\""); Long[] keyArray = (Long[]) sqlKey.getArray(); int matchWidth = keyArray.length; List<Long> key = Arrays.asList(keyArray); if (!matchesByGroup.containsKey(key)) { matchesByGroup.put(key, new AnnotatedSpan[matchWidth]); }/*from ww w. j a va 2s . c om*/ // set annotation spans for *all* positions of the id // (node could have matched several times) for (int posInMatch = 0; posInMatch < key.size(); posInMatch++) { if (key.get(posInMatch) == id) { matchesByGroup.get(key)[posInMatch] = new AnnotatedSpan(id, coveredText, annotations, metaData); } } } for (AnnotatedSpan[] match : matchesByGroup.values()) { matches.add(new AnnotatedMatch(Arrays.asList(match))); } return matches; }
From source file:com.act.lcms.db.model.StandardWell.java
@Override protected List<StandardWell> fromResultSet(ResultSet resultSet) throws SQLException { List<StandardWell> results = new ArrayList<>(); while (resultSet.next()) { Integer id = resultSet.getInt(DB_FIELD.ID.getOffset()); Integer plateId = resultSet.getInt(DB_FIELD.PLATE_ID.getOffset()); Integer plateRow = resultSet.getInt(DB_FIELD.PLATE_ROW.getOffset()); Integer plateColumn = resultSet.getInt(DB_FIELD.PLATE_COLUMN.getOffset()); String chemical = resultSet.getString(DB_FIELD.CHEMICAL.getOffset()); String media = resultSet.getString(DB_FIELD.MEDIA.getOffset()); String note = resultSet.getString(DB_FIELD.NOTE.getOffset()); Double concentration = resultSet.getDouble(DB_FIELD.CONCENTRATION.getOffset()); if (resultSet.wasNull()) { concentration = null;/*from www. ja va 2 s. c om*/ } results.add(new StandardWell(id, plateId, plateRow, plateColumn, chemical, media, note, concentration)); } return results; }
From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlServiceTypeTable.java
protected CFEnSyntaxServiceTypeBuff unpackServiceTypeResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackServiceTypeResultSetToBuff"; int idxcol = 1; CFEnSyntaxServiceTypeBuff buff = schema.getFactoryServiceType().newBuff(); {/*from w w w. j a va 2 s . c om*/ String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedAt(null); } else { buff.setCreatedAt(CFEnSyntaxMySqlSchema.convertTimestampString(colString)); } } idxcol++; { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedByUserId(null); } else { buff.setCreatedByUserId(UUID.fromString(colString)); } } idxcol++; { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedAt(null); } else { buff.setUpdatedAt(CFEnSyntaxMySqlSchema.convertTimestampString(colString)); } } idxcol++; { String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedByUserId(null); } else { buff.setUpdatedByUserId(UUID.fromString(colString)); } } idxcol++; buff.setRequiredServiceTypeId(resultSet.getInt(idxcol)); idxcol++; buff.setRequiredDescription(resultSet.getString(idxcol)); idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskPgSql.CFAsteriskPgSqlSecDeviceTable.java
protected CFSecuritySecDeviceBuff unpackSecDeviceResultSetToBuff(ResultSet resultSet) throws SQLException { final String S_ProcName = "unpackSecDeviceResultSetToBuff"; int idxcol = 1; CFSecuritySecDeviceBuff buff = schema.getFactorySecDevice().newBuff(); {/*from w ww .jav a 2 s .c o m*/ String colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedByUserId(null); } else { buff.setCreatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setCreatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setCreatedAt(null); } else { buff.setCreatedAt(CFAsteriskPgSqlSchema.convertTimestampString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedByUserId(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedByUserId(null); } else { buff.setUpdatedByUserId(UUID.fromString(colString)); } idxcol++; colString = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setUpdatedAt(null); } else if ((colString == null) || (colString.length() <= 0)) { buff.setUpdatedAt(null); } else { buff.setUpdatedAt(CFAsteriskPgSqlSchema.convertTimestampString(colString)); } idxcol++; } buff.setRequiredSecUserId(CFAsteriskPgSqlSchema.convertUuidString(resultSet.getString(idxcol))); idxcol++; buff.setRequiredDevName(resultSet.getString(idxcol)); idxcol++; { String colVal = resultSet.getString(idxcol); if (resultSet.wasNull()) { buff.setOptionalPubKey(null); } else { buff.setOptionalPubKey(colVal); } } idxcol++; buff.setRequiredRevision(resultSet.getInt(idxcol)); return (buff); }
From source file:com.flexive.core.storage.genericSQL.GenericEnvironmentLoader.java
/** * {@inheritDoc}/* w ww. jav a 2s.com*/ */ @Override public Mandator[] loadMandators(Connection con) throws FxLoadException { PreparedStatement ps = null; try { // Load all mandators within the system ps = con.prepareStatement( "SELECT ID,NAME,METADATA,IS_ACTIVE,CREATED_BY,CREATED_AT,MODIFIED_BY,MODIFIED_AT FROM " + TBL_MANDATORS + " order by upper(NAME)"); ResultSet rs = ps.executeQuery(); ArrayList<Mandator> result = new ArrayList<Mandator>(20); while (rs != null && rs.next()) { int metaDataId = rs.getInt(3); if (rs.wasNull()) { metaDataId = -1; } result.add(new Mandator(rs.getInt(1), rs.getString(2), metaDataId, rs.getBoolean(4), LifeCycleInfoImpl.load(rs, 5, 6, 7, 8))); } // return the result return result.toArray(new Mandator[result.size()]); } catch (SQLException se) { FxLoadException le = new FxLoadException(se.getMessage(), se); LOG.error(le); throw le; } finally { Database.closeObjects(GenericEnvironmentLoader.class, null, ps); } }