Example usage for java.sql CallableStatement setShort

List of usage examples for java.sql CallableStatement setShort

Introduction

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

Prototype

void setShort(String parameterName, short x) throws SQLException;

Source Link

Document

Sets the designated parameter to the given Java short value.

Usage

From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetOracle.CFInternetOracleISOTimezoneTable.java

public void updateISOTimezone(CFInternetAuthorization Authorization, CFInternetISOTimezoneBuff Buff) {
    final String S_ProcName = "updateISOTimezone";
    ResultSet resultSet = null;//from w  w  w . ja  v  a 2s  .co m
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFInternetISOTimezoneBuff> buffList = new LinkedList<CFInternetISOTimezoneBuff>();
    try {
        short ISOTimezoneId = Buff.getRequiredISOTimezoneId();
        String Iso8601 = Buff.getRequiredIso8601();
        String TZName = Buff.getRequiredTZName();
        short TZHourOffset = Buff.getRequiredTZHourOffset();
        short TZMinOffset = Buff.getRequiredTZMinOffset();
        String Description = Buff.getRequiredDescription();
        boolean Visible = Buff.getRequiredVisible();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".upd_isotz( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                + "?" + ", " + "?" + ", " + "?" + ", " + "? ); 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++, "ITZN");
        stmtUpdateByPKey.setShort(argIdx++, ISOTimezoneId);
        stmtUpdateByPKey.setString(argIdx++, Iso8601);
        stmtUpdateByPKey.setString(argIdx++, TZName);
        stmtUpdateByPKey.setShort(argIdx++, TZHourOffset);
        stmtUpdateByPKey.setShort(argIdx++, TZMinOffset);
        stmtUpdateByPKey.setString(argIdx++, Description);
        if (Visible) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
        if (resultSet != null) {
            try {
                if (resultSet.next()) {
                    CFInternetISOTimezoneBuff updatedBuff = unpackISOTimezoneResultSetToBuff(resultSet);
                    if (resultSet.next()) {
                        resultSet.last();
                        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                                "Did not expect multi-record response, " + resultSet.getRow()
                                        + " rows selected");
                    }
                    Buff.setRequiredIso8601(updatedBuff.getRequiredIso8601());
                    Buff.setRequiredTZName(updatedBuff.getRequiredTZName());
                    Buff.setRequiredTZHourOffset(updatedBuff.getRequiredTZHourOffset());
                    Buff.setRequiredTZMinOffset(updatedBuff.getRequiredTZMinOffset());
                    Buff.setRequiredDescription(updatedBuff.getRequiredDescription());
                    Buff.setRequiredVisible(updatedBuff.getRequiredVisible());
                    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_isotz() 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_isotz() 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.cfinternet.v2_1.CFInternetOracle.CFInternetOracleISOTimezoneTable.java

public void deleteISOTimezone(CFInternetAuthorization Authorization, CFInternetISOTimezoneBuff Buff) {
    final String S_ProcName = "deleteISOTimezone";
    Connection cnx = schema.getCnx();
    CallableStatement stmtDeleteByPKey = null;
    try {//from   ww  w .  ja va 2s.  co m
        short ISOTimezoneId = Buff.getRequiredISOTimezoneId();
        stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".dl_isotz( ?, ?, ?, ?, ?"
                + ", " + "?" + ", " + "?" + " ); 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.setShort(argIdx++, ISOTimezoneId);
        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.cfinternet.v2_1.CFInternetOracle.CFInternetOracleServiceTable.java

public void createService(CFInternetAuthorization Authorization, CFInternetServiceBuff Buff) {
    final String S_ProcName = "createService";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//from   w  w  w . ja  v  a  2 s . co  m
    ResultSet resultSet = null;
    CallableStatement stmtCreateByPKey = null;
    try {
        long ClusterId = Buff.getRequiredClusterId();
        long HostNodeId = Buff.getRequiredHostNodeId();
        int ServiceTypeId = Buff.getRequiredServiceTypeId();
        short HostPort = Buff.getRequiredHostPort();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx
                .prepareCall("begin " + schema.getLowerDbSchemaName() + ".crt_hostsvc( ?, ?, ?, ?, ?, ?, ?"
                        + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); 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++, "HSVC");
        stmtCreateByPKey.setLong(argIdx++, ClusterId);
        stmtCreateByPKey.setLong(argIdx++, HostNodeId);
        stmtCreateByPKey.setInt(argIdx++, ServiceTypeId);
        stmtCreateByPKey.setShort(argIdx++, HostPort);
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_hostsvc() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFInternetServiceBuff createdBuff = unpackServiceResultSetToBuff(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.setRequiredServiceId(createdBuff.getRequiredServiceId());
                Buff.setRequiredHostNodeId(createdBuff.getRequiredHostNodeId());
                Buff.setRequiredServiceTypeId(createdBuff.getRequiredServiceTypeId());
                Buff.setRequiredHostPort(createdBuff.getRequiredHostPort());
                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_hostsvc() 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.cfinternet.v2_1.CFInternetOracle.CFInternetOracleServiceTable.java

public CFInternetServiceBuff readBuffByUHostPortIdx(CFInternetAuthorization Authorization, long ClusterId,
        long HostNodeId, short HostPort) {
    final String S_ProcName = "readBuffByUHostPortIdx";
    ResultSet resultSet = null;/*  w  w  w. ja  v  a2  s. c  o m*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByUHostPortIdx = null;
    try {
        stmtReadBuffByUHostPortIdx = cnx.prepareCall(
                "begin " + schema.getLowerDbSchemaName() + ".rd_hostsvcbyuhostportidx( ?, ?, ?, ?, ?, ?" + ", "
                        + "?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByUHostPortIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByUHostPortIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUHostPortIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByUHostPortIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByUHostPortIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUHostPortIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByUHostPortIdx.setLong(argIdx++, ClusterId);
        stmtReadBuffByUHostPortIdx.setLong(argIdx++, HostNodeId);
        stmtReadBuffByUHostPortIdx.setShort(argIdx++, HostPort);
        stmtReadBuffByUHostPortIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByUHostPortIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFInternetServiceBuff buff = unpackServiceResultSetToBuff(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 (stmtReadBuffByUHostPortIdx != null) {
            try {
                stmtReadBuffByUHostPortIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByUHostPortIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetOracle.CFInternetOracleServiceTable.java

public void updateService(CFInternetAuthorization Authorization, CFInternetServiceBuff Buff) {
    final String S_ProcName = "updateService";
    ResultSet resultSet = null;//from w  w  w .  j a v a 2 s .  com
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFInternetServiceBuff> buffList = new LinkedList<CFInternetServiceBuff>();
    try {
        long ClusterId = Buff.getRequiredClusterId();
        long ServiceId = Buff.getRequiredServiceId();
        long HostNodeId = Buff.getRequiredHostNodeId();
        int ServiceTypeId = Buff.getRequiredServiceTypeId();
        short HostPort = Buff.getRequiredHostPort();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx
                .prepareCall("begin " + schema.getLowerDbSchemaName() + ".upd_hostsvc( ?, ?, ?, ?, ?, ?, ?"
                        + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); 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++, "HSVC");
        stmtUpdateByPKey.setLong(argIdx++, ClusterId);
        stmtUpdateByPKey.setLong(argIdx++, ServiceId);
        stmtUpdateByPKey.setLong(argIdx++, HostNodeId);
        stmtUpdateByPKey.setInt(argIdx++, ServiceTypeId);
        stmtUpdateByPKey.setShort(argIdx++, HostPort);
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
        if (resultSet != null) {
            try {
                if (resultSet.next()) {
                    CFInternetServiceBuff updatedBuff = unpackServiceResultSetToBuff(resultSet);
                    if (resultSet.next()) {
                        resultSet.last();
                        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                                "Did not expect multi-record response, " + resultSet.getRow()
                                        + " rows selected");
                    }
                    Buff.setRequiredHostNodeId(updatedBuff.getRequiredHostNodeId());
                    Buff.setRequiredServiceTypeId(updatedBuff.getRequiredServiceTypeId());
                    Buff.setRequiredHostPort(updatedBuff.getRequiredHostPort());
                    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_hostsvc() 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_hostsvc() 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.cfinternet.v2_1.CFInternetOracle.CFInternetOracleURLProtocolTable.java

public void createURLProtocol(CFInternetAuthorization Authorization, CFInternetURLProtocolBuff Buff) {
    final String S_ProcName = "createURLProtocol";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from w w  w.  j av a2 s.c  om*/
    ResultSet resultSet = null;
    CallableStatement stmtCreateByPKey = null;
    try {
        short URLProtocolId = Buff.getRequiredURLProtocolId();
        String Name = Buff.getRequiredName();
        String Description = Buff.getRequiredDescription();
        boolean IsSecure = Buff.getRequiredIsSecure();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx
                .prepareCall("begin " + schema.getLowerDbSchemaName() + ".crt_urlproto( ?, ?, ?, ?, ?, ?, ?"
                        + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); 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++, "UPRT");
        stmtCreateByPKey.setShort(argIdx++, URLProtocolId);
        stmtCreateByPKey.setString(argIdx++, Name);
        stmtCreateByPKey.setString(argIdx++, Description);
        if (IsSecure) {
            stmtCreateByPKey.setString(argIdx++, "Y");
        } else {
            stmtCreateByPKey.setString(argIdx++, "N");
        }
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_urlproto() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFInternetURLProtocolBuff createdBuff = unpackURLProtocolResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                Buff.setRequiredURLProtocolId(createdBuff.getRequiredURLProtocolId());
                Buff.setRequiredName(createdBuff.getRequiredName());
                Buff.setRequiredDescription(createdBuff.getRequiredDescription());
                Buff.setRequiredIsSecure(createdBuff.getRequiredIsSecure());
                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_urlproto() 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.cfinternet.v2_1.CFInternetOracle.CFInternetOracleURLProtocolTable.java

public CFInternetURLProtocolBuff readBuff(CFInternetAuthorization Authorization,
        CFInternetURLProtocolPKey PKey) {
    final String S_ProcName = "readBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*w w  w  .j a v a  2 s  .  c om*/
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByPKey = null;
    try {
        short URLProtocolId = PKey.getRequiredURLProtocolId();

        stmtReadBuffByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_urlproto( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); 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++, URLProtocolId);
        stmtReadBuffByPKey.execute();
        resultSet = (ResultSet) stmtReadBuffByPKey.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFInternetURLProtocolBuff buff = unpackURLProtocolResultSetToBuff(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.cfinternet.v2_1.CFInternetOracle.CFInternetOracleURLProtocolTable.java

public CFInternetURLProtocolBuff lockBuff(CFInternetAuthorization Authorization,
        CFInternetURLProtocolPKey PKey) {
    final String S_ProcName = "lockBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from  w  w w.j  av a2 s .  com*/
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtLockBuffByPKey = null;
    try {
        short URLProtocolId = PKey.getRequiredURLProtocolId();

        stmtLockBuffByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".lck_urlproto( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); 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++, URLProtocolId);
        stmtLockBuffByPKey.execute();
        resultSet = (ResultSet) stmtLockBuffByPKey.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFInternetURLProtocolBuff buff = unpackURLProtocolResultSetToBuff(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.cfinternet.v2_1.CFInternetOracle.CFInternetOracleURLProtocolTable.java

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

From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetOracle.CFInternetOracleURLProtocolTable.java

public void updateURLProtocol(CFInternetAuthorization Authorization, CFInternetURLProtocolBuff Buff) {
    final String S_ProcName = "updateURLProtocol";
    ResultSet resultSet = null;// w ww  .j  ava  2 s  .  com
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFInternetURLProtocolBuff> buffList = new LinkedList<CFInternetURLProtocolBuff>();
    try {
        short URLProtocolId = Buff.getRequiredURLProtocolId();
        String Name = Buff.getRequiredName();
        String Description = Buff.getRequiredDescription();
        boolean IsSecure = Buff.getRequiredIsSecure();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx
                .prepareCall("begin " + schema.getLowerDbSchemaName() + ".upd_urlproto( ?, ?, ?, ?, ?, ?, ?"
                        + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); 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++, "UPRT");
        stmtUpdateByPKey.setShort(argIdx++, URLProtocolId);
        stmtUpdateByPKey.setString(argIdx++, Name);
        stmtUpdateByPKey.setString(argIdx++, Description);
        if (IsSecure) {
            stmtUpdateByPKey.setString(argIdx++, "Y");
        } else {
            stmtUpdateByPKey.setString(argIdx++, "N");
        }
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
        if (resultSet != null) {
            try {
                if (resultSet.next()) {
                    CFInternetURLProtocolBuff updatedBuff = unpackURLProtocolResultSetToBuff(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.setRequiredDescription(updatedBuff.getRequiredDescription());
                    Buff.setRequiredIsSecure(updatedBuff.getRequiredIsSecure());
                    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_urlproto() 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_urlproto() 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;
        }
    }
}