Example usage for java.sql CallableStatement setInt

List of usage examples for java.sql CallableStatement setInt

Introduction

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

Prototype

void setInt(String parameterName, int x) throws SQLException;

Source Link

Document

Sets the designated parameter to the given Java int value.

Usage

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

public void createSecForm(CFFswAuthorization Authorization, CFFswSecFormBuff Buff) {
    final String S_ProcName = "createSecForm";
    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;
    CallableStatement stmtCreateByPKey = null;
    try {
        long ClusterId = Buff.getRequiredClusterId();
        int SecAppId = Buff.getRequiredSecAppId();
        String JEEServletMapName = Buff.getRequiredJEEServletMapName();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".crt_secform( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtCreateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtCreateByPKey.setString(argIdx++, "SFRM");
        stmtCreateByPKey.setLong(argIdx++, ClusterId);
        stmtCreateByPKey.setInt(argIdx++, SecAppId);
        stmtCreateByPKey.setString(argIdx++, JEEServletMapName);
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_secform() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFFswSecFormBuff createdBuff = unpackSecFormResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                Buff.setRequiredClusterId(createdBuff.getRequiredClusterId());
                Buff.setRequiredSecFormId(createdBuff.getRequiredSecFormId());
                Buff.setRequiredSecAppId(createdBuff.getRequiredSecAppId());
                Buff.setRequiredJEEServletMapName(createdBuff.getRequiredJEEServletMapName());
                Buff.setRequiredRevision(createdBuff.getRequiredRevision());
                Buff.setCreatedByUserId(createdBuff.getCreatedByUserId());
                Buff.setCreatedAt(createdBuff.getCreatedAt());
                Buff.setUpdatedByUserId(createdBuff.getUpdatedByUserId());
                Buff.setUpdatedAt(createdBuff.getUpdatedAt());
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Expected a single-record response, " + resultSet.getRow() + " rows selected");
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_secform() did not return a valid result set");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtCreateByPKey != null) {
            try {
                stmtCreateByPKey.close();
            } catch (SQLException e) {
            }
            stmtCreateByPKey = null;
        }
    }
}

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

public void deleteCluster(CFAstAuthorization Authorization, CFAstClusterBuff Buff) {
    final String S_ProcName = "deleteCluster";
    Connection cnx = schema.getCnx();
    CallableStatement stmtDeleteByPKey = null;
    try {/*from   ww  w  .  jav a2s. c  o  m*/
        long Id = Buff.getRequiredId();
        stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".dl_clus( ?, ?, ?, ?, ?"
                + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByPKey.setLong(argIdx++, Id);
        stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision());
        ;
        stmtDeleteByPKey.execute();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (stmtDeleteByPKey != null) {
            try {
                stmtDeleteByPKey.close();
            } catch (SQLException e) {
            }
            stmtDeleteByPKey = null;
        }
    }
}

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

public void updateISOCountry(CFSecurityAuthorization Authorization, CFSecurityISOCountryBuff Buff) {
    final String S_ProcName = "updateISOCountry";
    ResultSet resultSet = null;//from w w  w .  jav a  2s  .  c  o  m
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFSecurityISOCountryBuff> buffList = new LinkedList<CFSecurityISOCountryBuff>();
    try {
        short Id = Buff.getRequiredId();
        String ISOCode = Buff.getRequiredISOCode();
        String Name = Buff.getRequiredName();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx
                .prepareCall("begin " + schema.getLowerDbSchemaName() + ".upd_iso_cntry( ?, ?, ?, ?, ?, ?, ?"
                        + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); end;");
        int argIdx = 1;
        stmtUpdateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtUpdateByPKey.setString(argIdx++, "ISOC");
        stmtUpdateByPKey.setShort(argIdx++, Id);
        stmtUpdateByPKey.setString(argIdx++, ISOCode);
        stmtUpdateByPKey.setString(argIdx++, Name);
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
        if (resultSet != null) {
            try {
                if (resultSet.next()) {
                    CFSecurityISOCountryBuff updatedBuff = unpackISOCountryResultSetToBuff(resultSet);
                    if (resultSet.next()) {
                        resultSet.last();
                        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                                "Did not expect multi-record response, " + resultSet.getRow()
                                        + " rows selected");
                    }
                    Buff.setRequiredISOCode(updatedBuff.getRequiredISOCode());
                    Buff.setRequiredName(updatedBuff.getRequiredName());
                    Buff.setRequiredRevision(updatedBuff.getRequiredRevision());
                } else {
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Expected a single-record response, " + resultSet.getRow() + " rows selected");
                }
            } catch (SQLException e) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "upd_iso_cntry() did not return a valid result cursor");
            } finally {
                if (resultSet != null) {
                    try {
                        resultSet.close();
                    } catch (SQLException e) {
                    }
                    resultSet = null;
                }
            }
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "upd_iso_cntry() did not return a result cursor");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtUpdateByPKey != null) {
            try {
                stmtUpdateByPKey.close();
            } catch (SQLException e) {
            }
            stmtUpdateByPKey = null;
        }
    }
}

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

