Example usage for java.sql CallableStatement setNull

List of usage examples for java.sql CallableStatement setNull

Introduction

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

Prototype

void setNull(String parameterName, int sqlType) throws SQLException;

Source Link

Document

Sets the designated parameter to SQL NULL.

Usage

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

public void updateEnPreposition(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnPrepositionBuff Buff) {
    final String S_ProcName = "updateEnPreposition";
    ResultSet resultSet = null;//  www.  j a  v a2 s.  c o  m
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFEnSyntaxEnPrepositionBuff> buffList = new LinkedList<CFEnSyntaxEnPrepositionBuff>();
    try {
        String ClassCode = Buff.getClassCode();
        long Id = Buff.getRequiredId();
        Long ScopeId = Buff.getOptionalScopeId();
        String Name = Buff.getRequiredName();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx
                .prepareCall("begin " + schema.getLowerDbSchemaName() + ".upd_enprep( ?, ?, ?, ?, ?, ?, ?"
                        + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); end;");
        int argIdx = 1;
        stmtUpdateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtUpdateByPKey.setString(argIdx++, ClassCode);
        stmtUpdateByPKey.setLong(argIdx++, Id);
        if (ScopeId != null) {
            stmtUpdateByPKey.setLong(argIdx++, ScopeId.longValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtUpdateByPKey.setString(argIdx++, Name);
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
        if (resultSet != null) {
            try {
                if (resultSet.next()) {
                    CFEnSyntaxEnPrepositionBuff updatedBuff = unpackEnPrepositionResultSetToBuff(resultSet);
                    if (resultSet.next()) {
                        resultSet.last();
                        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                                "Did not expect multi-record response, " + resultSet.getRow()
                                        + " rows selected");
                    }
                    Buff.setOptionalScopeId(updatedBuff.getOptionalScopeId());
                    Buff.setRequiredName(updatedBuff.getRequiredName());
                    Buff.setRequiredRevision(updatedBuff.getRequiredRevision());
                } else {
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Expected a single-record response, " + resultSet.getRow() + " rows selected");
                }
            } catch (SQLException e) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "upd_enprep() did not return a valid result cursor");
            } finally {
                if (resultSet != null) {
                    try {
                        resultSet.close();
                    } catch (SQLException e) {
                    }
                    resultSet = null;
                }
            }
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "upd_enprep() did not return a result cursor");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtUpdateByPKey != null) {
            try {
                stmtUpdateByPKey.close();
            } catch (SQLException e) {
            }
            stmtUpdateByPKey = null;
        }
    }
}

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

