Example usage for java.sql ResultSet CONCUR_READ_ONLY

List of usage examples for java.sql ResultSet CONCUR_READ_ONLY

Introduction

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

Prototype

int CONCUR_READ_ONLY

To view the source code for java.sql ResultSet CONCUR_READ_ONLY.

Click Source Link

Document

The constant indicating the concurrency mode for a ResultSet object that may NOT be updated.

Usage

From source file:jp.mathes.databaseWiki.db.postgres.PostgresBackend.java

@Override
public List<String> getNames(final String user, final String password, final String db, final String table)
        throws BackendException {
    Statement st = null;//from  w ww .j a v  a 2  s .  co m
    Connection conn = null;
    ResultSet rs = null;
    List<String> result = new LinkedList<String>();
    try {
        conn = this.connectToDB(user, password, db);
        st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
        String query = String.format("select %s from \"%s\".\"%s\"", this.getNameField(conn, table, db),
                this.getSchemaName(table, db), this.getPlainTableName(table));
        this.logString(query.trim(), user);
        rs = st.executeQuery(query.trim());
        while (rs.next()) {
            result.add(rs.getString(1));
        }
    } catch (SQLException e) {
        throw new BackendException(e);
    } catch (ClassNotFoundException e) {
        throw new BackendException(e);
    } finally {
        DbUtils.closeQuietly(rs);
        DbUtils.closeQuietly(st);
        DbUtils.closeQuietly(conn);
    }
    return result;
}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8ChainTable.java

public void deleteChain(MSSBamAuthorization Authorization, MSSBamChainBuff Buff) {
    final String S_ProcName = "deleteChain";
    try {//from w  w w  .jav a2  s.  c om
        Connection cnx = schema.getCnx();
        long Id = Buff.getRequiredId();
        long TableId = Buff.getRequiredTableId();
        String Suffix = Buff.getOptionalSuffix();
        Long PrevRelationId = Buff.getOptionalPrevRelationId();
        Long NextRelationId = Buff.getOptionalNextRelationId();

        String sql = "DELETE FROM mssbam110.chain_def " + "WHERE " + "Id = " + Long.toString(Id) + " ";
        Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
        int rowsAffected = stmt.executeUpdate(sql);
        if (rowsAffected != 1) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "Expected 1 row to be affected by delete, not " + rowsAffected);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    }
}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8BlobDefTable.java

