Example usage for java.sql Connection prepareCall

List of usage examples for java.sql Connection prepareCall

Introduction

In this page you can find the example usage for java.sql Connection prepareCall.

Prototype

CallableStatement prepareCall(String sql) throws SQLException;

Source Link

Document

Creates a CallableStatement object for calling database stored procedures.

Usage

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

public CFEnSyntaxEnConnectiveBuff readBuffByUNameIdx(CFEnSyntaxAuthorization Authorization, Long ScopeId,
        String Name) {/* w w  w.ja  v  a 2 s.c  o  m*/
    final String S_ProcName = "readBuffByUNameIdx";
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByUNameIdx = null;
    try {
        stmtReadBuffByUNameIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_enconnbyunameidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByUNameIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByUNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (ScopeId != null) {
            stmtReadBuffByUNameIdx.setLong(argIdx++, ScopeId.longValue());
        } else {
            stmtReadBuffByUNameIdx.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtReadBuffByUNameIdx.setString(argIdx++, Name);
        stmtReadBuffByUNameIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByUNameIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFEnSyntaxEnConnectiveBuff buff = unpackEnConnectiveResultSetToBuff(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 (stmtReadBuffByUNameIdx != null) {
            try {
                stmtReadBuffByUNameIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByUNameIdx = null;
        }
    }
}

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

public CFEnSyntaxEnDeterminerBuff readBuffByUNameIdx(CFEnSyntaxAuthorization Authorization, Long ScopeId,
        String Name) {/*from  www. j  av  a  2  s  .co m*/
    final String S_ProcName = "readBuffByUNameIdx";
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByUNameIdx = null;
    try {
        stmtReadBuffByUNameIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_endeterbyunameidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByUNameIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByUNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (ScopeId != null) {
            stmtReadBuffByUNameIdx.setLong(argIdx++, ScopeId.longValue());
        } else {
            stmtReadBuffByUNameIdx.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtReadBuffByUNameIdx.setString(argIdx++, Name);
        stmtReadBuffByUNameIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByUNameIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFEnSyntaxEnDeterminerBuff buff = unpackEnDeterminerResultSetToBuff(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 (stmtReadBuffByUNameIdx != null) {
            try {
                stmtReadBuffByUNameIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByUNameIdx = null;
        }
    }
}

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

public void createISOCurrency(CFAccAuthorization Authorization, CFAccISOCurrencyBuff Buff) {
    final String S_ProcName = "createISOCurrency";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//from w  ww  .j  a  v a 2s .c o m
    ResultSet resultSet = null;
    CallableStatement stmtCreateByPKey = null;
    try {
        short Id = Buff.getRequiredId();
        String ISOCode = Buff.getRequiredISOCode();
        String Name = Buff.getRequiredName();
        String UnitSymbol = Buff.getOptionalUnitSymbol();
        String FracSymbol = Buff.getOptionalFracSymbol();
        short Precis = Buff.getRequiredPrecis();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall(
                "begin " + schema.getLowerSchemaDbName() + ".crt_iso_ccy( ?, ?, ?, ?, ?, ?, ?" + ", " + "?"
                        + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); 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++, "ISCY");
        stmtCreateByPKey.setShort(argIdx++, Id);
        stmtCreateByPKey.setString(argIdx++, ISOCode);
        stmtCreateByPKey.setString(argIdx++, Name);
        if (UnitSymbol != null) {
            stmtCreateByPKey.setString(argIdx++, UnitSymbol);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (FracSymbol != null) {
            stmtCreateByPKey.setString(argIdx++, FracSymbol);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtCreateByPKey.setShort(argIdx++, Precis);
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_iso_ccy() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFAccISOCurrencyBuff createdBuff = unpackISOCurrencyResultSetToBuff(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.setOptionalUnitSymbol(createdBuff.getOptionalUnitSymbol());
                Buff.setOptionalFracSymbol(createdBuff.getOptionalFracSymbol());
                Buff.setRequiredPrecis(createdBuff.getRequiredPrecis());
                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_ccy() 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.cfacc.v2_0.CFAccOracle.CFAccOracleTldTable.java

public CFAccTldBuff readBuffByNameIdx(CFAccAuthorization Authorization, long TenantId, String Name) {
    final String S_ProcName = "readBuffByNameIdx";
    ResultSet resultSet = null;//  w  w w. jav a2s  .c o m
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByNameIdx = null;
    try {
        stmtReadBuffByNameIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_tlddefbynameidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByNameIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByNameIdx.setLong(argIdx++, TenantId);
        stmtReadBuffByNameIdx.setString(argIdx++, Name);
        stmtReadBuffByNameIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByNameIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFAccTldBuff buff = unpackTldResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByNameIdx != null) {
            try {
                stmtReadBuffByNameIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByNameIdx = null;
        }
    }
}

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

public void createISOCurrency(CFAstAuthorization Authorization, CFAstISOCurrencyBuff Buff) {
    final String S_ProcName = "createISOCurrency";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from   ww  w  .j  av a  2 s . co m*/
    ResultSet resultSet = null;
    CallableStatement stmtCreateByPKey = null;
    try {
        short Id = Buff.getRequiredId();
        String ISOCode = Buff.getRequiredISOCode();
        String Name = Buff.getRequiredName();
        String UnitSymbol = Buff.getOptionalUnitSymbol();
        String FracSymbol = Buff.getOptionalFracSymbol();
        short Precis = Buff.getRequiredPrecis();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall(
                "begin " + schema.getLowerSchemaDbName() + ".crt_iso_ccy( ?, ?, ?, ?, ?, ?, ?" + ", " + "?"
                        + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); 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++, "ISCY");
        stmtCreateByPKey.setShort(argIdx++, Id);
        stmtCreateByPKey.setString(argIdx++, ISOCode);
        stmtCreateByPKey.setString(argIdx++, Name);
        if (UnitSymbol != null) {
            stmtCreateByPKey.setString(argIdx++, UnitSymbol);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (FracSymbol != null) {
            stmtCreateByPKey.setString(argIdx++, FracSymbol);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtCreateByPKey.setShort(argIdx++, Precis);
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_iso_ccy() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFAstISOCurrencyBuff createdBuff = unpackISOCurrencyResultSetToBuff(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.setOptionalUnitSymbol(createdBuff.getOptionalUnitSymbol());
                Buff.setOptionalFracSymbol(createdBuff.getOptionalFracSymbol());
                Buff.setRequiredPrecis(createdBuff.getRequiredPrecis());
                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_ccy() 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_0.CFAstOracle.CFAstOracleTldTable.java

public CFAstTldBuff readBuffByNameIdx(CFAstAuthorization Authorization, long TenantId, String Name) {
    final String S_ProcName = "readBuffByNameIdx";
    ResultSet resultSet = null;//from  w w  w  . j  av  a 2  s.  c om
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByNameIdx = null;
    try {
        stmtReadBuffByNameIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_tlddefbynameidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByNameIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByNameIdx.setLong(argIdx++, TenantId);
        stmtReadBuffByNameIdx.setString(argIdx++, Name);
        stmtReadBuffByNameIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByNameIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFAstTldBuff buff = unpackTldResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByNameIdx != null) {
            try {
                stmtReadBuffByNameIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByNameIdx = null;
        }
    }
}

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

public void createISOCurrency(CFAstAuthorization Authorization, CFAstISOCurrencyBuff Buff) {
    final String S_ProcName = "createISOCurrency";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*  w  w  w . j a va2 s .c om*/
    ResultSet resultSet = null;
    CallableStatement stmtCreateByPKey = null;
    try {
        short Id = Buff.getRequiredId();
        String ISOCode = Buff.getRequiredISOCode();
        String Name = Buff.getRequiredName();
        String UnitSymbol = Buff.getOptionalUnitSymbol();
        String FracSymbol = Buff.getOptionalFracSymbol();
        short Precis = Buff.getRequiredPrecis();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall(
                "begin " + schema.getLowerDbSchemaName() + ".crt_iso_ccy( ?, ?, ?, ?, ?, ?, ?" + ", " + "?"
                        + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); 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++, "ISCY");
        stmtCreateByPKey.setShort(argIdx++, Id);
        stmtCreateByPKey.setString(argIdx++, ISOCode);
        stmtCreateByPKey.setString(argIdx++, Name);
        if (UnitSymbol != null) {
            stmtCreateByPKey.setString(argIdx++, UnitSymbol);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (FracSymbol != null) {
            stmtCreateByPKey.setString(argIdx++, FracSymbol);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtCreateByPKey.setShort(argIdx++, Precis);
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_iso_ccy() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFAstISOCurrencyBuff createdBuff = unpackISOCurrencyResultSetToBuff(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.setOptionalUnitSymbol(createdBuff.getOptionalUnitSymbol());
                Buff.setOptionalFracSymbol(createdBuff.getOptionalFracSymbol());
                Buff.setRequiredPrecis(createdBuff.getRequiredPrecis());
                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_ccy() 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.CFAstOracleTldTable.java

public CFAstTldBuff readBuffByNameIdx(CFAstAuthorization Authorization, long TenantId, String Name) {
    final String S_ProcName = "readBuffByNameIdx";
    ResultSet resultSet = null;//from w  w w .  j a  v a  2 s.co m
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByNameIdx = null;
    try {
        stmtReadBuffByNameIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_tlddefbynameidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByNameIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByNameIdx.setLong(argIdx++, TenantId);
        stmtReadBuffByNameIdx.setString(argIdx++, Name);
        stmtReadBuffByNameIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByNameIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFAstTldBuff buff = unpackTldResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByNameIdx != null) {
            try {
                stmtReadBuffByNameIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByNameIdx = null;
        }
    }
}

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

public void deleteEnComplement(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnComplementBuff Buff) {
    final String S_ProcName = "deleteEnComplement";
    Connection cnx = schema.getCnx();
    CallableStatement stmtDeleteByPKey = null;
    try {/*from   w w w.  j a  v  a2s . c  o m*/
        long Id = Buff.getRequiredId();
        stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".dl_encompl( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); 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.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleEnConnectiveTable.java

public void deleteEnConnective(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnConnectiveBuff Buff) {
    final String S_ProcName = "deleteEnConnective";
    Connection cnx = schema.getCnx();
    CallableStatement stmtDeleteByPKey = null;
    try {//  w ww  .j  av  a  2s  . co m
        long Id = Buff.getRequiredId();
        stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".dl_enconn( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); 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;
        }
    }
}