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:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8BoolDefTable.java

public MSSBamBoolDefBuff[] readDerivedByVAccFreqIdx(MSSBamAuthorization Authorization,
        Short ViewAccessFrequencyId) {
    final String S_ProcName = "readDerivedByVAccFreqIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//w  w  w  .ja v a 2 s .c  o m
    ArrayList<String> classCodeList = new ArrayList<String>();
    String classCode;
    try {
        Connection cnx = schema.getCnx();
        String sql = S_sqlSelectBoolDefDistinctClassCode + "WHERE "
                + ((ViewAccessFrequencyId == null) ? "val.ViewAccessFrequencyId is null "
                        : "val.ViewAccessFrequencyId = " + ViewAccessFrequencyId.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 = readBuffByVAccFreqIdx(Authorization, ViewAccessFrequencyId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("TBLN")) {
            MSSBamTableBoolBuff[] subList = schema.getTableTableBool().readBuffByVAccFreqIdx(Authorization,
                    ViewAccessFrequencyId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("SBLN")) {
            MSSBamSchemaBoolBuff[] subList = schema.getTableSchemaBool().readBuffByVAccFreqIdx(Authorization,
                    ViewAccessFrequencyId);
            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.MSSBamPg8BaseDomainTable.java

public MSSBamBaseDomainBuff[] readBuffByTenantIdx(MSSBamAuthorization Authorization, long TenantId) {
    final String S_ProcName = "readBuffByTenantIdx";
    try {/* w  w w  . j a  v a2 s.c  o m*/
        Connection cnx = schema.getCnx();
        String sql = S_sqlSelectBaseDomainBuff + "WHERE " + "anyo.TenantId = " + Long.toString(TenantId) + " "
                + "ORDER BY " + "anyo.Id ASC";
        Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
        ResultSet resultSet = stmt.executeQuery(sql);
        List<MSSBamBaseDomainBuff> buffList = new ArrayList<MSSBamBaseDomainBuff>();
        while (resultSet.next()) {
            MSSBamBaseDomainBuff buff = unpackBaseDomainResultSetToBuff(resultSet);
            buffList.add(buff);
        }
        return (buffList.toArray(new MSSBamBaseDomainBuff[0]));
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    }
}

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

public MSSBamBlobDefBuff[] readDerivedByVAccFreqIdx(MSSBamAuthorization Authorization,
        Short ViewAccessFrequencyId) {
    final String S_ProcName = "readDerivedByVAccFreqIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*w  w w .j a  va2s  .c om*/
    ArrayList<String> classCodeList = new ArrayList<String>();
    String classCode;
    try {
        Connection cnx = schema.getCnx();
        String sql = S_sqlSelectBlobDefDistinctClassCode + "WHERE "
                + ((ViewAccessFrequencyId == null) ? "val.ViewAccessFrequencyId is null "
                        : "val.ViewAccessFrequencyId = " + ViewAccessFrequencyId.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 = readBuffByVAccFreqIdx(Authorization, ViewAccessFrequencyId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("TBLB")) {
            MSSBamTableBlobBuff[] subList = schema.getTableTableBlob().readBuffByVAccFreqIdx(Authorization,
                    ViewAccessFrequencyId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("SBLB")) {
            MSSBamSchemaBlobBuff[] subList = schema.getTableSchemaBlob().readBuffByVAccFreqIdx(Authorization,
                    ViewAccessFrequencyId);
            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.MSSBamPg8BaseDomainTable.java

public MSSBamBaseDomainBuff[] readBuffByScopeIdx(MSSBamAuthorization Authorization, Long ScopeId) {
    final String S_ProcName = "readBuffByScopeIdx";
    try {//from   ww w  .  j  a  va2  s . co m
        Connection cnx = schema.getCnx();
        String sql = S_sqlSelectBaseDomainBuff + "WHERE "
                + ((ScopeId == null) ? "anyo.ScopeId is null " : "anyo.ScopeId = " + ScopeId.toString() + " ")
                + "ORDER BY " + "anyo.Id ASC";
        Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
        ResultSet resultSet = stmt.executeQuery(sql);
        List<MSSBamBaseDomainBuff> buffList = new ArrayList<MSSBamBaseDomainBuff>();
        while (resultSet.next()) {
            MSSBamBaseDomainBuff buff = unpackBaseDomainResultSetToBuff(resultSet);
            buffList.add(buff);
        }
        return (buffList.toArray(new MSSBamBaseDomainBuff[0]));
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    }
}

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

public MSSBamAnyObjBuff[] readAllDerived(MSSBamAuthorization Authorization) {
    final String S_ProcName = "readAllDerived";
    MSSBamAnyObjBuff[] buffArray;/* w w w . ja v a  2  s. c o m*/
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }
    String classCode;
    ArrayList<String> classCodeList = new ArrayList<String>();
    try {
        Connection cnx = schema.getCnx();
        String sql = S_sqlSelectAnyObjDistinctClassCode;
        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<MSSBamAnyObjBuff> resultList = new ArrayList<MSSBamAnyObjBuff>();
    for (int classCodeIdx = 0; classCodeIdx < classCodeList.size(); classCodeIdx++) {
        MSSBamAnyObjBuff[] subList;
        classCode = classCodeList.get(classCodeIdx);
        if (classCode.equals("ANYO")) {
            subList = readAllBuff(Authorization);
        } else if (classCode.equals("SCP")) {
            subList = schema.getTableScope().readAllBuff(Authorization);
        } else if (classCode.equals("DICT")) {
            subList = schema.getTableDictionary().readAllBuff(Authorization);
        } else if (classCode.equals("RMD")) {
            subList = schema.getTableMSSBam().readAllBuff(Authorization);
        } else if (classCode.equals("BDM")) {
            subList = schema.getTableBaseDomain().readAllBuff(Authorization);
        } else if (classCode.equals("DOM")) {
            subList = schema.getTableDomain().readAllBuff(Authorization);
        } else if (classCode.equals("LENT")) {
            subList = schema.getTableLegalEntity().readAllBuff(Authorization);
        } else if (classCode.equals("COM")) {
            subList = schema.getTableCompany().readAllBuff(Authorization);
        } else if (classCode.equals("USR")) {
            subList = schema.getTableUser().readAllBuff(Authorization);
        } else if (classCode.equals("PRJ")) {
            subList = schema.getTableProject().readAllBuff(Authorization);
        } else if (classCode.equals("VER")) {
            subList = schema.getTableVersion().readAllBuff(Authorization);
        } else if (classCode.equals("MJV")) {
            subList = schema.getTableMajorVersion().readAllBuff(Authorization);
        } else if (classCode.equals("MNV")) {
            subList = schema.getTableMinorVersion().readAllBuff(Authorization);
        } else if (classCode.equals("TLD")) {
            subList = schema.getTableTLD().readAllBuff(Authorization);
        } else if (classCode.equals("IDX")) {
            subList = schema.getTableIndex().readAllBuff(Authorization);
        } else if (classCode.equals("REL")) {
            subList = schema.getTableRelation().readAllBuff(Authorization);
        } else if (classCode.equals("SCH")) {
            subList = schema.getTableSchemaDef().readAllBuff(Authorization);
        } else if (classCode.equals("TBL")) {
            subList = schema.getTableTable().readAllBuff(Authorization);
        } else if (classCode.equals("VAL")) {
            subList = schema.getTableValue().readAllBuff(Authorization);
        } else if (classCode.equals("ATM")) {
            subList = schema.getTableAtomDef().readAllBuff(Authorization);
        } else if (classCode.equals("BLB")) {
            subList = schema.getTableBlobDef().readAllBuff(Authorization);
        } else if (classCode.equals("TBLB")) {
            subList = schema.getTableTableBlob().readAllBuff(Authorization);
        } else if (classCode.equals("SBLB")) {
            subList = schema.getTableSchemaBlob().readAllBuff(Authorization);
        } else if (classCode.equals("BLN")) {
            subList = schema.getTableBoolDef().readAllBuff(Authorization);
        } else if (classCode.equals("TBLN")) {
            subList = schema.getTableTableBool().readAllBuff(Authorization);
        } else if (classCode.equals("SBLN")) {
            subList = schema.getTableSchemaBool().readAllBuff(Authorization);
        } else if (classCode.equals("DAT")) {
            subList = schema.getTableDateDef().readAllBuff(Authorization);
        } else if (classCode.equals("TDAT")) {
            subList = schema.getTableTableDate().readAllBuff(Authorization);
        } else if (classCode.equals("SDAT")) {
            subList = schema.getTableSchemaDate().readAllBuff(Authorization);
        } else if (classCode.equals("DBL")) {
            subList = schema.getTableDoubleDef().readAllBuff(Authorization);
        } else if (classCode.equals("TDBL")) {
            subList = schema.getTableTableDouble().readAllBuff(Authorization);
        } else if (classCode.equals("SDBL")) {
            subList = schema.getTableSchemaDouble().readAllBuff(Authorization);
        } else if (classCode.equals("NUM")) {
            subList = schema.getTableNumberDef().readAllBuff(Authorization);
        } else if (classCode.equals("TNUM")) {
            subList = schema.getTableTableNumber().readAllBuff(Authorization);
        } else if (classCode.equals("SNUM")) {
            subList = schema.getTableSchemaNumber().readAllBuff(Authorization);
        } else if (classCode.equals("FLT")) {
            subList = schema.getTableFloatDef().readAllBuff(Authorization);
        } else if (classCode.equals("TFLT")) {
            subList = schema.getTableTableFloat().readAllBuff(Authorization);
        } else if (classCode.equals("SFLT")) {
            subList = schema.getTableSchemaFloat().readAllBuff(Authorization);
        } else if (classCode.equals("I16")) {
            subList = schema.getTableInt16Def().readAllBuff(Authorization);
        } else if (classCode.equals("TI16")) {
            subList = schema.getTableTableInt16().readAllBuff(Authorization);
        } else if (classCode.equals("SI16")) {
            subList = schema.getTableSchemaInt16().readAllBuff(Authorization);
        } else if (classCode.equals("ENM")) {
            subList = schema.getTableEnumDef().readAllBuff(Authorization);
        } else if (classCode.equals("TENM")) {
            subList = schema.getTableTableEnum().readAllBuff(Authorization);
        } else if (classCode.equals("SENM")) {
            subList = schema.getTableSchemaEnum().readAllBuff(Authorization);
        } else if (classCode.equals("G16")) {
            subList = schema.getTableId16GenDef().readAllBuff(Authorization);
        } else if (classCode.equals("TG16")) {
            subList = schema.getTableTableId16Gen().readAllBuff(Authorization);
        } else if (classCode.equals("SG16")) {
            subList = schema.getTableSchemaId16Gen().readAllBuff(Authorization);
        } else if (classCode.equals("U16")) {
            subList = schema.getTableUInt16Def().readAllBuff(Authorization);
        } else if (classCode.equals("TU16")) {
            subList = schema.getTableTableUInt16().readAllBuff(Authorization);
        } else if (classCode.equals("SU16")) {
            subList = schema.getTableSchemaUInt16().readAllBuff(Authorization);
        } else if (classCode.equals("I32")) {
            subList = schema.getTableInt32Def().readAllBuff(Authorization);
        } else if (classCode.equals("TI32")) {
            subList = schema.getTableTableInt32().readAllBuff(Authorization);
        } else if (classCode.equals("SI32")) {
            subList = schema.getTableSchemaInt32().readAllBuff(Authorization);
        } else if (classCode.equals("G32")) {
            subList = schema.getTableId32GenDef().readAllBuff(Authorization);
        } else if (classCode.equals("TG32")) {
            subList = schema.getTableTableId32Gen().readAllBuff(Authorization);
        } else if (classCode.equals("SG32")) {
            subList = schema.getTableSchemaId32Gen().readAllBuff(Authorization);
        } else if (classCode.equals("U32")) {
            subList = schema.getTableUInt32Def().readAllBuff(Authorization);
        } else if (classCode.equals("TU32")) {
            subList = schema.getTableTableUInt32().readAllBuff(Authorization);
        } else if (classCode.equals("SU32")) {
            subList = schema.getTableSchemaUInt32().readAllBuff(Authorization);
        } else if (classCode.equals("I64")) {
            subList = schema.getTableInt64Def().readAllBuff(Authorization);
        } else if (classCode.equals("TI64")) {
            subList = schema.getTableTableInt64().readAllBuff(Authorization);
        } else if (classCode.equals("SI64")) {
            subList = schema.getTableSchemaInt64().readAllBuff(Authorization);
        } else if (classCode.equals("G64")) {
            subList = schema.getTableId64GenDef().readAllBuff(Authorization);
        } else if (classCode.equals("TG64")) {
            subList = schema.getTableTableId64Gen().readAllBuff(Authorization);
        } else if (classCode.equals("SG64")) {
            subList = schema.getTableSchemaId64Gen().readAllBuff(Authorization);
        } else if (classCode.equals("U64")) {
            subList = schema.getTableUInt64Def().readAllBuff(Authorization);
        } else if (classCode.equals("TU64")) {
            subList = schema.getTableTableUInt64().readAllBuff(Authorization);
        } else if (classCode.equals("SU64")) {
            subList = schema.getTableSchemaUInt64().readAllBuff(Authorization);
        } else if (classCode.equals("UUID")) {
            subList = schema.getTableUuidDef().readAllBuff(Authorization);
        } else if (classCode.equals("TUUI")) {
            subList = schema.getTableTableUuid().readAllBuff(Authorization);
        } else if (classCode.equals("SUUI")) {
            subList = schema.getTableSchemaUuid().readAllBuff(Authorization);
        } else if (classCode.equals("IDGU")) {
            subList = schema.getTableUuidGenDef().readAllBuff(Authorization);
        } else if (classCode.equals("TGUU")) {
            subList = schema.getTableTableUuidGen().readAllBuff(Authorization);
        } else if (classCode.equals("SGUU")) {
            subList = schema.getTableSchemaUuidGen().readAllBuff(Authorization);
        } else if (classCode.equals("NMT")) {
            subList = schema.getTableNmTokenDef().readAllBuff(Authorization);
        } else if (classCode.equals("TNTK")) {
            subList = schema.getTableTableNmToken().readAllBuff(Authorization);
        } else if (classCode.equals("SNTK")) {
            subList = schema.getTableSchemaNmToken().readAllBuff(Authorization);
        } else if (classCode.equals("NMS")) {
            subList = schema.getTableNmTokensDef().readAllBuff(Authorization);
        } else if (classCode.equals("TNTS")) {
            subList = schema.getTableTableNmTokens().readAllBuff(Authorization);
        } else if (classCode.equals("SNTS")) {
            subList = schema.getTableSchemaNmTokens().readAllBuff(Authorization);
        } else if (classCode.equals("STR")) {
            subList = schema.getTableStringDef().readAllBuff(Authorization);
        } else if (classCode.equals("TSTR")) {
            subList = schema.getTableTableString().readAllBuff(Authorization);
        } else if (classCode.equals("SSTR")) {
            subList = schema.getTableSchemaString().readAllBuff(Authorization);
        } else if (classCode.equals("ZDY")) {
            subList = schema.getTableTZDateDef().readAllBuff(Authorization);
        } else if (classCode.equals("TZDY")) {
            subList = schema.getTableTableTZDate().readAllBuff(Authorization);
        } else if (classCode.equals("SZDY")) {
            subList = schema.getTableSchemaTZDate().readAllBuff(Authorization);
        } else if (classCode.equals("ZTM")) {
            subList = schema.getTableTZTimeDef().readAllBuff(Authorization);
        } else if (classCode.equals("TZTM")) {
            subList = schema.getTableTableTZTime().readAllBuff(Authorization);
        } else if (classCode.equals("SZTM")) {
            subList = schema.getTableSchemaTZTime().readAllBuff(Authorization);
        } else if (classCode.equals("ZSP")) {
            subList = schema.getTableTZTimestampDef().readAllBuff(Authorization);
        } else if (classCode.equals("TZST")) {
            subList = schema.getTableTableTZTimestamp().readAllBuff(Authorization);
        } else if (classCode.equals("SZST")) {
            subList = schema.getTableSchemaTZTimestamp().readAllBuff(Authorization);
        } else if (classCode.equals("TXT")) {
            subList = schema.getTableTextDef().readAllBuff(Authorization);
        } else if (classCode.equals("TTXT")) {
            subList = schema.getTableTableText().readAllBuff(Authorization);
        } else if (classCode.equals("STXT")) {
            subList = schema.getTableSchemaText().readAllBuff(Authorization);
        } else if (classCode.equals("TIM")) {
            subList = schema.getTableTimeDef().readAllBuff(Authorization);
        } else if (classCode.equals("TTIM")) {
            subList = schema.getTableTableTime().readAllBuff(Authorization);
        } else if (classCode.equals("STIM")) {
            subList = schema.getTableSchemaTime().readAllBuff(Authorization);
        } else if (classCode.equals("TSP")) {
            subList = schema.getTableTimestampDef().readAllBuff(Authorization);
        } else if (classCode.equals("TTSM")) {
            subList = schema.getTableTableTimestamp().readAllBuff(Authorization);
        } else if (classCode.equals("STSM")) {
            subList = schema.getTableSchemaTimestamp().readAllBuff(Authorization);
        } else if (classCode.equals("TKN")) {
            subList = schema.getTableTokenDef().readAllBuff(Authorization);
        } else if (classCode.equals("TTOK")) {
            subList = schema.getTableTableToken().readAllBuff(Authorization);
        } else if (classCode.equals("STOK")) {
            subList = schema.getTableSchemaToken().readAllBuff(Authorization);
        } else if (classCode.equals("TBC")) {
            subList = schema.getTableTableCol().readAllBuff(Authorization);
        } else if (classCode.equals("LIC")) {
            subList = schema.getTableLicense().readAllBuff(Authorization);
        } else if (classCode.equals("CHN")) {
            subList = schema.getTableChain().readAllBuff(Authorization);
        } else if (classCode.equals("RLC")) {
            subList = schema.getTableRelationCol().readAllBuff(Authorization);
        } else if (classCode.equals("ETG")) {
            subList = schema.getTableEnumTag().readAllBuff(Authorization);
        } else if (classCode.equals("IXC")) {
            subList = schema.getTableIndexCol().readAllBuff(Authorization);
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "Did not expect ClassCode \"" + classCode + "\"");
        }
        for (int idxSubList = 0; idxSubList < subList.length; idxSubList++) {
            resultList.add(subList[idxSubList]);
        }
    }
    buffArray = resultList.toArray(new MSSBamAnyObjBuff[0]);
    return (buffArray);
}

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

public MSSBamBaseDomainBuff[] readBuffByAuthorIdx(MSSBamAuthorization Authorization, Long AuthorId) {
    final String S_ProcName = "readBuffByAuthorIdx";
    try {//from   w  w  w  .  j a v  a 2s. c o m
        Connection cnx = schema.getCnx();
        String sql = S_sqlSelectBaseDomainBuff + "WHERE " + ((AuthorId == null) ? "anyo.AuthorId is null "
                : "anyo.AuthorId = " + AuthorId.toString() + " ") + "ORDER BY " + "anyo.Id ASC";
        Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
        ResultSet resultSet = stmt.executeQuery(sql);
        List<MSSBamBaseDomainBuff> buffList = new ArrayList<MSSBamBaseDomainBuff>();
        while (resultSet.next()) {
            MSSBamBaseDomainBuff buff = unpackBaseDomainResultSetToBuff(resultSet);
            buffList.add(buff);
        }
        return (buffList.toArray(new MSSBamBaseDomainBuff[0]));
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    }
}

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

public MSSBamBoolDefBuff[] readDerivedByEAccSecIdx(MSSBamAuthorization Authorization,
        Short EditAccessSecurityId) {
    final String S_ProcName = "readDerivedByEAccSecIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from   www  .  j  a va2 s . c  om*/
    ArrayList<String> classCodeList = new ArrayList<String>();
    String classCode;
    try {
        Connection cnx = schema.getCnx();
        String sql = S_sqlSelectBoolDefDistinctClassCode + "WHERE "
                + ((EditAccessSecurityId == null) ? "val.EditAccessSecurityId is null "
                        : "val.EditAccessSecurityId = " + EditAccessSecurityId.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 = readBuffByEAccSecIdx(Authorization, EditAccessSecurityId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("TBLN")) {
            MSSBamTableBoolBuff[] subList = schema.getTableTableBool().readBuffByEAccSecIdx(Authorization,
                    EditAccessSecurityId);
            for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) {
                resultList.add(subList[subListIdx]);
            }
        } else if (classCode.equals("SBLN")) {
            MSSBamSchemaBoolBuff[] subList = schema.getTableSchemaBool().readBuffByEAccSecIdx(Authorization,
                    EditAccessSecurityId);
            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.MSSBamPg8AtomDefTable.java

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

From source file:org.openmrs.module.sync.api.db.hibernate.HibernateSyncDAO.java

public void importParentDB(InputStream in) {
    try {//ww w.jav  a2  s  .c  om
        Connection conn = sessionFactory.getCurrentSession().connection();
        Statement statement = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String line;
        StringBuffer query = new StringBuffer();
        boolean queryEnds = false;

        while ((line = reader.readLine()) != null) {
            if ((line.startsWith("#") || line.startsWith("--"))) {
                continue;
            }
            queryEnds = line.endsWith(";");
            query.append(line);
            if (queryEnds) {
                try {
                    statement.execute(query.toString());
                } catch (SQLException ex) {
                    log.warn(ex);
                    ex.printStackTrace();
                }
                query.setLength(0);
            }
        }
        in.close();

    } catch (IOException ex) {
        log.warn(ex);
        ex.printStackTrace();
    } catch (SQLException ex) {
        log.warn(ex);
        ex.printStackTrace();
    }
}

From source file:net.antidot.semantic.rdf.rdb2rdf.r2rml.core.R2RMLEngine.java

/**
 * Construct logical table. Note : Run SQL Query against database calling
 * the method Connection.commit can close the ResultSet objects that have
 * been created during the current transaction. In some cases, however, this
 * may not be the desired behavior. The ResultSet property holdability gives
 * the application control over whether ResultSet objects (cursors) are
 * closed when commit is called.//  w  w w.  j av  a  2s  .c om
 * 
 * @param triplesMap
 * @throws SQLException
 */
private ResultSet constructLogicalTable(TriplesMap triplesMap) throws SQLException {
    log.debug("[R2RMLEngine:constructLogicalTable] Run effective SQL Query : "
            + triplesMap.getLogicalTable().getEffectiveSQLQuery());
    ResultSet rs = null;
    java.sql.Statement s = conn.createStatement(ResultSet.HOLD_CURSORS_OVER_COMMIT, ResultSet.CONCUR_READ_ONLY);
    if (triplesMap.getLogicalTable().getEffectiveSQLQuery() != null) {

        s.executeQuery(triplesMap.getLogicalTable().getEffectiveSQLQuery());
        rs = s.getResultSet();
        if (rs == null)
            throw new IllegalStateException("[R2RMLEngine:constructLogicalTable] SQL request "
                    + "failed : result of effective SQL query is null.");

    } else {
        throw new IllegalStateException(
                "[R2RMLEngine:constructLogicalTable] No effective SQL query has been found.");
    }
    // Commit to held logical table (read-only)
    conn.setAutoCommit(false);
    conn.commit();
    return rs;
}