public MSSBamBlobDefBuff[] readDerivedByAuthorIdx(MSSBamAuthorization Authorization, Long AuthorId) {
    final String S_ProcName = "readDerivedByAuthorIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from ww  w.j a v a 2  s.c om*/
    ArrayList<String> classCodeList = new ArrayList<String>();
    String classCode;
    try {
        Connection cnx = schema.getCnx();
        String sql = S_sqlSelectBlobDefDistinctClassCode + "WHERE "
                + ((AuthorId == null) ? "anyo.AuthorId is null "
                        : "anyo.AuthorId = " + AuthorId.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 = readBuffByAuthorIdx(Authorization, AuthorId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("TBLB")) {
            MSSBamTableBlobBuff[] subList = schema.getTableTableBlob().readBuffByAuthorIdx(Authorization,
                    AuthorId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("SBLB")) {
            MSSBamSchemaBlobBuff[] subList = schema.getTableSchemaBlob().readBuffByAuthorIdx(Authorization,
                    AuthorId);
            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:com.commander4j.db.JDBUserReport.java

public boolean runReport() {
    PreparedStatement prepStatement;
    boolean result = true;

    try {//from   w w  w .  ja  v  a  2 s.c  om
        prepStatement = Common.hostList.getHost(getHostID()).getConnection(getSessionID())
                .prepareStatement(getSQL(), ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
        prepStatement.setFetchSize(25);

        if (isParamDateRequired()) {
            prepStatement.setTimestamp(1, getParamFromDate());
            prepStatement.setTimestamp(2, getParamToDate());
        }

        if (getDestination().equals("SYSTEM")) {
            for (int x = 0; x < systemParams.size(); x++) {
                String type = systemParams.get(x).parameterType;

                if (type.toLowerCase().equals("string")) {
                    prepStatement.setString(systemParams.get(x).parameterPosition,
                            systemParams.get(x).parameterStringValue);
                }
                if (type.toLowerCase().equals("integer")) {
                    prepStatement.setInt(systemParams.get(x).parameterPosition,
                            systemParams.get(x).parameterIntegerValue);
                }
                if (type.toLowerCase().equals("long")) {
                    prepStatement.setLong(systemParams.get(x).parameterPosition,
                            systemParams.get(x).parameterLongValue);
                }
                if (type.toLowerCase().equals("timestamp")) {
                    prepStatement.setTimestamp(systemParams.get(x).parameterPosition,
                            systemParams.get(x).parameterTimestampValue);
                }
            }
        }

        ResultSet tempResult = prepStatement.executeQuery();

        boolean dataReturned = true;
        if (!tempResult.next()) {
            dataReturned = false;
        }
        tempResult.beforeFirst();
        if (dataReturned) {
            if (getDestination().equals("EXCEL")) {
                generateExcel(tempResult);
            }

            if (getDestination().equals("JASPER_REPORTS")) {
                generateJasper(prepStatement);
            }
            if (getDestination().equals("PDF")) {
                generatePDF(prepStatement);
            }
            if (getDestination().equals("ACCESS")) {
                generateAccess(tempResult);
            }

            if (getDestination().equals("CSV")) {
                generateCSV(tempResult);
            }

            if (getDestination().equals("SYSTEM")) {
                generateSYSTEM(tempResult);
            }

            if (isPreviewRequired()) {
                try {
                    Desktop.getDesktop().open(new File(getExportFilename()));
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

            if (isEmailEnabled()) {

                String emailaddresses = getEmailAddresses();

                if (isEmailPromptEnabled()) {
                    emailaddresses = JUtility.replaceNullStringwithBlank(
                            JOptionPane.showInputDialog(lang.get("lbl_Email_Addresses")));
                }

                StringConverter stringConverter = new StringConverter();
                ArrayConverter arrayConverter = new ArrayConverter(String[].class, stringConverter);
                arrayConverter.setDelimiter(';');
                arrayConverter.setAllowedChars(new char[] { '@', '_' });

                String[] emailList = (String[]) arrayConverter.convert(String[].class, emailaddresses);

                if (emailList.length > 0) {
                    String shortFilename = JUtility.getFilenameFromPath(getExportFilename());
                    mail.postMail(emailList,
                            "Commande4j User Report requested by "
                                    + Common.userList.getUser(Common.sessionID).getUserId() + " from ["
                                    + Common.hostList.getHost(getHostID()).getSiteDescription() + "] on "
                                    + JUtility.getClientName(),
                            "See attached report.\n", shortFilename, getExportFilename());
                    com.commander4j.util.JWait.milliSec(2000);
                }
            }

        } else {
            result = false;
            setErrorMessage("No data returned by query.");
        }

    } catch (Exception ex) {
        setErrorMessage(ex.getMessage());
        result = false;
    }

    return result;
}

From source file:com.toxind.benchmark.thrid.ibatis.sqlmap.engine.execution.SqlExecutor.java

private CallableStatement prepareCall(SessionScope sessionScope, Connection conn, String sql, Integer rsType)
        throws SQLException {
    SqlMapExecutorDelegate delegate = ((SqlMapClientImpl) sessionScope.getSqlMapExecutor()).getDelegate();
    if (sessionScope.hasPreparedStatementFor(sql)) {
        return (CallableStatement) sessionScope.getPreparedStatement((sql));
    } else {/*  w  w  w  . java  2 s . c  om*/
        CallableStatement cs = conn.prepareCall(sql, rsType.intValue(), ResultSet.CONCUR_READ_ONLY);
        sessionScope.putPreparedStatement(delegate, sql, cs);
        return cs;
    }
}

From source file:edu.ku.brc.specify.conversion.SynonymCleanup.java

/**
 * @param newDBConn/*w  w  w .j av a2 s.  c  o m*/
 * @param tblWriter
 * @param phHelper
 * @param parentLevelRankID
 * @param childLevelRankID
 */
public void fixMisparentedSynonymsLevel(final Connection newDBConn, final TableWriter tblWriter,
        final PlaceholderHelper phHelper, final int parentLevelRankID, final int childLevelRankID,
        final boolean skipBadParentRanks, final int[] stats, final Set<Integer> processedKeys,
        int progressInterval, boolean doPercent) {

    DBTableInfo ti = DBTableIdMgr.getInstance().getInfoById(Taxon.getClassTableId());
    String whereStr = QueryAdjusterForDomain.getInstance().getSpecialColumns(ti, false);

    String parentName = BasicSQLUtils.querySingleObj(String
            .format("SELECT Name FROM taxontreedefitem WHERE %s AND RankID = %d", whereStr, parentLevelRankID));
    String childName = BasicSQLUtils.querySingleObj(String
            .format("SELECT Name FROM taxontreedefitem WHERE %s AND RankID = %d", whereStr, childLevelRankID));

    int numFixed = BasicSQLUtils.update(newDBConn,
            "UPDATE taxon SET IsAccepted=1 WHERE IsAccepted = 0 AND AcceptedID IS NULL AND " + whereStr);
    log.debug("Number of IsAccepted Fixed: " + numFixed);

    log.debug(String.format("\nParent: %s (%d)    Child: %s (%d)", parentName, parentLevelRankID, childName,
            childLevelRankID));

    Taxon phTop = phHelper.getHighestPlaceHolder();
    if (phTop.getId() != null && phTop.getNodeNumber() != null && phTop.getHighestChildNodeNumber() != null) {
        whereStr = "((" + whereStr + ") AND  NOT NodeNumber BETWEEN " + phTop.getNodeNumber() + " AND "
                + phTop.getHighestChildNodeNumber() + ")";
    }
    String postfix = " FROM taxon WHERE IsAccepted = 0 AND AcceptedID IS NOT NULL AND RankID = "
            + childLevelRankID + " AND " + whereStr;
    int totalCnt = BasicSQLUtils.getCountAsInt("SELECT COUNT(TaxonID) " + postfix);

    //System.out.println("fixMisparentedSynonymsLevel: " + parentLevelRankID + " > " + childLevelRankID + " (" + totalCnt + ")");

    if (totalCnt == 0) {
        return;
    }

    UIFieldFormatterIFace catNumFmt = DBTableIdMgr.getFieldFormatterFor(CollectionObject.class,
            "CatalogNumber");

    log.debug("SELECT COUNT(TaxonID) " + postfix);

    int cnt = stats[3];
    try {

        tooManyCnt = 0;
        notFoundCnt = 0;

        int processCnt = stats[0]; //
        int withCatNumCnt = stats[1]; //
        int correct = stats[2]; //
        int fndCnt = stats[4]; //
        int phCnt = stats[5]; //
        int err = stats[6]; //
        int updateErr = stats[7]; //

        String searchStr = String.format(
                "SELECT TaxonID, FullName, Name FROM taxon WHERE IsAccepted <> 0 AND BINARY FullName = ? AND RankID = ? AND %s",
                whereStr);
        pTaxNodeStmt = newDBConn.prepareStatement(searchStr);

        pCatNumStmt = newDBConn.prepareStatement(
                "SELECT co.CatalogNumber FROM taxon t INNER JOIN determination d ON t.TaxonID = d.TaxonID "
                        + "INNER JOIN collectionobject co ON d.CollectionObjectID = co.CollectionObjectID "
                        + "WHERE t.TaxonID = ?");

        pUpdateStmt = newDBConn.prepareStatement("UPDATE taxon SET ParentID=? WHERE TaxonID = ?");

        Statement st = newDBConn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
        ResultSet rs = st.executeQuery(
                "SELECT TaxonID, RankID, FullName, ParentID " + postfix + " ORDER BY FullNAme ASC");
        while (rs.next()) {
            int taxonID = rs.getInt(1);
            if (processedKeys != null && processedKeys.contains(taxonID)) {
                continue;
            }
            int rankId = rs.getInt(2);
            String fullName = rs.getString(3);
            int oldParentId = rs.getInt(4);
            boolean oldParentIdNull = rs.wasNull();

            //System.err.println("-------["+fullName+"]-------");

            String oldParentName = "";
            Integer parentRankID = null;
            if (oldParentIdNull) {
                oldParentName = NBSP;
            } else {
                Object[] row = BasicSQLUtils
                        .queryForRow("SELECT FullName,RankID FROM taxon WHERE TaxonID = " + oldParentId);

                oldParentName = (String) row[0];
                parentRankID = (Integer) row[1];
            }

            boolean parentRankOK = parentRankID != null && parentRankID == parentLevelRankID;

            if (!parentRankOK && parentRankID != null && skipBadParentRanks) {
                continue;
            }

            if (processedKeys != null) {
                processedKeys.add(taxonID);
            }

            boolean getParent = !((moveAllSynsOfLowerRanksToPlaceHolder
                    && (parentRankID != null && parentRankID >= childLevelRankID))
                    || childLevelRankID > maxSynRankToReparent);

            ArrayList<String> names = parseFullName(fullName);
            String parent = parentLevelRankID == 180 ? names.get(0) : getParentFullName(names); // names.get(0);
            Integer newParentID = parentRankOK && getParent ? getTaxonNode(parent, parentLevelRankID) : null;
            String oldFamily = !oldParentIdNull && parentRankOK ? getFamilyName(oldParentId) : NBSP;
            String catNums = getCatNumsForTaxon(taxonID, catNumFmt);

            if (!parentRankOK) {
                oldParentName = NBSP;
            }

            if (!catNums.equals(NBSP)) {
                withCatNumCnt++;
            }

            if (newParentID != null) {
                if (newParentID != oldParentId) // Search for new Parent and
                // found one
                {
                    cnt++;
                    String newFamily = getFamilyName(newParentID);
                    tblWriter.logWithSpaces(Integer.toString(cnt), fullName, oldParentName, oldFamily, parent,
                            newFamily, catNums);
                    if (doCleanup) {
                        if (update(newParentID, taxonID)) {
                            updateErr++;
                        }
                    }
                    fndCnt++;
                } else {
                    correct++;
                }
            } else {
                Taxon placeHolder = getPlaceHolder(phHelper, parentLevelRankID, childLevelRankID);
                if (placeHolder != null) {
                    cnt++;
                    tblWriter.logWithSpaces(Integer.toString(cnt), fullName, oldParentName, oldFamily,
                            placeHolder.getName(), NBSP, catNums);
                    phCnt++;
                    if (doCleanup) {
                        if (update(placeHolder.getId(), taxonID)) {
                            updateErr++;
                        }
                    }
                } else {
                    cnt++;
                    tblWriter.logErrors(Integer.toString(cnt), fullName, String.format("Bad RankID %s", rankId),
                            oldFamily, parent, NBSP, catNums);
                    err++;
                }
            }
            processCnt++;

            if (processCnt % progressInterval == 0) {
                int p = (int) (((processCnt * 100) / (double) totalCnt) + 0.5);
                setProgress(doPercent ? p : processCnt, null);
            }
        }
        rs.close();

        stats[0] = processCnt; //1
        stats[1] = withCatNumCnt; //2
        stats[2] = correct; //3
        stats[3] = cnt; //4
        stats[4] = fndCnt; //5
        stats[5] = phCnt; //6
        stats[6] = err; //7
        stats[7] = updateErr; //8

        pTaxNodeStmt.close();
        pCatNumStmt.close();
        pUpdateStmt.close();

        st.close();

    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8BaseDomainTable.java

public MSSBamBaseDomainBuff[] readDerivedByAuthorIdx(MSSBamAuthorization Authorization, Long AuthorId) {
    final String S_ProcName = "readDerivedByAuthorIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//from w ww .  j a v a  2 s .  co  m
    ArrayList<String> classCodeList = new ArrayList<String>();
    String classCode;
    try {
        Connection cnx = schema.getCnx();
        String sql = S_sqlSelectBaseDomainDistinctClassCode + "WHERE "
                + ((AuthorId == null) ? "anyo.AuthorId is null "
                        : "anyo.AuthorId = " + AuthorId.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<MSSBamBaseDomainBuff> resultList = new ArrayList<MSSBamBaseDomainBuff>();
    ListIterator<String> classCodeIter = classCodeList.listIterator();
    while (classCodeIter.hasNext()) {
        classCode = classCodeIter.next();
        if (classCode.equals("BDM")) {
            MSSBamBaseDomainBuff[] subList = readBuffByAuthorIdx(Authorization, AuthorId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("DOM")) {
            MSSBamDomainBuff[] subList = schema.getTableDomain().readBuffByAuthorIdx(Authorization, AuthorId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("LENT")) {
            MSSBamLegalEntityBuff[] subList = schema.getTableLegalEntity().readBuffByAuthorIdx(Authorization,
                    AuthorId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("COM")) {
            MSSBamCompanyBuff[] subList = schema.getTableCompany().readBuffByAuthorIdx(Authorization, AuthorId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("USR")) {
            MSSBamUserBuff[] subList = schema.getTableUser().readBuffByAuthorIdx(Authorization, AuthorId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("PRJ")) {
            MSSBamProjectBuff[] subList = schema.getTableProject().readBuffByAuthorIdx(Authorization, AuthorId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("VER")) {
            MSSBamVersionBuff[] subList = schema.getTableVersion().readBuffByAuthorIdx(Authorization, AuthorId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("MJV")) {
            MSSBamMajorVersionBuff[] subList = schema.getTableMajorVersion().readBuffByAuthorIdx(Authorization,
                    AuthorId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("MNV")) {
            MSSBamMinorVersionBuff[] subList = schema.getTableMinorVersion().readBuffByAuthorIdx(Authorization,
                    AuthorId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("TLD")) {
            MSSBamTLDBuff[] subList = schema.getTableTLD().readBuffByAuthorIdx(Authorization, AuthorId);
            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 MSSBamBaseDomainBuff[0]));

}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8AtomDefTable.java

public MSSBamAtomDefBuff readDerived(MSSBamAuthorization Authorization, MSSBamAnyObjPKey PKey) {
    final String S_ProcName = "readDerived()";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*  w w w.j a va  2  s .co m*/
    MSSBamAtomDefBuff buff;
    long Id = PKey.getRequiredId();
    String classCode;
    try {
        Connection cnx = schema.getCnx();
        String sql = S_sqlSelectAtomDefDistinctClassCode + "WHERE " + "atm.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 = readBuff(Authorization, PKey);
    } else if (classCode.equals("BLB")) {
        buff = schema.getTableBlobDef().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TBLB")) {
        buff = schema.getTableTableBlob().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SBLB")) {
        buff = schema.getTableSchemaBlob().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("BLN")) {
        buff = schema.getTableBoolDef().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TBLN")) {
        buff = schema.getTableTableBool().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SBLN")) {
        buff = schema.getTableSchemaBool().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("DAT")) {
        buff = schema.getTableDateDef().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TDAT")) {
        buff = schema.getTableTableDate().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SDAT")) {
        buff = schema.getTableSchemaDate().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("DBL")) {
        buff = schema.getTableDoubleDef().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TDBL")) {
        buff = schema.getTableTableDouble().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SDBL")) {
        buff = schema.getTableSchemaDouble().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("NUM")) {
        buff = schema.getTableNumberDef().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TNUM")) {
        buff = schema.getTableTableNumber().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SNUM")) {
        buff = schema.getTableSchemaNumber().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("FLT")) {
        buff = schema.getTableFloatDef().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TFLT")) {
        buff = schema.getTableTableFloat().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SFLT")) {
        buff = schema.getTableSchemaFloat().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("I16")) {
        buff = schema.getTableInt16Def().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TI16")) {
        buff = schema.getTableTableInt16().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SI16")) {
        buff = schema.getTableSchemaInt16().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("ENM")) {
        buff = schema.getTableEnumDef().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TENM")) {
        buff = schema.getTableTableEnum().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SENM")) {
        buff = schema.getTableSchemaEnum().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("G16")) {
        buff = schema.getTableId16GenDef().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TG16")) {
        buff = schema.getTableTableId16Gen().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SG16")) {
        buff = schema.getTableSchemaId16Gen().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("U16")) {
        buff = schema.getTableUInt16Def().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TU16")) {
        buff = schema.getTableTableUInt16().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SU16")) {
        buff = schema.getTableSchemaUInt16().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("I32")) {
        buff = schema.getTableInt32Def().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TI32")) {
        buff = schema.getTableTableInt32().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SI32")) {
        buff = schema.getTableSchemaInt32().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("G32")) {
        buff = schema.getTableId32GenDef().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TG32")) {
        buff = schema.getTableTableId32Gen().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SG32")) {
        buff = schema.getTableSchemaId32Gen().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("U32")) {
        buff = schema.getTableUInt32Def().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TU32")) {
        buff = schema.getTableTableUInt32().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SU32")) {
        buff = schema.getTableSchemaUInt32().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("I64")) {
        buff = schema.getTableInt64Def().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TI64")) {
        buff = schema.getTableTableInt64().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SI64")) {
        buff = schema.getTableSchemaInt64().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("G64")) {
        buff = schema.getTableId64GenDef().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TG64")) {
        buff = schema.getTableTableId64Gen().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SG64")) {
        buff = schema.getTableSchemaId64Gen().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("U64")) {
        buff = schema.getTableUInt64Def().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TU64")) {
        buff = schema.getTableTableUInt64().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SU64")) {
        buff = schema.getTableSchemaUInt64().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("UUID")) {
        buff = schema.getTableUuidDef().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TUUI")) {
        buff = schema.getTableTableUuid().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SUUI")) {
        buff = schema.getTableSchemaUuid().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("IDGU")) {
        buff = schema.getTableUuidGenDef().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TGUU")) {
        buff = schema.getTableTableUuidGen().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SGUU")) {
        buff = schema.getTableSchemaUuidGen().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("NMT")) {
        buff = schema.getTableNmTokenDef().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TNTK")) {
        buff = schema.getTableTableNmToken().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SNTK")) {
        buff = schema.getTableSchemaNmToken().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("NMS")) {
        buff = schema.getTableNmTokensDef().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TNTS")) {
        buff = schema.getTableTableNmTokens().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SNTS")) {
        buff = schema.getTableSchemaNmTokens().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("STR")) {
        buff = schema.getTableStringDef().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TSTR")) {
        buff = schema.getTableTableString().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SSTR")) {
        buff = schema.getTableSchemaString().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("ZDY")) {
        buff = schema.getTableTZDateDef().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TZDY")) {
        buff = schema.getTableTableTZDate().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SZDY")) {
        buff = schema.getTableSchemaTZDate().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("ZTM")) {
        buff = schema.getTableTZTimeDef().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TZTM")) {
        buff = schema.getTableTableTZTime().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SZTM")) {
        buff = schema.getTableSchemaTZTime().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("ZSP")) {
        buff = schema.getTableTZTimestampDef().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TZST")) {
        buff = schema.getTableTableTZTimestamp().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("SZST")) {
        buff = schema.getTableSchemaTZTimestamp().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TXT")) {
        buff = schema.getTableTextDef().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TTXT")) {
        buff = schema.getTableTableText().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("STXT")) {
        buff = schema.getTableSchemaText().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TIM")) {
        buff = schema.getTableTimeDef().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TTIM")) {
        buff = schema.getTableTableTime().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("STIM")) {
        buff = schema.getTableSchemaTime().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TSP")) {
        buff = schema.getTableTimestampDef().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TTSM")) {
        buff = schema.getTableTableTimestamp().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("STSM")) {
        buff = schema.getTableSchemaTimestamp().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TKN")) {
        buff = schema.getTableTokenDef().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("TTOK")) {
        buff = schema.getTableTableToken().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else if (classCode.equals("STOK")) {
        buff = schema.getTableSchemaToken().readBuffByIdIdx(Authorization, PKey.getRequiredId());
    } else {
        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                "Did not expect ClassCode \"" + classCode + "\"");
    }
    return (buff);
}

From source file:com.udps.hive.jdbc.HiveConnection.java

@Override
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
    if (resultSetConcurrency != ResultSet.CONCUR_READ_ONLY) {
        throw new SQLException(
                "Statement with resultset concurrency " + resultSetConcurrency + " is not supported", "HYC00"); // Optional
        // feature
        // not/*from w ww.  j ava 2  s.c  om*/
        // implemented
    }
    if (resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE) {
        throw new SQLException("Statement with resultset type " + resultSetType + " is not supported", "HYC00"); // Optional
        // feature
        // not
        // implemented
    }
    return new HiveStatement(this, client, sessHandle, resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE);
}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8BoolDefTable.java

public MSSBamBoolDefBuff readDerivedByUNameIdx(MSSBamAuthorization Authorization, Long ScopeId, String Name) {
    final String S_ProcName = "MSSBamPg8BoolDefTable.readDerivedByUNameIdx() ";
    MSSBamBoolDefBuff buff;//from  w w  w.  j  av a2s. c om
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }
    String classCode;
    try {
        Connection cnx = schema.getCnx();
        String sql = S_sqlSelectBoolDefDistinctClassCode + "WHERE "
                + ((ScopeId == null) ? "anyo.ScopeId is null " : "anyo.ScopeId = " + ScopeId.toString() + " ")
                + "AND " + "anyo.Name = " + MSSBamPg8Schema.getQuotedString(Name) + " ";
        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("BLN")) {
        buff = readBuffByUNameIdx(Authorization, ScopeId, Name);
    } else if (classCode.equals("TBLN")) {
        buff = schema.getTableTableBool().readBuffByUNameIdx(Authorization, ScopeId, Name);
    } else if (classCode.equals("SBLN")) {
        buff = schema.getTableSchemaBool().readBuffByUNameIdx(Authorization, ScopeId, Name);
    } else {
        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                "Did not expect ClassCode \"" + classCode + "\"");
    }
    return (buff);
}