public void updateTld(CFSecurityAuthorization Authorization, CFInternetTldBuff Buff) {
    final String S_ProcName = "updateTld";
    ResultSet resultSet = null;//from  w w  w  .j a va  2  s  . co  m
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFInternetTldBuff> buffList = new LinkedList<CFInternetTldBuff>();
    try {
        long TenantId = Buff.getRequiredTenantId();
        long TldId = Buff.getRequiredTldId();
        String Name = Buff.getRequiredName();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx
                .prepareCall("begin " + schema.getLowerDbSchemaName() + ".upd_tlddef( ?, ?, ?, ?, ?, ?, ?"
                        + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); end;");
        int argIdx = 1;
        stmtUpdateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtUpdateByPKey.setString(argIdx++, "GTld");
        stmtUpdateByPKey.setLong(argIdx++, TenantId);
        stmtUpdateByPKey.setLong(argIdx++, TldId);
        stmtUpdateByPKey.setString(argIdx++, Name);
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
        if (resultSet != null) {
            try {
                if (resultSet.next()) {
                    CFInternetTldBuff updatedBuff = unpackTldResultSetToBuff(resultSet);
                    if (resultSet.next()) {
                        resultSet.last();
                        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                                "Did not expect multi-record response, " + resultSet.getRow()
                                        + " rows selected");
                    }
                    Buff.setRequiredName(updatedBuff.getRequiredName());
                    Buff.setRequiredRevision(updatedBuff.getRequiredRevision());
                } else {
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Expected a single-record response, " + resultSet.getRow() + " rows selected");
                }
            } catch (SQLException e) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "upd_tlddef() did not return a valid result cursor");
            } finally {
                if (resultSet != null) {
                    try {
                        resultSet.close();
                    } catch (SQLException e) {
                    }
                    resultSet = null;
                }
            }
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "upd_tlddef() did not return a result cursor");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtUpdateByPKey != null) {
            try {
                stmtUpdateByPKey.close();
            } catch (SQLException e) {
            }
            stmtUpdateByPKey = null;
        }
    }
}

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

public void updateISOCountry(CFAccAuthorization Authorization, CFAccISOCountryBuff Buff) {
    final String S_ProcName = "updateISOCountry";
    ResultSet resultSet = null;//from   www.  j ava  2 s  . c  o m
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFAccISOCountryBuff> buffList = new LinkedList<CFAccISOCountryBuff>();
    try {
        short Id = Buff.getRequiredId();
        String ISOCode = Buff.getRequiredISOCode();
        String Name = Buff.getRequiredName();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx
                .prepareCall("begin " + schema.getLowerSchemaDbName() + ".upd_iso_cntry( ?, ?, ?, ?, ?, ?, ?"
                        + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); end;");
        int argIdx = 1;
        stmtUpdateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtUpdateByPKey.setString(argIdx++, "ISOC");
        stmtUpdateByPKey.setShort(argIdx++, Id);
        stmtUpdateByPKey.setString(argIdx++, ISOCode);
        stmtUpdateByPKey.setString(argIdx++, Name);
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
        if (resultSet != null) {
            try {
                if (resultSet.next()) {
                    CFAccISOCountryBuff updatedBuff = unpackISOCountryResultSetToBuff(resultSet);
                    if (resultSet.next()) {
                        resultSet.last();
                        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                                "Did not expect multi-record response, " + resultSet.getRow()
                                        + " rows selected");
                    }
                    Buff.setRequiredISOCode(updatedBuff.getRequiredISOCode());
                    Buff.setRequiredName(updatedBuff.getRequiredName());
                    Buff.setRequiredRevision(updatedBuff.getRequiredRevision());
                } else {
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Expected a single-record response, " + resultSet.getRow() + " rows selected");
                }
            } catch (SQLException e) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "upd_iso_cntry() did not return a valid result cursor");
            } finally {
                if (resultSet != null) {
                    try {
                        resultSet.close();
                    } catch (SQLException e) {
                    }
                    resultSet = null;
                }
            }
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "upd_iso_cntry() did not return a result cursor");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtUpdateByPKey != null) {
            try {
                stmtUpdateByPKey.close();
            } catch (SQLException e) {
            }
            stmtUpdateByPKey = null;
        }
    }
}

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

