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.cfasterisk.v2_0.CFAstOracle.CFAstOracleTldTable.java

public CFAstTldBuff[] readAllBuff(CFAstAuthorization Authorization) {
    final String S_ProcName = "readAllBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*  w  w  w .  j  a va 2  s  .  com*/
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadAllBuff = null;
    try {
        CFAstTldBuff buff = null;
        List<CFAstTldBuff> buffList = new LinkedList<CFAstTldBuff>();
        stmtReadAllBuff = cnx.prepareCall(
                "begin " + schema.getLowerSchemaDbName() + ".rd_tlddefall( ?, ?, ?, ?, ?, ? ) ); 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 = unpackTldResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
            } catch (SQLException e) {
                // Oracle may return an invalid resultSet if the rowset is empty
            }
        }
        int idx = 0;
        CFAstTldBuff[] retBuff = new CFAstTldBuff[buffList.size()];
        Iterator<CFAstTldBuff> 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.CFAstOracleTldTable.java

public CFAstTldBuff[] readAllBuff(CFAstAuthorization Authorization) {
    final String S_ProcName = "readAllBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//w  w  w .  j  a  v a  2 s  . co m
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadAllBuff = null;
    try {
        CFAstTldBuff buff = null;
        List<CFAstTldBuff> buffList = new LinkedList<CFAstTldBuff>();
        stmtReadAllBuff = cnx.prepareCall(
                "begin " + schema.getLowerDbSchemaName() + ".rd_tlddefall( ?, ?, ?, ?, ?, ? ) ); 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 = unpackTldResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
            } catch (SQLException e) {
                // Oracle may return an invalid resultSet if the rowset is empty
            }
        }
        int idx = 0;
        CFAstTldBuff[] retBuff = new CFAstTldBuff[buffList.size()];
        Iterator<CFAstTldBuff> 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_4.CFAsteriskOracle.CFAsteriskOracleTldTable.java

public CFInternetTldBuff[] readAllBuff(CFSecurityAuthorization Authorization) {
    final String S_ProcName = "readAllBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }// w  w  w  .j a v a2 s .c o m
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadAllBuff = null;
    try {
        CFInternetTldBuff buff = null;
        List<CFInternetTldBuff> buffList = new LinkedList<CFInternetTldBuff>();
        stmtReadAllBuff = cnx.prepareCall(
                "begin " + schema.getLowerDbSchemaName() + ".rd_tlddefall( ?, ?, ?, ?, ?, ? ) ); 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 = unpackTldResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
            } catch (SQLException e) {
                // Oracle may return an invalid resultSet if the rowset is empty
            }
        }
        int idx = 0;
        CFInternetTldBuff[] retBuff = new CFInternetTldBuff[buffList.size()];
        Iterator<CFInternetTldBuff> 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.CFAstOracleSecDeviceTable.java

public CFAstSecDeviceBuff[] readBuffByUserIdx(CFAstAuthorization Authorization, UUID SecUserId) {
    final String S_ProcName = "readBuffByUserIdx";
    ResultSet resultSet = null;/*from w  w  w.  jav a  2 s .com*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByUserIdx = null;
    List<CFAstSecDeviceBuff> buffList = new LinkedList<CFAstSecDeviceBuff>();
    try {
        stmtReadBuffByUserIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_secdevbyuseridx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByUserIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByUserIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUserIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByUserIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByUserIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUserIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByUserIdx.setString(argIdx++, SecUserId.toString());
        stmtReadBuffByUserIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByUserIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFAstSecDeviceBuff buff = unpackSecDeviceResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFAstSecDeviceBuff[] retBuff = new CFAstSecDeviceBuff[buffList.size()];
        Iterator<CFAstSecDeviceBuff> 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 (stmtReadBuffByUserIdx != null) {
            try {
                stmtReadBuffByUserIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByUserIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskOracle.CFAsteriskOracleISOCountryTable.java

public CFSecurityISOCountryBuff readBuff(CFSecurityAuthorization Authorization, CFSecurityISOCountryPKey PKey) {
    final String S_ProcName = "readBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//from  ww w  .j a  va2  s .  c o  m
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByPKey = null;
    try {
        short Id = PKey.getRequiredId();

        stmtReadBuffByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_iso_cntry( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByPKey.setShort(argIdx++, Id);
        stmtReadBuffByPKey.execute();
        resultSet = (ResultSet) stmtReadBuffByPKey.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFSecurityISOCountryBuff buff = unpackISOCountryResultSetToBuff(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 (stmtReadBuffByPKey != null) {
            try {
                stmtReadBuffByPKey.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByPKey = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskOracle.CFAsteriskOracleSecDeviceTable.java

public CFSecuritySecDeviceBuff[] readBuffByUserIdx(CFSecurityAuthorization Authorization, UUID SecUserId) {
    final String S_ProcName = "readBuffByUserIdx";
    ResultSet resultSet = null;//  ww w . ja  v  a  2 s . c  o  m
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByUserIdx = null;
    List<CFSecuritySecDeviceBuff> buffList = new LinkedList<CFSecuritySecDeviceBuff>();
    try {
        stmtReadBuffByUserIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_secdevbyuseridx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByUserIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByUserIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUserIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByUserIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByUserIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUserIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByUserIdx.setString(argIdx++, SecUserId.toString());
        stmtReadBuffByUserIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByUserIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFSecuritySecDeviceBuff buff = unpackSecDeviceResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFSecuritySecDeviceBuff[] retBuff = new CFSecuritySecDeviceBuff[buffList.size()];
        Iterator<CFSecuritySecDeviceBuff> 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 (stmtReadBuffByUserIdx != null) {
            try {
                stmtReadBuffByUserIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByUserIdx = null;
        }
    }
}

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

public CFFswSecDeviceBuff[] readBuffByUserIdx(CFFswAuthorization Authorization, UUID SecUserId) {
    final String S_ProcName = "readBuffByUserIdx";
    ResultSet resultSet = null;//from  w ww.  ja va  2 s .co  m
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByUserIdx = null;
    List<CFFswSecDeviceBuff> buffList = new LinkedList<CFFswSecDeviceBuff>();
    try {
        stmtReadBuffByUserIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_secdevbyuseridx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByUserIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByUserIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUserIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByUserIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByUserIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUserIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByUserIdx.setString(argIdx++, SecUserId.toString());
        stmtReadBuffByUserIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByUserIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFFswSecDeviceBuff buff = unpackSecDeviceResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFFswSecDeviceBuff[] retBuff = new CFFswSecDeviceBuff[buffList.size()];
        Iterator<CFFswSecDeviceBuff> 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 (stmtReadBuffByUserIdx != null) {
            try {
                stmtReadBuffByUserIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByUserIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskOracle.CFAsteriskOracleISOCountryTable.java

public CFSecurityISOCountryBuff lockBuff(CFSecurityAuthorization Authorization, CFSecurityISOCountryPKey PKey) {
    final String S_ProcName = "lockBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//from   w w  w .  ja  v  a 2s. c  o m
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtLockBuffByPKey = null;
    try {
        short Id = PKey.getRequiredId();

        stmtLockBuffByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".lck_iso_cntry( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); 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.setShort(argIdx++, Id);
        stmtLockBuffByPKey.execute();
        resultSet = (ResultSet) stmtLockBuffByPKey.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFSecurityISOCountryBuff buff = unpackISOCountryResultSetToBuff(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.cfacc.v2_0.CFAccOracle.CFAccOracleISOCountryTable.java

public CFAccISOCountryBuff readBuffByNameIdx(CFAccAuthorization Authorization, String Name) {
    final String S_ProcName = "readBuffByNameIdx";
    ResultSet resultSet = null;//  w  w w . j  av  a2 s. co  m
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByNameIdx = null;
    try {
        stmtReadBuffByNameIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_iso_cntrybynameidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByNameIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByNameIdx.setString(argIdx++, Name);
        stmtReadBuffByNameIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByNameIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFAccISOCountryBuff buff = unpackISOCountryResultSetToBuff(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 (stmtReadBuffByNameIdx != null) {
            try {
                stmtReadBuffByNameIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByNameIdx = null;
        }
    }
}

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

public CFAstISOCountryBuff readBuffByNameIdx(CFAstAuthorization Authorization, String Name) {
    final String S_ProcName = "readBuffByNameIdx";
    ResultSet resultSet = null;/*from   ww  w.j av a  2  s .c  om*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByNameIdx = null;
    try {
        stmtReadBuffByNameIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_iso_cntrybynameidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByNameIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByNameIdx.setString(argIdx++, Name);
        stmtReadBuffByNameIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByNameIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFAstISOCountryBuff buff = unpackISOCountryResultSetToBuff(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 (stmtReadBuffByNameIdx != null) {
            try {
                stmtReadBuffByNameIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByNameIdx = null;
        }
    }
}