Example usage for java.sql CallableStatement setInt

List of usage examples for java.sql CallableStatement setInt

Introduction

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

Prototype

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

Source Link

Document

Sets the designated parameter to the given Java int value.

Usage

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

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

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

public CFAstTSecGroupIncludeBuff[] readBuffByGroupIdx(CFAstAuthorization Authorization, long TenantId,
        int TSecGroupId) {
    final String S_ProcName = "readBuffByGroupIdx";
    ResultSet resultSet = null;/* www. ja v  a  2  s  . co  m*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByGroupIdx = null;
    List<CFAstTSecGroupIncludeBuff> buffList = new LinkedList<CFAstTSecGroupIncludeBuff>();
    try {
        stmtReadBuffByGroupIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_tsecincbygroupidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByGroupIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByGroupIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByGroupIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByGroupIdx.setLong(argIdx++, TenantId);
        stmtReadBuffByGroupIdx.setInt(argIdx++, TSecGroupId);
        stmtReadBuffByGroupIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByGroupIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFAstTSecGroupIncludeBuff buff = unpackTSecGroupIncludeResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFAstTSecGroupIncludeBuff[] retBuff = new CFAstTSecGroupIncludeBuff[buffList.size()];
        Iterator<CFAstTSecGroupIncludeBuff> 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 (stmtReadBuffByGroupIdx != null) {
            try {
                stmtReadBuffByGroupIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByGroupIdx = null;
        }
    }
}

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

public CFAstTSecGroupIncludeBuff[] readBuffByGroupIdx(CFAstAuthorization Authorization, long TenantId,
        int TSecGroupId) {
    final String S_ProcName = "readBuffByGroupIdx";
    ResultSet resultSet = null;//ww w  . j a va2s.c o  m
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByGroupIdx = null;
    List<CFAstTSecGroupIncludeBuff> buffList = new LinkedList<CFAstTSecGroupIncludeBuff>();
    try {
        stmtReadBuffByGroupIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_tsecincbygroupidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByGroupIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByGroupIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByGroupIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByGroupIdx.setLong(argIdx++, TenantId);
        stmtReadBuffByGroupIdx.setInt(argIdx++, TSecGroupId);
        stmtReadBuffByGroupIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByGroupIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFAstTSecGroupIncludeBuff buff = unpackTSecGroupIncludeResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFAstTSecGroupIncludeBuff[] retBuff = new CFAstTSecGroupIncludeBuff[buffList.size()];
        Iterator<CFAstTSecGroupIncludeBuff> 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 (stmtReadBuffByGroupIdx != null) {
            try {
                stmtReadBuffByGroupIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByGroupIdx = null;
        }
    }
}

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

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

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

public CFSecuritySecGroupIncludeBuff[] readBuffByGroupIdx(CFSecurityAuthorization Authorization, long ClusterId,
        int SecGroupId) {
    final String S_ProcName = "readBuffByGroupIdx";
    ResultSet resultSet = null;/*from   w  ww  .j  a  v  a2s.c  o m*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByGroupIdx = null;
    List<CFSecuritySecGroupIncludeBuff> buffList = new LinkedList<CFSecuritySecGroupIncludeBuff>();
    try {
        stmtReadBuffByGroupIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_secincbygroupidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByGroupIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByGroupIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByGroupIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByGroupIdx.setLong(argIdx++, ClusterId);
        stmtReadBuffByGroupIdx.setInt(argIdx++, SecGroupId);
        stmtReadBuffByGroupIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByGroupIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFSecuritySecGroupIncludeBuff buff = unpackSecGroupIncludeResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFSecuritySecGroupIncludeBuff[] retBuff = new CFSecuritySecGroupIncludeBuff[buffList.size()];
        Iterator<CFSecuritySecGroupIncludeBuff> 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 (stmtReadBuffByGroupIdx != null) {
            try {
                stmtReadBuffByGroupIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByGroupIdx = null;
        }
    }
}

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

public CFSecurityTSecGroupIncludeBuff[] readBuffByGroupIdx(CFSecurityAuthorization Authorization, long TenantId,
        int TSecGroupId) {
    final String S_ProcName = "readBuffByGroupIdx";
    ResultSet resultSet = null;/*from  www  . ja va2 s.  c om*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByGroupIdx = null;
    List<CFSecurityTSecGroupIncludeBuff> buffList = new LinkedList<CFSecurityTSecGroupIncludeBuff>();
    try {
        stmtReadBuffByGroupIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_tsecincbygroupidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByGroupIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByGroupIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByGroupIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByGroupIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByGroupIdx.setLong(argIdx++, TenantId);
        stmtReadBuffByGroupIdx.setInt(argIdx++, TSecGroupId);
        stmtReadBuffByGroupIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByGroupIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFSecurityTSecGroupIncludeBuff buff = unpackTSecGroupIncludeResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFSecurityTSecGroupIncludeBuff[] retBuff = new CFSecurityTSecGroupIncludeBuff[buffList.size()];
        Iterator<CFSecurityTSecGroupIncludeBuff> 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 (stmtReadBuffByGroupIdx != null) {
            try {
                stmtReadBuffByGroupIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByGroupIdx = null;
        }
    }
}

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

public void deleteFSSFExtension(CFFswAuthorization Authorization, CFFswFSSFExtensionBuff Buff) {
    final String S_ProcName = "deleteFSSFExtension";
    Connection cnx = schema.getCnx();
    CallableStatement stmtDeleteByPKey = null;
    try {//from  ww w .ja  v  a2s  .c o m
        long TenantId = Buff.getRequiredTenantId();
        long FSSFExtensionId = Buff.getRequiredFSSFExtensionId();
        stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".dl_fssfext( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); 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++, TenantId);
        stmtDeleteByPKey.setLong(argIdx++, FSSFExtensionId);
        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.cfacc.v2_0.CFAccOracle.CFAccOracleSecFormTable.java

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

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

public void createSecForm(CFAstAuthorization Authorization, CFAstSecFormBuff Buff) {
    final String S_ProcName = "createSecForm";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from w w  w  . ja  v  a2 s  .c  o m*/
    ResultSet resultSet = null;
    CallableStatement stmtCreateByPKey = null;
    try {
        long ClusterId = Buff.getRequiredClusterId();
        int SecAppId = Buff.getRequiredSecAppId();
        String JEEServletMapName = Buff.getRequiredJEEServletMapName();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".crt_secform( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtCreateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtCreateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtCreateByPKey.setString(argIdx++, "SFRM");
        stmtCreateByPKey.setLong(argIdx++, ClusterId);
        stmtCreateByPKey.setInt(argIdx++, SecAppId);
        stmtCreateByPKey.setString(argIdx++, JEEServletMapName);
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_secform() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFAstSecFormBuff createdBuff = unpackSecFormResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                Buff.setRequiredClusterId(createdBuff.getRequiredClusterId());
                Buff.setRequiredSecFormId(createdBuff.getRequiredSecFormId());
                Buff.setRequiredSecAppId(createdBuff.getRequiredSecAppId());
                Buff.setRequiredJEEServletMapName(createdBuff.getRequiredJEEServletMapName());
                Buff.setRequiredRevision(createdBuff.getRequiredRevision());
                Buff.setCreatedByUserId(createdBuff.getCreatedByUserId());
                Buff.setCreatedAt(createdBuff.getCreatedAt());
                Buff.setUpdatedByUserId(createdBuff.getUpdatedByUserId());
                Buff.setUpdatedAt(createdBuff.getUpdatedAt());
            } else {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Expected a single-record response, " + resultSet.getRow() + " rows selected");
            }
        } catch (SQLException e) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_secform() did not return a valid result set");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtCreateByPKey != null) {
            try {
                stmtCreateByPKey.close();
            } catch (SQLException e) {
            }
            stmtCreateByPKey = null;
        }
    }
}

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

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