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

public void createEnClause(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnClauseBuff Buff) {
    final String S_ProcName = "createEnClause";
    ResultSet resultSet = null;/*from  w  w w. j  a  v  a  2s. c o m*/
    CallableStatement stmtCreateByPKey = null;
    try {
        String ClassCode = Buff.getClassCode();
        Long ScopeId = Buff.getOptionalScopeId();
        String Name = Buff.getRequiredName();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".crt_enclause( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); 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++, ClassCode);
        if (ScopeId != null) {
            stmtCreateByPKey.setLong(argIdx++, ScopeId.longValue());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtCreateByPKey.setString(argIdx++, Name);
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_enclause() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFEnSyntaxEnClauseBuff createdBuff = unpackEnClauseResultSetToBuff(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.setOptionalScopeId(createdBuff.getOptionalScopeId());
                Buff.setRequiredName(createdBuff.getRequiredName());
                Buff.setRequiredRevision(createdBuff.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,
                    "crt_enclause() 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.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleEnHeadTable.java

public void createEnHead(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnHeadBuff Buff) {
    final String S_ProcName = "createEnHead";
    ResultSet resultSet = null;/*from   w  w  w.  ja va  2  s.com*/
    CallableStatement stmtCreateByPKey = null;
    try {
        String ClassCode = Buff.getClassCode();
        Long ScopeId = Buff.getOptionalScopeId();
        String Name = Buff.getRequiredName();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".crt_enhead( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); 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++, ClassCode);
        if (ScopeId != null) {
            stmtCreateByPKey.setLong(argIdx++, ScopeId.longValue());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtCreateByPKey.setString(argIdx++, Name);
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_enhead() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFEnSyntaxEnHeadBuff createdBuff = unpackEnHeadResultSetToBuff(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.setOptionalScopeId(createdBuff.getOptionalScopeId());
                Buff.setRequiredName(createdBuff.getRequiredName());
                Buff.setRequiredRevision(createdBuff.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,
                    "crt_enhead() 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.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleEnObjectTable.java

public void createEnObject(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnObjectBuff Buff) {
    final String S_ProcName = "createEnObject";
    ResultSet resultSet = null;//  w ww. ja v a2 s .c  o m
    CallableStatement stmtCreateByPKey = null;
    try {
        String ClassCode = Buff.getClassCode();
        Long ScopeId = Buff.getOptionalScopeId();
        String Name = Buff.getRequiredName();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".crt_enobj( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); 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++, ClassCode);
        if (ScopeId != null) {
            stmtCreateByPKey.setLong(argIdx++, ScopeId.longValue());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtCreateByPKey.setString(argIdx++, Name);
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_enobj() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFEnSyntaxEnObjectBuff createdBuff = unpackEnObjectResultSetToBuff(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.setOptionalScopeId(createdBuff.getOptionalScopeId());
                Buff.setRequiredName(createdBuff.getRequiredName());
                Buff.setRequiredRevision(createdBuff.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,
                    "crt_enobj() 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.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleEnPhraseTable.java

public void createEnPhrase(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnPhraseBuff Buff) {
    final String S_ProcName = "createEnPhrase";
    ResultSet resultSet = null;/*w w w . j a va  2  s . com*/
    CallableStatement stmtCreateByPKey = null;
    try {
        String ClassCode = Buff.getClassCode();
        Long ScopeId = Buff.getOptionalScopeId();
        String Name = Buff.getRequiredName();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".crt_enphrase( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); 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++, ClassCode);
        if (ScopeId != null) {
            stmtCreateByPKey.setLong(argIdx++, ScopeId.longValue());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtCreateByPKey.setString(argIdx++, Name);
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_enphrase() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFEnSyntaxEnPhraseBuff createdBuff = unpackEnPhraseResultSetToBuff(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.setOptionalScopeId(createdBuff.getOptionalScopeId());
                Buff.setRequiredName(createdBuff.getRequiredName());
                Buff.setRequiredRevision(createdBuff.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,
                    "crt_enphrase() 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.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleEnTenseTable.java

public void createEnTense(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnTenseBuff Buff) {
    final String S_ProcName = "createEnTense";
    ResultSet resultSet = null;// w  ww.  ja v  a  2  s . c o  m
    CallableStatement stmtCreateByPKey = null;
    try {
        String ClassCode = Buff.getClassCode();
        Long ScopeId = Buff.getOptionalScopeId();
        String Name = Buff.getRequiredName();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".crt_entense( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); 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++, ClassCode);
        if (ScopeId != null) {
            stmtCreateByPKey.setLong(argIdx++, ScopeId.longValue());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtCreateByPKey.setString(argIdx++, Name);
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_entense() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFEnSyntaxEnTenseBuff createdBuff = unpackEnTenseResultSetToBuff(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.setOptionalScopeId(createdBuff.getOptionalScopeId());
                Buff.setRequiredName(createdBuff.getRequiredName());
                Buff.setRequiredRevision(createdBuff.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,
                    "crt_entense() 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.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleEnWordTable.java

public void createEnWord(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnWordBuff Buff) {
    final String S_ProcName = "createEnWord";
    ResultSet resultSet = null;//from  w  w w .  j a  v  a 2 s  . c  o m
    CallableStatement stmtCreateByPKey = null;
    try {
        String ClassCode = Buff.getClassCode();
        Long ScopeId = Buff.getOptionalScopeId();
        String Name = Buff.getRequiredName();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".crt_enword( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); 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++, ClassCode);
        if (ScopeId != null) {
            stmtCreateByPKey.setLong(argIdx++, ScopeId.longValue());
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtCreateByPKey.setString(argIdx++, Name);
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_enword() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFEnSyntaxEnWordBuff createdBuff = unpackEnWordResultSetToBuff(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.setOptionalScopeId(createdBuff.getOptionalScopeId());
                Buff.setRequiredName(createdBuff.getRequiredName());
                Buff.setRequiredRevision(createdBuff.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,
                    "crt_enword() 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.CFAccOracleAuditActionTable.java

public CFAccAuditActionBuff[] readAllBuff(CFAccAuthorization Authorization) {
    final String S_ProcName = "readAllBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//from   w  w w  . j a  v a 2s.c  o m
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadAllBuff = null;
    try {
        CFAccAuditActionBuff buff = null;
        List<CFAccAuditActionBuff> buffList = new LinkedList<CFAccAuditActionBuff>();
        stmtReadAllBuff = cnx.prepareCall(
                "begin " + schema.getLowerSchemaDbName() + ".rd_auditactionall( ?, ?, ?, ?, ?, ? ) ); end;");
        int argIdx = 1;
        stmtReadAllBuff.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadAllBuff.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadAllBuff.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadAllBuff.execute();
        resultSet = (ResultSet) stmtReadAllBuff.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    buff = unpackAuditActionResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
            } catch (SQLException e) {
                // Oracle may return an invalid resultSet if the rowset is empty
            }
        }
        int idx = 0;
        CFAccAuditActionBuff[] retBuff = new CFAccAuditActionBuff[buffList.size()];
        Iterator<CFAccAuditActionBuff> 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 (stmtReadAllBuff != null) {
            try {
                stmtReadAllBuff.close();
            } catch (SQLException e) {
            }
            stmtReadAllBuff = null;
        }
    }
}

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

public CFAstAuditActionBuff[] readAllBuff(CFAstAuthorization Authorization) {
    final String S_ProcName = "readAllBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//from ww  w . j a  v a  2  s . c om
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadAllBuff = null;
    try {
        CFAstAuditActionBuff buff = null;
        List<CFAstAuditActionBuff> buffList = new LinkedList<CFAstAuditActionBuff>();
        stmtReadAllBuff = cnx.prepareCall(
                "begin " + schema.getLowerSchemaDbName() + ".rd_auditactionall( ?, ?, ?, ?, ?, ? ) ); end;");
        int argIdx = 1;
        stmtReadAllBuff.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadAllBuff.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadAllBuff.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadAllBuff.execute();
        resultSet = (ResultSet) stmtReadAllBuff.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    buff = unpackAuditActionResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
            } catch (SQLException e) {
                // Oracle may return an invalid resultSet if the rowset is empty
            }
        }
        int idx = 0;
        CFAstAuditActionBuff[] retBuff = new CFAstAuditActionBuff[buffList.size()];
        Iterator<CFAstAuditActionBuff> 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 (stmtReadAllBuff != null) {
            try {
                stmtReadAllBuff.close();
            } catch (SQLException e) {
            }
            stmtReadAllBuff = null;
        }
    }
}

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

public CFAstAuditActionBuff[] readAllBuff(CFAstAuthorization Authorization) {
    final String S_ProcName = "readAllBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from   w ww.  j av a2 s .  c  o  m*/
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadAllBuff = null;
    try {
        CFAstAuditActionBuff buff = null;
        List<CFAstAuditActionBuff> buffList = new LinkedList<CFAstAuditActionBuff>();
        stmtReadAllBuff = cnx.prepareCall(
                "begin " + schema.getLowerDbSchemaName() + ".rd_auditactionall( ?, ?, ?, ?, ?, ? ) ); end;");
        int argIdx = 1;
        stmtReadAllBuff.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadAllBuff.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadAllBuff.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadAllBuff.execute();
        resultSet = (ResultSet) stmtReadAllBuff.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    buff = unpackAuditActionResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
            } catch (SQLException e) {
                // Oracle may return an invalid resultSet if the rowset is empty
            }
        }
        int idx = 0;
        CFAstAuditActionBuff[] retBuff = new CFAstAuditActionBuff[buffList.size()];
        Iterator<CFAstAuditActionBuff> 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 (stmtReadAllBuff != null) {
            try {
                stmtReadAllBuff.close();
            } catch (SQLException e) {
            }
            stmtReadAllBuff = null;
        }
    }
}

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

public CFFswAuditActionBuff[] readAllBuff(CFFswAuthorization Authorization) {
    final String S_ProcName = "readAllBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//from  w w w .  j a  v a2 s  .com
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadAllBuff = null;
    try {
        CFFswAuditActionBuff buff = null;
        List<CFFswAuditActionBuff> buffList = new LinkedList<CFFswAuditActionBuff>();
        stmtReadAllBuff = cnx.prepareCall(
                "begin " + schema.getLowerDbSchemaName() + ".rd_auditactionall( ?, ?, ?, ?, ?, ? ) ); end;");
        int argIdx = 1;
        stmtReadAllBuff.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadAllBuff.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadAllBuff.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadAllBuff.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadAllBuff.execute();
        resultSet = (ResultSet) stmtReadAllBuff.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    buff = unpackAuditActionResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
            } catch (SQLException e) {
                // Oracle may return an invalid resultSet if the rowset is empty
            }
        }
        int idx = 0;
        CFFswAuditActionBuff[] retBuff = new CFFswAuditActionBuff[buffList.size()];
        Iterator<CFFswAuditActionBuff> 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 (stmtReadAllBuff != null) {
            try {
                stmtReadAllBuff.close();
            } catch (SQLException e) {
            }
            stmtReadAllBuff = null;
        }
    }
}