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.CFInternetOracleISOCountryLanguageTable.java

public CFInternetISOCountryLanguageBuff lockBuff(CFInternetAuthorization Authorization,
        CFInternetISOCountryLanguagePKey PKey) {
    final String S_ProcName = "lockBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from   w  w  w  .  j  ava 2 s  .c o m*/
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtLockBuffByPKey = null;
    try {
        short ISOCountryId = PKey.getRequiredISOCountryId();
        short ISOLanguageId = PKey.getRequiredISOLanguageId();

        stmtLockBuffByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".lck_iso_cntrylng( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); 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++, ISOCountryId);
        stmtLockBuffByPKey.setShort(argIdx++, ISOLanguageId);
        stmtLockBuffByPKey.execute();
        resultSet = (ResultSet) stmtLockBuffByPKey.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFInternetISOCountryLanguageBuff buff = unpackISOCountryLanguageResultSetToBuff(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.CFInternetOracleISOCountryLanguageTable.java

public CFInternetISOCountryLanguageBuff readBuffByIdIdx(CFInternetAuthorization Authorization,
        short ISOCountryId, short ISOLanguageId) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;/* ww w  . ja  va2s . co m*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByIdIdx = null;
    try {
        stmtReadBuffByIdIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_iso_cntrylngbyididx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); 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++, ISOCountryId);
        stmtReadBuffByIdIdx.setShort(argIdx++, ISOLanguageId);
        stmtReadBuffByIdIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByIdIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFInternetISOCountryLanguageBuff buff = unpackISOCountryLanguageResultSetToBuff(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.CFInternetOracleISOCountryLanguageTable.java

public CFInternetISOCountryLanguageBuff[] readBuffByCountryIdx(CFInternetAuthorization Authorization,
        short ISOCountryId) {
    final String S_ProcName = "readBuffByCountryIdx";
    ResultSet resultSet = null;// w w  w. j  av a2s.  c om
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByCountryIdx = null;
    List<CFInternetISOCountryLanguageBuff> buffList = new LinkedList<CFInternetISOCountryLanguageBuff>();
    try {
        stmtReadBuffByCountryIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_iso_cntrylngbycountryidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByCountryIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByCountryIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByCountryIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByCountryIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByCountryIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByCountryIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByCountryIdx.setShort(argIdx++, ISOCountryId);
        stmtReadBuffByCountryIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByCountryIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFInternetISOCountryLanguageBuff buff = unpackISOCountryLanguageResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFInternetISOCountryLanguageBuff[] retBuff = new CFInternetISOCountryLanguageBuff[buffList.size()];
        Iterator<CFInternetISOCountryLanguageBuff> 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 (stmtReadBuffByCountryIdx != null) {
            try {
                stmtReadBuffByCountryIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByCountryIdx = null;
        }
    }
}

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

public CFInternetISOCountryLanguageBuff[] readBuffByLanguageIdx(CFInternetAuthorization Authorization,
        short ISOLanguageId) {
    final String S_ProcName = "readBuffByLanguageIdx";
    ResultSet resultSet = null;/*from  w  w w .j a va  2  s.  c  o m*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByLanguageIdx = null;
    List<CFInternetISOCountryLanguageBuff> buffList = new LinkedList<CFInternetISOCountryLanguageBuff>();
    try {
        stmtReadBuffByLanguageIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_iso_cntrylngbylanguageidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByLanguageIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByLanguageIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByLanguageIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByLanguageIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByLanguageIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByLanguageIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByLanguageIdx.setShort(argIdx++, ISOLanguageId);
        stmtReadBuffByLanguageIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByLanguageIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFInternetISOCountryLanguageBuff buff = unpackISOCountryLanguageResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFInternetISOCountryLanguageBuff[] retBuff = new CFInternetISOCountryLanguageBuff[buffList.size()];
        Iterator<CFInternetISOCountryLanguageBuff> 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 (stmtReadBuffByLanguageIdx != null) {
            try {
                stmtReadBuffByLanguageIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByLanguageIdx = null;
        }
    }
}

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

public void updateISOCountryLanguage(CFInternetAuthorization Authorization,
        CFInternetISOCountryLanguageBuff Buff) {
    final String S_ProcName = "updateISOCountryLanguage";
    ResultSet resultSet = null;//www  . j ava  2s  . c o  m
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFInternetISOCountryLanguageBuff> buffList = new LinkedList<CFInternetISOCountryLanguageBuff>();
    try {
        short ISOCountryId = Buff.getRequiredISOCountryId();
        short ISOLanguageId = Buff.getRequiredISOLanguageId();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".upd_iso_cntrylng( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "? ); 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++, "ISCL");
        stmtUpdateByPKey.setShort(argIdx++, ISOCountryId);
        stmtUpdateByPKey.setShort(argIdx++, ISOLanguageId);
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
        if (resultSet != null) {
            try {
                if (resultSet.next()) {
                    CFInternetISOCountryLanguageBuff updatedBuff = unpackISOCountryLanguageResultSetToBuff(
                            resultSet);
                    if (resultSet.next()) {
                        resultSet.last();
                        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                                "Did not expect multi-record response, " + resultSet.getRow()
                                        + " rows selected");
                    }
                    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_cntrylng() 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_cntrylng() 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.CFInternetOracleISOCountryLanguageTable.java

public void deleteISOCountryLanguage(CFInternetAuthorization Authorization,
        CFInternetISOCountryLanguageBuff Buff) {
    final String S_ProcName = "deleteISOCountryLanguage";
    Connection cnx = schema.getCnx();
    CallableStatement stmtDeleteByPKey = null;
    try {// w  w  w  . java2s  .co  m
        short ISOCountryId = Buff.getRequiredISOCountryId();
        short ISOLanguageId = Buff.getRequiredISOLanguageId();
        stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".dl_iso_cntrylng( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); 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++, ISOCountryId);
        stmtDeleteByPKey.setShort(argIdx++, ISOLanguageId);
        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.CFInternetOracleISOCountryTable.java

public void createISOCountry(CFInternetAuthorization Authorization, CFInternetISOCountryBuff Buff) {
    final String S_ProcName = "createISOCountry";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//w w w  .j a  va  2s.c  o m
    ResultSet resultSet = null;
    CallableStatement stmtCreateByPKey = null;
    try {
        short Id = Buff.getRequiredId();
        String ISOCode = Buff.getRequiredISOCode();
        String Name = Buff.getRequiredName();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".crt_iso_cntry( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); 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++, "ISOC");
        stmtCreateByPKey.setShort(argIdx++, Id);
        stmtCreateByPKey.setString(argIdx++, ISOCode);
        stmtCreateByPKey.setString(argIdx++, Name);
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_iso_cntry() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFInternetISOCountryBuff createdBuff = 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.setRequiredId(createdBuff.getRequiredId());
                Buff.setRequiredISOCode(createdBuff.getRequiredISOCode());
                Buff.setRequiredName(createdBuff.getRequiredName());
                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_iso_cntry() 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.CFInternetOracleISOCountryTable.java

public CFInternetISOCountryBuff readBuff(CFInternetAuthorization Authorization, CFInternetISOCountryPKey PKey) {
    final String S_ProcName = "readBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//w w  w.ja va 2  s.co  m
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByPKey = null;
    try {
        short Id = PKey.getRequiredId();

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

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

public CFInternetISOCountryBuff lockBuff(CFInternetAuthorization Authorization, CFInternetISOCountryPKey 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  a 2  s .  c om
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtLockBuffByPKey = null;
    try {
        short Id = PKey.getRequiredId();

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

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

public CFInternetISOCountryBuff readBuffByIdIdx(CFInternetAuthorization Authorization, short Id) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;//from   w ww.  j av a2 s  . co  m
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByIdIdx = null;
    try {
        stmtReadBuffByIdIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_iso_cntrybyididx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); 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++, Id);
        stmtReadBuffByIdIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByIdIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFInternetISOCountryBuff buff = unpackISOCountryResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByIdIdx != null) {
            try {
                stmtReadBuffByIdIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByIdIdx = null;
        }
    }
}