Example usage for java.sql CallableStatement getObject

List of usage examples for java.sql CallableStatement getObject

Introduction

In this page you can find the example usage for java.sql CallableStatement getObject.

Prototype

Object getObject(String parameterName) throws SQLException;

Source Link

Document

Retrieves the value of a parameter as an Object in the Java programming language.

Usage

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleISOLanguageTable.java

public CFAccISOLanguageBuff readBuffByCodeIdx(CFAccAuthorization Authorization, String ISOCode) {
    final String S_ProcName = "readBuffByCodeIdx";
    ResultSet resultSet = null;//from  www  . j a va  2s. c om
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByCodeIdx = null;
    try {
        stmtReadBuffByCodeIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_iso_langbycodeidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByCodeIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByCodeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByCodeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByCodeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByCodeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByCodeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByCodeIdx.setString(argIdx++, ISOCode);
        stmtReadBuffByCodeIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByCodeIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFAccISOLanguageBuff buff = unpackISOLanguageResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByCodeIdx != null) {
            try {
                stmtReadBuffByCodeIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByCodeIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstOracle.CFAstOracleISOLanguageTable.java

public CFAstISOLanguageBuff readBuffByCodeIdx(CFAstAuthorization Authorization, String ISOCode) {
    final String S_ProcName = "readBuffByCodeIdx";
    ResultSet resultSet = null;/* ww w . j av  a2 s .com*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByCodeIdx = null;
    try {
        stmtReadBuffByCodeIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_iso_langbycodeidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByCodeIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByCodeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByCodeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByCodeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByCodeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByCodeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByCodeIdx.setString(argIdx++, ISOCode);
        stmtReadBuffByCodeIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByCodeIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFAstISOLanguageBuff buff = unpackISOLanguageResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByCodeIdx != null) {
            try {
                stmtReadBuffByCodeIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByCodeIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstOracle.CFAstOracleISOLanguageTable.java

public CFAstISOLanguageBuff readBuffByCodeIdx(CFAstAuthorization Authorization, String ISOCode) {
    final String S_ProcName = "readBuffByCodeIdx";
    ResultSet resultSet = null;//from  w w  w .  jav  a  2s.c  om
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByCodeIdx = null;
    try {
        stmtReadBuffByCodeIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_iso_langbycodeidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByCodeIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByCodeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByCodeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByCodeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByCodeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByCodeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByCodeIdx.setString(argIdx++, ISOCode);
        stmtReadBuffByCodeIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByCodeIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFAstISOLanguageBuff buff = unpackISOLanguageResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByCodeIdx != null) {
            try {
                stmtReadBuffByCodeIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByCodeIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstOracle.CFAstOracleSecUserTable.java

public CFAstSecUserBuff lockBuff(CFAstAuthorization Authorization, CFAstSecUserPKey PKey) {
    final String S_ProcName = "lockBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from   www.  j a  v a  2 s. c om*/
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtLockBuffByPKey = null;
    try {
        UUID SecUserId = PKey.getRequiredSecUserId();

        stmtLockBuffByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".lck_secuser( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtLockBuffByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtLockBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtLockBuffByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtLockBuffByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtLockBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtLockBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtLockBuffByPKey.setString(argIdx++, SecUserId.toString());
        stmtLockBuffByPKey.execute();
        resultSet = (ResultSet) stmtLockBuffByPKey.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFAstSecUserBuff buff = unpackSecUserResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtLockBuffByPKey != null) {
            try {
                stmtLockBuffByPKey.close();
            } catch (SQLException e) {
            }
            stmtLockBuffByPKey = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswOracle.CFFswOracleISOLanguageTable.java

public CFFswISOLanguageBuff readBuffByCodeIdx(CFFswAuthorization Authorization, String ISOCode) {
    final String S_ProcName = "readBuffByCodeIdx";
    ResultSet resultSet = null;/*from  w ww. j a v a  2s  .  c o  m*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByCodeIdx = null;
    try {
        stmtReadBuffByCodeIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_iso_langbycodeidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByCodeIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByCodeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByCodeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByCodeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByCodeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByCodeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByCodeIdx.setString(argIdx++, ISOCode);
        stmtReadBuffByCodeIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByCodeIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFFswISOLanguageBuff buff = unpackISOLanguageResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByCodeIdx != null) {
            try {
                stmtReadBuffByCodeIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByCodeIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleISOLanguageTable.java

public CFAccISOLanguageBuff[] readAllBuff(CFAccAuthorization Authorization) {
    final String S_ProcName = "readAllBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from ww w .  j  a v  a 2 s.c  o  m*/
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadAllBuff = null;
    try {
        CFAccISOLanguageBuff buff = null;
        List<CFAccISOLanguageBuff> buffList = new LinkedList<CFAccISOLanguageBuff>();
        stmtReadAllBuff = cnx.prepareCall(
                "begin " + schema.getLowerSchemaDbName() + ".rd_iso_langall( ?, ?, ?, ?, ?, ? ) ); end;");
        int argIdx = 1;
        stmtReadAllBuff.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadAllBuff.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadAllBuff.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadAllBuff.execute();
        resultSet = (ResultSet) stmtReadAllBuff.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    buff = unpackISOLanguageResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
            } catch (SQLException e) {
                // Oracle may return an invalid resultSet if the rowset is empty
            }
        }
        int idx = 0;
        CFAccISOLanguageBuff[] retBuff = new CFAccISOLanguageBuff[buffList.size()];
        Iterator<CFAccISOLanguageBuff> iter = buffList.iterator();
        while (iter.hasNext()) {
            retBuff[idx++] = iter.next();
        }
        return (retBuff);
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadAllBuff != null) {
            try {
                stmtReadAllBuff.close();
            } catch (SQLException e) {
            }
            stmtReadAllBuff = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstOracle.CFAstOracleISOLanguageTable.java

public CFAstISOLanguageBuff[] readAllBuff(CFAstAuthorization Authorization) {
    final String S_ProcName = "readAllBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//from   w w w .j  av a 2s .c o m
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadAllBuff = null;
    try {
        CFAstISOLanguageBuff buff = null;
        List<CFAstISOLanguageBuff> buffList = new LinkedList<CFAstISOLanguageBuff>();
        stmtReadAllBuff = cnx.prepareCall(
                "begin " + schema.getLowerSchemaDbName() + ".rd_iso_langall( ?, ?, ?, ?, ?, ? ) ); end;");
        int argIdx = 1;
        stmtReadAllBuff.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadAllBuff.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadAllBuff.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadAllBuff.execute();
        resultSet = (ResultSet) stmtReadAllBuff.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    buff = unpackISOLanguageResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
            } catch (SQLException e) {
                // Oracle may return an invalid resultSet if the rowset is empty
            }
        }
        int idx = 0;
        CFAstISOLanguageBuff[] retBuff = new CFAstISOLanguageBuff[buffList.size()];
        Iterator<CFAstISOLanguageBuff> iter = buffList.iterator();
        while (iter.hasNext()) {
            retBuff[idx++] = iter.next();
        }
        return (retBuff);
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadAllBuff != null) {
            try {
                stmtReadAllBuff.close();
            } catch (SQLException e) {
            }
            stmtReadAllBuff = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstOracle.CFAstOracleISOLanguageTable.java

public CFAstISOLanguageBuff[] readAllBuff(CFAstAuthorization Authorization) {
    final String S_ProcName = "readAllBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*ww  w . ja  v  a 2 s  .c o  m*/
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadAllBuff = null;
    try {
        CFAstISOLanguageBuff buff = null;
        List<CFAstISOLanguageBuff> buffList = new LinkedList<CFAstISOLanguageBuff>();
        stmtReadAllBuff = cnx.prepareCall(
                "begin " + schema.getLowerDbSchemaName() + ".rd_iso_langall( ?, ?, ?, ?, ?, ? ) ); end;");
        int argIdx = 1;
        stmtReadAllBuff.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadAllBuff.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadAllBuff.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadAllBuff.execute();
        resultSet = (ResultSet) stmtReadAllBuff.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    buff = unpackISOLanguageResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
            } catch (SQLException e) {
                // Oracle may return an invalid resultSet if the rowset is empty
            }
        }
        int idx = 0;
        CFAstISOLanguageBuff[] retBuff = new CFAstISOLanguageBuff[buffList.size()];
        Iterator<CFAstISOLanguageBuff> iter = buffList.iterator();
        while (iter.hasNext()) {
            retBuff[idx++] = iter.next();
        }
        return (retBuff);
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadAllBuff != null) {
            try {
                stmtReadAllBuff.close();
            } catch (SQLException e) {
            }
            stmtReadAllBuff = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswOracle.CFFswOracleISOLanguageTable.java

public CFFswISOLanguageBuff[] readAllBuff(CFFswAuthorization Authorization) {
    final String S_ProcName = "readAllBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }// ww  w.  j  a  v a 2  s.c o m
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadAllBuff = null;
    try {
        CFFswISOLanguageBuff buff = null;
        List<CFFswISOLanguageBuff> buffList = new LinkedList<CFFswISOLanguageBuff>();
        stmtReadAllBuff = cnx.prepareCall(
                "begin " + schema.getLowerDbSchemaName() + ".rd_iso_langall( ?, ?, ?, ?, ?, ? ) ); end;");
        int argIdx = 1;
        stmtReadAllBuff.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadAllBuff.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadAllBuff.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadAllBuff.execute();
        resultSet = (ResultSet) stmtReadAllBuff.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    buff = unpackISOLanguageResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
            } catch (SQLException e) {
                // Oracle may return an invalid resultSet if the rowset is empty
            }
        }
        int idx = 0;
        CFFswISOLanguageBuff[] retBuff = new CFFswISOLanguageBuff[buffList.size()];
        Iterator<CFFswISOLanguageBuff> iter = buffList.iterator();
        while (iter.hasNext()) {
            retBuff[idx++] = iter.next();
        }
        return (retBuff);
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadAllBuff != null) {
            try {
                stmtReadAllBuff.close();
            } catch (SQLException e) {
            }
            stmtReadAllBuff = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleISOTimezoneTable.java

public CFAccISOTimezoneBuff readBuffByIdIdx(CFAccAuthorization Authorization, short ISOTimezoneId) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;/*  w w  w  . j av  a  2s.com*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByIdIdx = null;
    try {
        stmtReadBuffByIdIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_isotzbyididx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByIdIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByIdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByIdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByIdIdx.setShort(argIdx++, ISOTimezoneId);
        stmtReadBuffByIdIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByIdIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFAccISOTimezoneBuff buff = unpackISOTimezoneResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByIdIdx != null) {
            try {
                stmtReadBuffByIdIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByIdIdx = null;
        }
    }
}