public CFAccServiceBuff[] readBuffByTypeIdx(CFAccAuthorization Authorization, int ServiceTypeId) {
    final String S_ProcName = "readBuffByTypeIdx";
    ResultSet resultSet = null;//from w w w. j av a 2 s .  c o m
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByTypeIdx = null;
    List<CFAccServiceBuff> buffList = new LinkedList<CFAccServiceBuff>();
    try {
        stmtReadBuffByTypeIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_hostsvcbytypeidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByTypeIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByTypeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByTypeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByTypeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByTypeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByTypeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByTypeIdx.setInt(argIdx++, ServiceTypeId);
        stmtReadBuffByTypeIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByTypeIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFAccServiceBuff buff = unpackServiceResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFAccServiceBuff[] retBuff = new CFAccServiceBuff[buffList.size()];
        Iterator<CFAccServiceBuff> 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 (stmtReadBuffByTypeIdx != null) {
            try {
                stmtReadBuffByTypeIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByTypeIdx = null;
        }
    }
}

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

public void updateISOCountry(CFAstAuthorization Authorization, CFAstISOCountryBuff Buff) {
    final String S_ProcName = "updateISOCountry";
    ResultSet resultSet = null;/*from  w  w  w .  ja  v  a2  s.c  om*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFAstISOCountryBuff> buffList = new LinkedList<CFAstISOCountryBuff>();
    try {
        short Id = Buff.getRequiredId();
        String ISOCode = Buff.getRequiredISOCode();
        String Name = Buff.getRequiredName();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx
                .prepareCall("begin " + schema.getLowerSchemaDbName() + ".upd_iso_cntry( ?, ?, ?, ?, ?, ?, ?"
                        + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); end;");
        int argIdx = 1;
        stmtUpdateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtUpdateByPKey.setString(argIdx++, "ISOC");
        stmtUpdateByPKey.setShort(argIdx++, Id);
        stmtUpdateByPKey.setString(argIdx++, ISOCode);
        stmtUpdateByPKey.setString(argIdx++, Name);
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
        if (resultSet != null) {
            try {
                if (resultSet.next()) {
                    CFAstISOCountryBuff updatedBuff = unpackISOCountryResultSetToBuff(resultSet);
                    if (resultSet.next()) {
                        resultSet.last();
                        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                                "Did not expect multi-record response, " + resultSet.getRow()
                                        + " rows selected");
                    }
                    Buff.setRequiredISOCode(updatedBuff.getRequiredISOCode());
                    Buff.setRequiredName(updatedBuff.getRequiredName());
                    Buff.setRequiredRevision(updatedBuff.getRequiredRevision());
                } else {
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Expected a single-record response, " + resultSet.getRow() + " rows selected");
                }
            } catch (SQLException e) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "upd_iso_cntry() did not return a valid result cursor");
            } finally {
                if (resultSet != null) {
                    try {
                        resultSet.close();
                    } catch (SQLException e) {
                    }
                    resultSet = null;
                }
            }
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "upd_iso_cntry() did not return a result cursor");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtUpdateByPKey != null) {
            try {
                stmtUpdateByPKey.close();
            } catch (SQLException e) {
            }
            stmtUpdateByPKey = null;
        }
    }
}

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

public CFAstServiceBuff[] readBuffByTypeIdx(CFAstAuthorization Authorization, int ServiceTypeId) {
    final String S_ProcName = "readBuffByTypeIdx";
    ResultSet resultSet = null;/*from   w ww . java  2  s.c o  m*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByTypeIdx = null;
    List<CFAstServiceBuff> buffList = new LinkedList<CFAstServiceBuff>();
    try {
        stmtReadBuffByTypeIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_hostsvcbytypeidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByTypeIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByTypeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByTypeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByTypeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByTypeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByTypeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByTypeIdx.setInt(argIdx++, ServiceTypeId);
        stmtReadBuffByTypeIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByTypeIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFAstServiceBuff buff = unpackServiceResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFAstServiceBuff[] retBuff = new CFAstServiceBuff[buffList.size()];
        Iterator<CFAstServiceBuff> 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 (stmtReadBuffByTypeIdx != null) {
            try {
                stmtReadBuffByTypeIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByTypeIdx = null;
        }
    }
}

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

public void updateISOCountry(CFAstAuthorization Authorization, CFAstISOCountryBuff Buff) {
    final String S_ProcName = "updateISOCountry";
    ResultSet resultSet = null;//  w  w w . j  av  a  2 s .  c  o  m
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFAstISOCountryBuff> buffList = new LinkedList<CFAstISOCountryBuff>();
    try {
        short Id = Buff.getRequiredId();
        String ISOCode = Buff.getRequiredISOCode();
        String Name = Buff.getRequiredName();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx
                .prepareCall("begin " + schema.getLowerDbSchemaName() + ".upd_iso_cntry( ?, ?, ?, ?, ?, ?, ?"
                        + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); end;");
        int argIdx = 1;
        stmtUpdateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtUpdateByPKey.setString(argIdx++, "ISOC");
        stmtUpdateByPKey.setShort(argIdx++, Id);
        stmtUpdateByPKey.setString(argIdx++, ISOCode);
        stmtUpdateByPKey.setString(argIdx++, Name);
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
        if (resultSet != null) {
            try {
                if (resultSet.next()) {
                    CFAstISOCountryBuff updatedBuff = unpackISOCountryResultSetToBuff(resultSet);
                    if (resultSet.next()) {
                        resultSet.last();
                        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                                "Did not expect multi-record response, " + resultSet.getRow()
                                        + " rows selected");
                    }
                    Buff.setRequiredISOCode(updatedBuff.getRequiredISOCode());
                    Buff.setRequiredName(updatedBuff.getRequiredName());
                    Buff.setRequiredRevision(updatedBuff.getRequiredRevision());
                } else {
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Expected a single-record response, " + resultSet.getRow() + " rows selected");
                }
            } catch (SQLException e) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "upd_iso_cntry() did not return a valid result cursor");
            } finally {
                if (resultSet != null) {
                    try {
                        resultSet.close();
                    } catch (SQLException e) {
                    }
                    resultSet = null;
                }
            }
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "upd_iso_cntry() did not return a result cursor");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtUpdateByPKey != null) {
            try {
                stmtUpdateByPKey.close();
            } catch (SQLException e) {
            }
            stmtUpdateByPKey = null;
        }
    }
}

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

public CFAstServiceBuff[] readBuffByTypeIdx(CFAstAuthorization Authorization, int ServiceTypeId) {
    final String S_ProcName = "readBuffByTypeIdx";
    ResultSet resultSet = null;/*  w w w . j av  a2  s .c  o  m*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByTypeIdx = null;
    List<CFAstServiceBuff> buffList = new LinkedList<CFAstServiceBuff>();
    try {
        stmtReadBuffByTypeIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_hostsvcbytypeidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByTypeIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByTypeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByTypeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByTypeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByTypeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByTypeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByTypeIdx.setInt(argIdx++, ServiceTypeId);
        stmtReadBuffByTypeIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByTypeIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFAstServiceBuff buff = unpackServiceResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFAstServiceBuff[] retBuff = new CFAstServiceBuff[buffList.size()];
        Iterator<CFAstServiceBuff> 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 (stmtReadBuffByTypeIdx != null) {
            try {
                stmtReadBuffByTypeIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByTypeIdx = null;
        }
    }
}