public void updateEnIntensifier(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnIntensifierBuff Buff) {
    final String S_ProcName = "updateEnIntensifier";
    ResultSet resultSet = null;/*w  ww.ja  v a 2s  . c o m*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFEnSyntaxEnIntensifierBuff> buffList = new LinkedList<CFEnSyntaxEnIntensifierBuff>();
    try {
        String ClassCode = Buff.getClassCode();
        long Id = Buff.getRequiredId();
        Long ScopeId = Buff.getOptionalScopeId();
        String Name = Buff.getRequiredName();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx
                .prepareCall("begin " + schema.getLowerDbSchemaName() + ".upd_enintens( ?, ?, ?, ?, ?, ?, ?"
                        + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); end;");
        int argIdx = 1;
        stmtUpdateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtUpdateByPKey.setString(argIdx++, ClassCode);
        stmtUpdateByPKey.setLong(argIdx++, Id);
        if (ScopeId != null) {
            stmtUpdateByPKey.setLong(argIdx++, ScopeId.longValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtUpdateByPKey.setString(argIdx++, Name);
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
        if (resultSet != null) {
            try {
                if (resultSet.next()) {
                    CFEnSyntaxEnIntensifierBuff updatedBuff = unpackEnIntensifierResultSetToBuff(resultSet);
                    if (resultSet.next()) {
                        resultSet.last();
                        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                                "Did not expect multi-record response, " + resultSet.getRow()
                                        + " rows selected");
                    }
                    Buff.setOptionalScopeId(updatedBuff.getOptionalScopeId());
                    Buff.setRequiredName(updatedBuff.getRequiredName());
                    Buff.setRequiredRevision(updatedBuff.getRequiredRevision());
                } else {
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Expected a single-record response, " + resultSet.getRow() + " rows selected");
                }
            } catch (SQLException e) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "upd_enintens() did not return a valid result cursor");
            } finally {
                if (resultSet != null) {
                    try {
                        resultSet.close();
                    } catch (SQLException e) {
                    }
                    resultSet = null;
                }
            }
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "upd_enintens() did not return a result cursor");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtUpdateByPKey != null) {
            try {
                stmtUpdateByPKey.close();
            } catch (SQLException e) {
            }
            stmtUpdateByPKey = null;
        }
    }
}

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

public CFSecuritySecUserBuff readBuffByDefDevIdx(CFSecurityAuthorization Authorization,
        UUID DefaultDevSecUserId, String DefaultDevName) {
    final String S_ProcName = "readBuffByDefDevIdx";
    ResultSet resultSet = null;/* ww  w  .  java2s. c  om*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByDefDevIdx = null;
    try {
        stmtReadBuffByDefDevIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_secuserbydefdevidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByDefDevIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByDefDevIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByDefDevIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByDefDevIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByDefDevIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByDefDevIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (DefaultDevSecUserId != null) {
            stmtReadBuffByDefDevIdx.setString(argIdx++, DefaultDevSecUserId.toString());
        } else {
            stmtReadBuffByDefDevIdx.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (DefaultDevName != null) {
            stmtReadBuffByDefDevIdx.setString(argIdx++, DefaultDevName);
        } else {
            stmtReadBuffByDefDevIdx.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtReadBuffByDefDevIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByDefDevIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFSecuritySecUserBuff buff = unpackSecUserResultSetToBuff(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 (stmtReadBuffByDefDevIdx != null) {
            try {
                stmtReadBuffByDefDevIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByDefDevIdx = null;
        }
    }
}

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

public CFAccAttachmentBuff[] readBuffByMimeTypeIdx(CFAccAuthorization Authorization, Integer MimeTypeId) {
    final String S_ProcName = "readBuffByMimeTypeIdx";
    ResultSet resultSet = null;/* ww w .  j  a va  2 s  .  c  o  m*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByMimeTypeIdx = null;
    List<CFAccAttachmentBuff> buffList = new LinkedList<CFAccAttachmentBuff>();
    try {
        stmtReadBuffByMimeTypeIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_attchmntbymimetypeidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByMimeTypeIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByMimeTypeIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByMimeTypeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByMimeTypeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByMimeTypeIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByMimeTypeIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (MimeTypeId != null) {
            stmtReadBuffByMimeTypeIdx.setInt(argIdx++, MimeTypeId.intValue());
        } else {
            stmtReadBuffByMimeTypeIdx.setNull(argIdx++, java.sql.Types.INTEGER);
        }
        stmtReadBuffByMimeTypeIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByMimeTypeIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFAccAttachmentBuff buff = unpackAttachmentResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFAccAttachmentBuff[] retBuff = new CFAccAttachmentBuff[buffList.size()];
        Iterator<CFAccAttachmentBuff> 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 (stmtReadBuffByMimeTypeIdx != null) {
            try {
                stmtReadBuffByMimeTypeIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByMimeTypeIdx = null;
        }
    }
}

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

public CFAccContactURLBuff[] readBuffByProtocolIdx(CFAccAuthorization Authorization, Short URLProtocolId) {
    final String S_ProcName = "readBuffByProtocolIdx";
    ResultSet resultSet = null;/*w  ww .  j a v  a  2 s .  com*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByProtocolIdx = null;
    List<CFAccContactURLBuff> buffList = new LinkedList<CFAccContactURLBuff>();
    try {
        stmtReadBuffByProtocolIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_ctcurlbyprotocolidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByProtocolIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByProtocolIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByProtocolIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByProtocolIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByProtocolIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByProtocolIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (URLProtocolId != null) {
            stmtReadBuffByProtocolIdx.setShort(argIdx++, URLProtocolId.shortValue());
        } else {
            stmtReadBuffByProtocolIdx.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        stmtReadBuffByProtocolIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByProtocolIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFAccContactURLBuff buff = unpackContactURLResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFAccContactURLBuff[] retBuff = new CFAccContactURLBuff[buffList.size()];
        Iterator<CFAccContactURLBuff> 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 (stmtReadBuffByProtocolIdx != null) {
            try {
                stmtReadBuffByProtocolIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByProtocolIdx = null;
        }
    }
}

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

public CFSecuritySecUserBuff[] readBuffByEMConfIdx(CFSecurityAuthorization Authorization,
        UUID EMailConfirmationUuid) {
    final String S_ProcName = "readBuffByEMConfIdx";
    ResultSet resultSet = null;//from   ww w . j a v  a 2 s  .  c  om
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByEMConfIdx = null;
    List<CFSecuritySecUserBuff> buffList = new LinkedList<CFSecuritySecUserBuff>();
    try {
        stmtReadBuffByEMConfIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_secuserbyemconfidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByEMConfIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByEMConfIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByEMConfIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByEMConfIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByEMConfIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByEMConfIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (EMailConfirmationUuid != null) {
            stmtReadBuffByEMConfIdx.setString(argIdx++, EMailConfirmationUuid.toString());
        } else {
            stmtReadBuffByEMConfIdx.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtReadBuffByEMConfIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByEMConfIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFSecuritySecUserBuff buff = unpackSecUserResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFSecuritySecUserBuff[] retBuff = new CFSecuritySecUserBuff[buffList.size()];
        Iterator<CFSecuritySecUserBuff> 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 (stmtReadBuffByEMConfIdx != null) {
            try {
                stmtReadBuffByEMConfIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByEMConfIdx = null;
        }
    }
}

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

public void createVersion(CFSecurityAuthorization Authorization, CFInternetVersionBuff Buff) {
    final String S_ProcName = "createVersion";
    ResultSet resultSet = null;//w ww  . j a v a2 s  . com
    CallableStatement stmtCreateByPKey = null;
    try {
        String ClassCode = Buff.getClassCode();
        long TenantId = Buff.getRequiredTenantId();
        String Description = Buff.getOptionalDescription();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".crt_verndef( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); 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);
        stmtCreateByPKey.setLong(argIdx++, TenantId);
        if (Description != null) {
            stmtCreateByPKey.setString(argIdx++, Description);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_verndef() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFInternetVersionBuff createdBuff = unpackVersionResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                Buff.setRequiredTenantId(createdBuff.getRequiredTenantId());
                Buff.setRequiredId(createdBuff.getRequiredId());
                Buff.setOptionalDescription(createdBuff.getOptionalDescription());
                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_verndef() 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.CFAccOracleTagTable.java

public void updateTag(CFAccAuthorization Authorization, CFAccTagBuff Buff) {
    final String S_ProcName = "updateTag";
    ResultSet resultSet = null;/*w w w.  j av  a 2 s  . c  om*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtUpdateByPKey = null;
    List<CFAccTagBuff> buffList = new LinkedList<CFAccTagBuff>();
    try {
        long TenantId = Buff.getRequiredTenantId();
        long Id = Buff.getRequiredId();
        String Name = Buff.getRequiredName();
        String Descr = Buff.getOptionalDescr();
        int Revision = Buff.getRequiredRevision();
        stmtUpdateByPKey = cnx
                .prepareCall("begin " + schema.getLowerSchemaDbName() + ".upd_tag( ?, ?, ?, ?, ?, ?, ?" + ", "
                        + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); end;");
        int argIdx = 1;
        stmtUpdateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtUpdateByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtUpdateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtUpdateByPKey.setString(argIdx++, "CTAG");
        stmtUpdateByPKey.setLong(argIdx++, TenantId);
        stmtUpdateByPKey.setLong(argIdx++, Id);
        stmtUpdateByPKey.setString(argIdx++, Name);
        if (Descr != null) {
            stmtUpdateByPKey.setString(argIdx++, Descr);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
        if (resultSet != null) {
            try {
                if (resultSet.next()) {
                    CFAccTagBuff updatedBuff = unpackTagResultSetToBuff(resultSet);
                    if (resultSet.next()) {
                        resultSet.last();
                        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                                "Did not expect multi-record response, " + resultSet.getRow()
                                        + " rows selected");
                    }
                    Buff.setRequiredName(updatedBuff.getRequiredName());
                    Buff.setOptionalDescr(updatedBuff.getOptionalDescr());
                    Buff.setRequiredRevision(updatedBuff.getRequiredRevision());
                } else {
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Expected a single-record response, " + resultSet.getRow() + " rows selected");
                }
            } catch (SQLException e) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "upd_tag() did not return a valid result cursor");
            } finally {
                if (resultSet != null) {
                    try {
                        resultSet.close();
                    } catch (SQLException e) {
                    }
                    resultSet = null;
                }
            }
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "upd_tag() did not return a result cursor");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtUpdateByPKey != null) {
            try {
                stmtUpdateByPKey.close();
            } catch (SQLException e) {
            }
            stmtUpdateByPKey = null;
        }
    }
}

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

public void createRealProject(CFSecurityAuthorization Authorization, CFInternetRealProjectBuff Buff) {
    final String S_ProcName = "createRealProject";
    ResultSet resultSet = null;/*  www . j a  va  2 s  . c  o m*/
    CallableStatement stmtCreateByPKey = null;
    try {
        String ClassCode = Buff.getClassCode();
        long TenantId = Buff.getRequiredTenantId();
        String Description = Buff.getOptionalDescription();
        Connection cnx = schema.getCnx();
        stmtCreateByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".crt_rprjdef( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); 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);
        stmtCreateByPKey.setLong(argIdx++, TenantId);
        if (Description != null) {
            stmtCreateByPKey.setString(argIdx++, Description);
        } else {
            stmtCreateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtCreateByPKey.execute();
        resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "crt_rprjdef() did not return a result set");
        }
        try {
            if (resultSet.next()) {
                CFInternetRealProjectBuff createdBuff = unpackRealProjectResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                Buff.setRequiredTenantId(createdBuff.getRequiredTenantId());
                Buff.setRequiredId(createdBuff.getRequiredId());
                Buff.setOptionalDescription(createdBuff.getOptionalDescription());
                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_rprjdef() 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_2.CFAstOracle.CFAstOracleSecUserTable.java

public CFAstSecUserBuff[] readBuffByEMConfIdx(CFAstAuthorization Authorization, UUID EMailConfirmationUuid) {
    final String S_ProcName = "readBuffByEMConfIdx";
    ResultSet resultSet = null;/*from  w ww .j  a va  2s . c  om*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByEMConfIdx = null;
    List<CFAstSecUserBuff> buffList = new LinkedList<CFAstSecUserBuff>();
    try {
        stmtReadBuffByEMConfIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_secuserbyemconfidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByEMConfIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByEMConfIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByEMConfIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByEMConfIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByEMConfIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByEMConfIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (EMailConfirmationUuid != null) {
            stmtReadBuffByEMConfIdx.setString(argIdx++, EMailConfirmationUuid.toString());
        } else {
            stmtReadBuffByEMConfIdx.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtReadBuffByEMConfIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByEMConfIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFAstSecUserBuff buff = unpackSecUserResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFAstSecUserBuff[] retBuff = new CFAstSecUserBuff[buffList.size()];
        Iterator<CFAstSecUserBuff> 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 (stmtReadBuffByEMConfIdx != null) {
            try {
                stmtReadBuffByEMConfIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByEMConfIdx = null;
        }
    }
}