Example usage for java.sql CallableStatement setLong

List of usage examples for java.sql CallableStatement setLong

Introduction

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

Prototype

void setLong(String parameterName, long x) throws SQLException;

Source Link

Document

Sets the designated parameter to the given Java long value.

Usage

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

public CFAccTldBuff[] readBuffByTenantIdx(CFAccAuthorization Authorization, long TenantId) {
    final String S_ProcName = "readBuffByTenantIdx";
    ResultSet resultSet = null;// www. ja va  2s .c  o  m
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByTenantIdx = null;
    List<CFAccTldBuff> buffList = new LinkedList<CFAccTldBuff>();
    try {
        stmtReadBuffByTenantIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_tlddefbytenantidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByTenantIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByTenantIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByTenantIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByTenantIdx.setLong(argIdx++, TenantId);
        stmtReadBuffByTenantIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByTenantIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFAccTldBuff buff = unpackTldResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFAccTldBuff[] retBuff = new CFAccTldBuff[buffList.size()];
        Iterator<CFAccTldBuff> 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 (stmtReadBuffByTenantIdx != null) {
            try {
                stmtReadBuffByTenantIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByTenantIdx = null;
        }
    }
}

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

public CFAstTldBuff[] readBuffByTenantIdx(CFAstAuthorization Authorization, long TenantId) {
    final String S_ProcName = "readBuffByTenantIdx";
    ResultSet resultSet = null;/*from   w w  w .j  a v  a2  s  .c  o m*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByTenantIdx = null;
    List<CFAstTldBuff> buffList = new LinkedList<CFAstTldBuff>();
    try {
        stmtReadBuffByTenantIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_tlddefbytenantidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByTenantIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByTenantIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByTenantIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByTenantIdx.setLong(argIdx++, TenantId);
        stmtReadBuffByTenantIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByTenantIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFAstTldBuff buff = unpackTldResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        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 (stmtReadBuffByTenantIdx != null) {
            try {
                stmtReadBuffByTenantIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByTenantIdx = null;
        }
    }
}

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

public CFAstTldBuff[] readBuffByTenantIdx(CFAstAuthorization Authorization, long TenantId) {
    final String S_ProcName = "readBuffByTenantIdx";
    ResultSet resultSet = null;/*from w w  w .  j a v a  2  s. c o m*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByTenantIdx = null;
    List<CFAstTldBuff> buffList = new LinkedList<CFAstTldBuff>();
    try {
        stmtReadBuffByTenantIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_tlddefbytenantidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByTenantIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByTenantIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByTenantIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByTenantIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByTenantIdx.setLong(argIdx++, TenantId);
        stmtReadBuffByTenantIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByTenantIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFAstTldBuff buff = unpackTldResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        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 (stmtReadBuffByTenantIdx != null) {
            try {
                stmtReadBuffByTenantIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByTenantIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleEnHeadTable.java

public CFEnSyntaxEnHeadBuff[] readBuffByScopeIdx(CFEnSyntaxAuthorization Authorization, Long ScopeId) {
    final String S_ProcName = "readBuffByScopeIdx";
    ResultSet resultSet = null;/*from w  ww  .j a  v  a2 s  . c  o  m*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByScopeIdx = null;
    List<CFEnSyntaxEnHeadBuff> buffList = new LinkedList<CFEnSyntaxEnHeadBuff>();
    try {
        stmtReadBuffByScopeIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_enheadbyscopeidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByScopeIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByScopeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByScopeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (ScopeId != null) {
            stmtReadBuffByScopeIdx.setLong(argIdx++, ScopeId.longValue());
        } else {
            stmtReadBuffByScopeIdx.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtReadBuffByScopeIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByScopeIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFEnSyntaxEnHeadBuff buff = unpackEnHeadResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFEnSyntaxEnHeadBuff[] retBuff = new CFEnSyntaxEnHeadBuff[buffList.size()];
        Iterator<CFEnSyntaxEnHeadBuff> 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 (stmtReadBuffByScopeIdx != null) {
            try {
                stmtReadBuffByScopeIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByScopeIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleEnWordTable.java

public CFEnSyntaxEnWordBuff[] readBuffByScopeIdx(CFEnSyntaxAuthorization Authorization, Long ScopeId) {
    final String S_ProcName = "readBuffByScopeIdx";
    ResultSet resultSet = null;//from  w w  w.  ja v a2s . co  m
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByScopeIdx = null;
    List<CFEnSyntaxEnWordBuff> buffList = new LinkedList<CFEnSyntaxEnWordBuff>();
    try {
        stmtReadBuffByScopeIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_enwordbyscopeidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByScopeIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByScopeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByScopeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (ScopeId != null) {
            stmtReadBuffByScopeIdx.setLong(argIdx++, ScopeId.longValue());
        } else {
            stmtReadBuffByScopeIdx.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtReadBuffByScopeIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByScopeIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFEnSyntaxEnWordBuff buff = unpackEnWordResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFEnSyntaxEnWordBuff[] retBuff = new CFEnSyntaxEnWordBuff[buffList.size()];
        Iterator<CFEnSyntaxEnWordBuff> 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 (stmtReadBuffByScopeIdx != null) {
            try {
                stmtReadBuffByScopeIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByScopeIdx = null;
        }
    }
}

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

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

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

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

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

public long nextTSecGroupMemberIdGen(CFAstAuthorization Authorization, CFAstTenantPKey PKey) {
    final String S_ProcName = "nextTSecGroupMemberIdGen";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Not in a transaction");
    }//from  www .  j ava  2 s  . c  o m
    Connection cnx = schema.getCnx();
    long Id = PKey.getRequiredId();

    CallableStatement stmtSelectNextTSecGroupMemberIdGen = null;
    try {
        String sql = "{ call sp_next_tsecgroupmemberidgen( ?" + ", " + "?" + " ) }";
        stmtSelectNextTSecGroupMemberIdGen = cnx.prepareCall(sql);
        int argIdx = 1;
        stmtSelectNextTSecGroupMemberIdGen.registerOutParameter(argIdx++, java.sql.Types.BIGINT);
        stmtSelectNextTSecGroupMemberIdGen.setLong(argIdx++, Id);
        stmtSelectNextTSecGroupMemberIdGen.execute();
        long nextId = stmtSelectNextTSecGroupMemberIdGen.getLong(1);
        return (nextId);
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (stmtSelectNextTSecGroupMemberIdGen != null) {
            try {
                stmtSelectNextTSecGroupMemberIdGen.close();
            } catch (SQLException e) {
            }
            stmtSelectNextTSecGroupMemberIdGen = null;
        }
    }
}