List of usage examples for java.sql ResultSet CONCUR_READ_ONLY
int CONCUR_READ_ONLY
To view the source code for java.sql ResultSet CONCUR_READ_ONLY.
Click Source Link
ResultSet
object that may NOT be updated. From source file:edu.ku.brc.specify.conversion.ConvertTaxonHelper.java
/** * //from w w w . j a va 2 s . c o m */ public void convertTaxonCitationToTaxonImage() { String sql = "SELECT tn.TaxonNameID, c.Text1 "; String fromStr = " FROM taxonname AS tn Inner Join taxoncitation AS c ON tn.TaxonNameID = c.TaxonNameID"; String whereStr = " WHERE c.Text1 IS NOT NULL"; String updateStr = "UPDATE taxon SET GUID=? WHERE TaxonID = ?"; int numTaxCit = BasicSQLUtils.getCountAsInt(oldDBConn, "SELECT COUNT(*) " + fromStr + whereStr); if (numTaxCit > 0) { if (frame != null) { frame.setDesc(String.format("Fixing Taxon Citations", numTaxCit)); frame.setProcess(0, numTaxCit); } // process stranded rows String sqlStr = sql + fromStr + whereStr; log.debug(sqlStr); Statement stmt = null; PreparedStatement pStmt = null; try { stmt = oldDBConn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); pStmt = newDBConn.prepareStatement(updateStr); int cnt = 0; ResultSet rs = stmt.executeQuery(sqlStr); while (rs.next()) { int oldTaxonId = rs.getInt(1); Integer newTaxonID = txMapper.get(oldTaxonId); if (newTaxonID != null) { String imgURL = rs.getString(2); pStmt.setString(1, imgURL); pStmt.setInt(2, newTaxonID); if (pStmt.executeUpdate() != 1) { String msg = String.format("Unable to update new taxonID %d with image url[%s].", newTaxonID, imgURL); log.error(msg); tblWriter.logError(msg); } cnt++; if (frame != null) { frame.setProcess(cnt); } } else { String msg = String.format("Unable to map old id [%d] to new taxonID.", oldTaxonId); log.error(msg); tblWriter.logError(msg); } } rs.close(); if (frame != null) { frame.setProcess(numTaxCit); } } catch (SQLException ex) { ex.printStackTrace(); } finally { try { if (stmt != null) stmt.close(); if (pStmt != null) pStmt.close(); } catch (Exception ex) { } } } }
From source file:edu.ku.brc.specify.conversion.AgentConverter.java
/** * @param oldAgentId// ww w. j ava 2s .c om * @param agentIDMapper * @param tblWriter */ protected void copyAgentFromOldToNew(final Integer oldAgentId, final IdTableMapper agentIDMapper) { boolean doDebug = false; DBTableInfo agentTI = DBTableIdMgr.getInstance().getByShortClassName("Agent"); DBFieldInfo lastNameField = agentTI.getFieldByColumnName("LastName"); DBFieldInfo firstNameField = agentTI.getFieldByColumnName("FirstName"); StringBuilder sql = new StringBuilder("SELECT "); if (BasicSQLUtils.myDestinationServerType != BasicSQLUtils.SERVERTYPE.MS_SQLServer) { BasicSQLUtils.removeForeignKeyConstraints(newDBConn, BasicSQLUtils.myDestinationServerType); } BasicSQLUtils.setIdentityInsertONCommandForSQLServer(newDBConn, "agent", BasicSQLUtils.myDestinationServerType); List<String> oldAgentFieldNames = getFieldNamesFromSchema(oldDBConn, "agent"); String oldFieldListStr = buildSelectFieldList(oldAgentFieldNames, "agent"); sql.append(oldFieldListStr); sql.append(" FROM agent WHERE AgentID = " + oldAgentId); //log.info(oldFieldListStr); List<String> newAgentFieldNames = getFieldNamesFromSchema(newDBConn, "agent"); String newFieldListStr = buildSelectFieldList(newAgentFieldNames, "agent"); //log.info(newFieldListStr); int lastNameLen = 120; HashMap<String, Integer> oldIndexFromNameMap = new HashMap<String, Integer>(); int inx = 1; for (String fldName : oldAgentFieldNames) { oldIndexFromNameMap.put(fldName, inx++); } HashMap<String, Integer> newIndexFromNameMap = new HashMap<String, Integer>(); inx = 1; for (String fldName : newAgentFieldNames) { newIndexFromNameMap.put(fldName, inx++); } try { // So first we hash each AddressID and the value is set to 0 (false) Statement stmtX = oldDBConn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); ResultSet rsX = stmtX.executeQuery(sql.toString()); int agentIDInx = oldIndexFromNameMap.get("AgentID"); int agentTypeInx = oldIndexFromNameMap.get("AgentType"); int nameInx = oldIndexFromNameMap.get("Name"); int lastNameInx = oldIndexFromNameMap.get("LastName"); int firstNameInx = oldIndexFromNameMap.get("FirstName"); // log.debug(sql.toString()); int cnt = 0; while (rsX.next()) { int agentId = rsX.getInt(1); StringBuilder sqlStr = new StringBuilder(); sqlStr.append("INSERT INTO agent "); sqlStr.append("(" + newFieldListStr); sqlStr.append(")"); sqlStr.append(" VALUES ("); int fCnt = 0; for (String fieldName : newAgentFieldNames) { if (fCnt > 0) sqlStr.append(", "); if (StringUtils.contains(fieldName.toLowerCase(), "disciplineid")) { sqlStr.append(conv.getDisciplineId()); } else if (StringUtils.contains(fieldName, "FirstName")) { String firstName = rsX.getString(firstNameInx); if (firstName != null && firstName.length() > firstNameField.getLength()) { String str = firstName.substring(0, firstNameField.getLength()); tblWriter.logError("Agent id: " + rsX.getString(agentIDInx) + " - Concatinating First Name FROM [" + firstName + "] to [" + str + "]"); firstName = str; } sqlStr.append(BasicSQLUtils.getStrValue(firstName)); } else if (StringUtils.contains(fieldName, "LastName")) { int oldType = rsX.getInt(agentTypeInx); int srcColInx = oldType != 1 ? nameInx : lastNameInx; String lName = rsX.getString(srcColInx); if (lName == null && oldType != 1) { lName = rsX.getString(lastNameInx); } if (lName != null && lName.length() > lastNameField.getLength()) { String str = lName.substring(0, firstNameField.getLength()); tblWriter.logError("Agent id: " + rsX.getString(agentIDInx) + " - Concatinating Last Name FROM [" + lName + "] to [" + str + "]"); lName = str; } String lstName = lName; lName = lstName == null ? null : lstName.length() <= lastNameLen ? lstName : lstName.substring(0, lastNameLen); sqlStr.append(BasicSQLUtils.getStrValue(lName)); } else { String value = ""; Integer index; if (fieldName.equals("ModifiedByAgentID")) { index = oldIndexFromNameMap.get("LastEditedBy"); } else { index = oldIndexFromNameMap.get(fieldName); } if (index == null) { // log.debug(fieldName); value = "NULL"; } else if (fCnt == 0) { value = agentIDMapper.get(agentId).toString(); } else { value = BasicSQLUtils.getStrValue(rsX.getObject(index.intValue())); } BasicSQLUtilsMapValueIFace valueMapper = conv.getColumnValueMapper().get(fieldName); if (valueMapper != null) { value = valueMapper.mapValue(value); } sqlStr.append(value); } fCnt++; } sqlStr.append(")"); // log.info(sqlStr.toString()); Statement updateStatement = newDBConn.createStatement(); // updateStatement.executeUpdate("SET FOREIGN_KEY_CHECKS = 0"); if (doDebug) { log.info(sqlStr.toString()); } updateStatement.executeUpdate(sqlStr.toString(), Statement.RETURN_GENERATED_KEYS); Integer newAgentId = BasicSQLUtils.getInsertedId(updateStatement); if (newAgentId == null) { throw new RuntimeException("Couldn't get the Agent's inserted ID"); } updateStatement.clearBatch(); updateStatement.close(); updateStatement = null; //conv.addAgentDisciplineJoin(newAgentId, conv.getDisciplineId()); cnt++; BasicSQLUtils.setIdentityInsertOFFCommandForSQLServer(newDBConn, "agent", BasicSQLUtils.myDestinationServerType); } } catch (Exception ex) { log.error(ex); ex.printStackTrace(); System.exit(0); } }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8BoolDefTable.java
public MSSBamBoolDefBuff[] readDerivedByPrevIdx(MSSBamAuthorization Authorization, Long PrevId) { final String S_ProcName = "readDerivedByPrevIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/* w w w . ja va 2 s. c om*/ ArrayList<String> classCodeList = new ArrayList<String>(); String classCode; try { Connection cnx = schema.getCnx(); String sql = S_sqlSelectBoolDefDistinctClassCode + "WHERE " + ((PrevId == null) ? "val.PrevId is null " : "val.PrevId = " + PrevId.toString() + " "); Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); ResultSet resultSet = stmt.executeQuery(sql); while (resultSet.next()) { classCode = resultSet.getString(1); classCodeList.add(classCode); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } ArrayList<MSSBamBoolDefBuff> resultList = new ArrayList<MSSBamBoolDefBuff>(); ListIterator<String> classCodeIter = classCodeList.listIterator(); while (classCodeIter.hasNext()) { classCode = classCodeIter.next(); if (classCode.equals("BLN")) { MSSBamBoolDefBuff[] subList = readBuffByPrevIdx(Authorization, PrevId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("TBLN")) { MSSBamTableBoolBuff[] subList = schema.getTableTableBool().readBuffByPrevIdx(Authorization, PrevId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("SBLN")) { MSSBamSchemaBoolBuff[] subList = schema.getTableSchemaBool().readBuffByPrevIdx(Authorization, PrevId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect ClassCode \"" + classCode + "\""); } } return (resultList.toArray(new MSSBamBoolDefBuff[0])); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8BlobDefTable.java
public MSSBamBlobDefBuff[] readDerivedByPrevIdx(MSSBamAuthorization Authorization, Long PrevId) { final String S_ProcName = "readDerivedByPrevIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/* w w w .ja va 2 s .co m*/ ArrayList<String> classCodeList = new ArrayList<String>(); String classCode; try { Connection cnx = schema.getCnx(); String sql = S_sqlSelectBlobDefDistinctClassCode + "WHERE " + ((PrevId == null) ? "val.PrevId is null " : "val.PrevId = " + PrevId.toString() + " "); Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); ResultSet resultSet = stmt.executeQuery(sql); while (resultSet.next()) { classCode = resultSet.getString(1); classCodeList.add(classCode); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } ArrayList<MSSBamBlobDefBuff> resultList = new ArrayList<MSSBamBlobDefBuff>(); ListIterator<String> classCodeIter = classCodeList.listIterator(); while (classCodeIter.hasNext()) { classCode = classCodeIter.next(); if (classCode.equals("BLB")) { MSSBamBlobDefBuff[] subList = readBuffByPrevIdx(Authorization, PrevId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("TBLB")) { MSSBamTableBlobBuff[] subList = schema.getTableTableBlob().readBuffByPrevIdx(Authorization, PrevId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("SBLB")) { MSSBamSchemaBlobBuff[] subList = schema.getTableSchemaBlob().readBuffByPrevIdx(Authorization, PrevId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect ClassCode \"" + classCode + "\""); } } return (resultList.toArray(new MSSBamBlobDefBuff[0])); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8BoolDefTable.java
public MSSBamBoolDefBuff[] readDerivedByNextIdx(MSSBamAuthorization Authorization, Long NextId) { final String S_ProcName = "readDerivedByNextIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/*from ww w . j ava 2 s.co m*/ ArrayList<String> classCodeList = new ArrayList<String>(); String classCode; try { Connection cnx = schema.getCnx(); String sql = S_sqlSelectBoolDefDistinctClassCode + "WHERE " + ((NextId == null) ? "val.NextId is null " : "val.NextId = " + NextId.toString() + " "); Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); ResultSet resultSet = stmt.executeQuery(sql); while (resultSet.next()) { classCode = resultSet.getString(1); classCodeList.add(classCode); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } ArrayList<MSSBamBoolDefBuff> resultList = new ArrayList<MSSBamBoolDefBuff>(); ListIterator<String> classCodeIter = classCodeList.listIterator(); while (classCodeIter.hasNext()) { classCode = classCodeIter.next(); if (classCode.equals("BLN")) { MSSBamBoolDefBuff[] subList = readBuffByNextIdx(Authorization, NextId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("TBLN")) { MSSBamTableBoolBuff[] subList = schema.getTableTableBool().readBuffByNextIdx(Authorization, NextId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("SBLN")) { MSSBamSchemaBoolBuff[] subList = schema.getTableSchemaBool().readBuffByNextIdx(Authorization, NextId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect ClassCode \"" + classCode + "\""); } } return (resultList.toArray(new MSSBamBoolDefBuff[0])); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8BlobDefTable.java
public MSSBamBlobDefBuff[] readDerivedByNextIdx(MSSBamAuthorization Authorization, Long NextId) { final String S_ProcName = "readDerivedByNextIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/*from ww w . ja v a 2 s. com*/ ArrayList<String> classCodeList = new ArrayList<String>(); String classCode; try { Connection cnx = schema.getCnx(); String sql = S_sqlSelectBlobDefDistinctClassCode + "WHERE " + ((NextId == null) ? "val.NextId is null " : "val.NextId = " + NextId.toString() + " "); Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); ResultSet resultSet = stmt.executeQuery(sql); while (resultSet.next()) { classCode = resultSet.getString(1); classCodeList.add(classCode); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } ArrayList<MSSBamBlobDefBuff> resultList = new ArrayList<MSSBamBlobDefBuff>(); ListIterator<String> classCodeIter = classCodeList.listIterator(); while (classCodeIter.hasNext()) { classCode = classCodeIter.next(); if (classCode.equals("BLB")) { MSSBamBlobDefBuff[] subList = readBuffByNextIdx(Authorization, NextId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("TBLB")) { MSSBamTableBlobBuff[] subList = schema.getTableTableBlob().readBuffByNextIdx(Authorization, NextId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("SBLB")) { MSSBamSchemaBlobBuff[] subList = schema.getTableSchemaBlob().readBuffByNextIdx(Authorization, NextId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect ClassCode \"" + classCode + "\""); } } return (resultList.toArray(new MSSBamBlobDefBuff[0])); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8BoolDefTable.java
public MSSBamBoolDefBuff[] readDerivedByContPrevIdx(MSSBamAuthorization Authorization, long ValueContainerId, Long PrevId) {// www . ja v a2s. c om final String S_ProcName = "readDerivedByContPrevIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); } ArrayList<String> classCodeList = new ArrayList<String>(); String classCode; try { Connection cnx = schema.getCnx(); String sql = S_sqlSelectBoolDefDistinctClassCode + "WHERE " + "val.ValueContainerId = " + Long.toString(ValueContainerId) + " " + "AND " + ((PrevId == null) ? "val.PrevId is null " : "val.PrevId = " + PrevId.toString() + " "); Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); ResultSet resultSet = stmt.executeQuery(sql); while (resultSet.next()) { classCode = resultSet.getString(1); classCodeList.add(classCode); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } ArrayList<MSSBamBoolDefBuff> resultList = new ArrayList<MSSBamBoolDefBuff>(); ListIterator<String> classCodeIter = classCodeList.listIterator(); while (classCodeIter.hasNext()) { classCode = classCodeIter.next(); if (classCode.equals("BLN")) { MSSBamBoolDefBuff[] subList = readBuffByContPrevIdx(Authorization, ValueContainerId, PrevId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("TBLN")) { MSSBamTableBoolBuff[] subList = schema.getTableTableBool().readBuffByContPrevIdx(Authorization, ValueContainerId, PrevId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("SBLN")) { MSSBamSchemaBoolBuff[] subList = schema.getTableSchemaBool().readBuffByContPrevIdx(Authorization, ValueContainerId, PrevId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect ClassCode \"" + classCode + "\""); } } return (resultList.toArray(new MSSBamBoolDefBuff[0])); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8BlobDefTable.java
public MSSBamBlobDefBuff[] readDerivedByContPrevIdx(MSSBamAuthorization Authorization, long ValueContainerId, Long PrevId) {//from w w w . j a va2s . c om final String S_ProcName = "readDerivedByContPrevIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); } ArrayList<String> classCodeList = new ArrayList<String>(); String classCode; try { Connection cnx = schema.getCnx(); String sql = S_sqlSelectBlobDefDistinctClassCode + "WHERE " + "val.ValueContainerId = " + Long.toString(ValueContainerId) + " " + "AND " + ((PrevId == null) ? "val.PrevId is null " : "val.PrevId = " + PrevId.toString() + " "); Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); ResultSet resultSet = stmt.executeQuery(sql); while (resultSet.next()) { classCode = resultSet.getString(1); classCodeList.add(classCode); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } ArrayList<MSSBamBlobDefBuff> resultList = new ArrayList<MSSBamBlobDefBuff>(); ListIterator<String> classCodeIter = classCodeList.listIterator(); while (classCodeIter.hasNext()) { classCode = classCodeIter.next(); if (classCode.equals("BLB")) { MSSBamBlobDefBuff[] subList = readBuffByContPrevIdx(Authorization, ValueContainerId, PrevId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("TBLB")) { MSSBamTableBlobBuff[] subList = schema.getTableTableBlob().readBuffByContPrevIdx(Authorization, ValueContainerId, PrevId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("SBLB")) { MSSBamSchemaBlobBuff[] subList = schema.getTableSchemaBlob().readBuffByContPrevIdx(Authorization, ValueContainerId, PrevId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect ClassCode \"" + classCode + "\""); } } return (resultList.toArray(new MSSBamBlobDefBuff[0])); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8AtomDefTable.java
public MSSBamAtomDefBuff readDerivedByIdIdx(MSSBamAuthorization Authorization, long Id) { final String S_ProcName = "MSSBamPg8AtomDefTable.readDerivedByIdIdx() "; MSSBamAtomDefBuff buff;/*w ww . j a v a2s .c o m*/ if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); } String classCode; try { Connection cnx = schema.getCnx(); String sql = S_sqlSelectAtomDefDistinctClassCode + "WHERE " + "anyo.Id = " + Long.toString(Id) + " "; Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); ResultSet resultSet = stmt.executeQuery(sql); if (resultSet.next()) { classCode = resultSet.getString(1); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-buff response, " + resultSet.getRow() + " rows selected"); } } else { return (null); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } if (classCode.equals("ATM")) { buff = readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("BLB")) { buff = schema.getTableBlobDef().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TBLB")) { buff = schema.getTableTableBlob().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SBLB")) { buff = schema.getTableSchemaBlob().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("BLN")) { buff = schema.getTableBoolDef().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TBLN")) { buff = schema.getTableTableBool().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SBLN")) { buff = schema.getTableSchemaBool().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("DAT")) { buff = schema.getTableDateDef().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TDAT")) { buff = schema.getTableTableDate().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SDAT")) { buff = schema.getTableSchemaDate().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("DBL")) { buff = schema.getTableDoubleDef().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TDBL")) { buff = schema.getTableTableDouble().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SDBL")) { buff = schema.getTableSchemaDouble().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("NUM")) { buff = schema.getTableNumberDef().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TNUM")) { buff = schema.getTableTableNumber().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SNUM")) { buff = schema.getTableSchemaNumber().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("FLT")) { buff = schema.getTableFloatDef().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TFLT")) { buff = schema.getTableTableFloat().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SFLT")) { buff = schema.getTableSchemaFloat().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("I16")) { buff = schema.getTableInt16Def().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TI16")) { buff = schema.getTableTableInt16().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SI16")) { buff = schema.getTableSchemaInt16().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("ENM")) { buff = schema.getTableEnumDef().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TENM")) { buff = schema.getTableTableEnum().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SENM")) { buff = schema.getTableSchemaEnum().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("G16")) { buff = schema.getTableId16GenDef().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TG16")) { buff = schema.getTableTableId16Gen().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SG16")) { buff = schema.getTableSchemaId16Gen().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("U16")) { buff = schema.getTableUInt16Def().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TU16")) { buff = schema.getTableTableUInt16().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SU16")) { buff = schema.getTableSchemaUInt16().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("I32")) { buff = schema.getTableInt32Def().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TI32")) { buff = schema.getTableTableInt32().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SI32")) { buff = schema.getTableSchemaInt32().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("G32")) { buff = schema.getTableId32GenDef().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TG32")) { buff = schema.getTableTableId32Gen().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SG32")) { buff = schema.getTableSchemaId32Gen().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("U32")) { buff = schema.getTableUInt32Def().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TU32")) { buff = schema.getTableTableUInt32().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SU32")) { buff = schema.getTableSchemaUInt32().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("I64")) { buff = schema.getTableInt64Def().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TI64")) { buff = schema.getTableTableInt64().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SI64")) { buff = schema.getTableSchemaInt64().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("G64")) { buff = schema.getTableId64GenDef().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TG64")) { buff = schema.getTableTableId64Gen().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SG64")) { buff = schema.getTableSchemaId64Gen().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("U64")) { buff = schema.getTableUInt64Def().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TU64")) { buff = schema.getTableTableUInt64().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SU64")) { buff = schema.getTableSchemaUInt64().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("UUID")) { buff = schema.getTableUuidDef().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TUUI")) { buff = schema.getTableTableUuid().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SUUI")) { buff = schema.getTableSchemaUuid().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("IDGU")) { buff = schema.getTableUuidGenDef().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TGUU")) { buff = schema.getTableTableUuidGen().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SGUU")) { buff = schema.getTableSchemaUuidGen().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("NMT")) { buff = schema.getTableNmTokenDef().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TNTK")) { buff = schema.getTableTableNmToken().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SNTK")) { buff = schema.getTableSchemaNmToken().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("NMS")) { buff = schema.getTableNmTokensDef().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TNTS")) { buff = schema.getTableTableNmTokens().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SNTS")) { buff = schema.getTableSchemaNmTokens().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("STR")) { buff = schema.getTableStringDef().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TSTR")) { buff = schema.getTableTableString().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SSTR")) { buff = schema.getTableSchemaString().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("ZDY")) { buff = schema.getTableTZDateDef().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TZDY")) { buff = schema.getTableTableTZDate().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SZDY")) { buff = schema.getTableSchemaTZDate().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("ZTM")) { buff = schema.getTableTZTimeDef().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TZTM")) { buff = schema.getTableTableTZTime().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SZTM")) { buff = schema.getTableSchemaTZTime().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("ZSP")) { buff = schema.getTableTZTimestampDef().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TZST")) { buff = schema.getTableTableTZTimestamp().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("SZST")) { buff = schema.getTableSchemaTZTimestamp().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TXT")) { buff = schema.getTableTextDef().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TTXT")) { buff = schema.getTableTableText().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("STXT")) { buff = schema.getTableSchemaText().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TIM")) { buff = schema.getTableTimeDef().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TTIM")) { buff = schema.getTableTableTime().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("STIM")) { buff = schema.getTableSchemaTime().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TSP")) { buff = schema.getTableTimestampDef().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TTSM")) { buff = schema.getTableTableTimestamp().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("STSM")) { buff = schema.getTableSchemaTimestamp().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TKN")) { buff = schema.getTableTokenDef().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("TTOK")) { buff = schema.getTableTableToken().readBuffByIdIdx(Authorization, Id); } else if (classCode.equals("STOK")) { buff = schema.getTableSchemaToken().readBuffByIdIdx(Authorization, Id); } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect ClassCode \"" + classCode + "\""); } return (buff); }
From source file:edu.ku.brc.specify.conversion.ConvertVerifier.java
private void getResultSetsNotRetarded(final String oldSQLArg, final String newSQLArg, String oldValue, String newValue) throws SQLException { try {// w w w .ja v a2 s .com PreparedStatement newStmnt = newDBConn.prepareStatement(newSQLArg, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); PreparedStatement oldStmnt = oldDBConn.prepareStatement(compareTo6DBs ? newSQLArg : oldSQLArg, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); newStmnt.setString(1, newValue); oldStmnt.setString(1, oldValue); newDBRS = newStmnt.executeQuery(); oldDBRS = oldStmnt.executeQuery(); } catch (Exception ex) { ex.printStackTrace(); } }