Example usage for java.sql Types BIGINT

List of usage examples for java.sql Types BIGINT

Introduction

In this page you can find the example usage for java.sql Types BIGINT.

Prototype

int BIGINT

To view the source code for java.sql Types BIGINT.

Click Source Link

Document

The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type BIGINT.

Usage

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWAccountConfigTable.java

public void deleteAccountConfigByVendCtcLstIdx(CFAccAuthorization Authorization,
        Long argVendContactListTenantId, Long argVendContactListId) {
    final String S_ProcName = "deleteAccountConfigByVendCtcLstIdx";
    ResultSet resultSet = null;//from  w  w  w .ja  v  a2  s  . c  om
    try {
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_delete_acct_cfg_by_vendctclstidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?"
                + " )";
        if (stmtDeleteByVendCtcLstIdx == null) {
            stmtDeleteByVendCtcLstIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByVendCtcLstIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByVendCtcLstIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByVendCtcLstIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByVendCtcLstIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByVendCtcLstIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (argVendContactListTenantId != null) {
            stmtDeleteByVendCtcLstIdx.setLong(argIdx++, argVendContactListTenantId.longValue());
        } else {
            stmtDeleteByVendCtcLstIdx.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        if (argVendContactListId != null) {
            stmtDeleteByVendCtcLstIdx.setLong(argIdx++, argVendContactListId.longValue());
        } else {
            stmtDeleteByVendCtcLstIdx.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        resultSet = stmtDeleteByVendCtcLstIdx.executeQuery();
        if (resultSet.next()) {
            int deleteFlag = resultSet.getInt(1);
            if (resultSet.next()) {
                resultSet.last();
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
            }
        } else {
            throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                    "Expected 1 record result set to be returned by delete, not 0 rows");
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMSSql.CFAccMSSqlAccountConfigTable.java

public void deleteAccountConfigByVendCtcLstIdx(CFAccAuthorization Authorization,
        Long argVendContactListTenantId, Long argVendContactListId) {
    final String S_ProcName = "deleteAccountConfigByVendCtcLstIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from w  w w.j  av a 2 s .c om*/
    ResultSet resultSet = null;
    try {
        Connection cnx = schema.getCnx();
        String sql = "exec sp_delete_acct_cfg_by_vendctclstidx ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?";
        if (stmtDeleteByVendCtcLstIdx == null) {
            stmtDeleteByVendCtcLstIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByVendCtcLstIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByVendCtcLstIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByVendCtcLstIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByVendCtcLstIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByVendCtcLstIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (argVendContactListTenantId != null) {
            stmtDeleteByVendCtcLstIdx.setLong(argIdx++, argVendContactListTenantId.longValue());
        } else {
            stmtDeleteByVendCtcLstIdx.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        if (argVendContactListId != null) {
            stmtDeleteByVendCtcLstIdx.setLong(argIdx++, argVendContactListId.longValue());
        } else {
            stmtDeleteByVendCtcLstIdx.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        Object stuff = null;
        boolean moreResults = stmtDeleteByVendCtcLstIdx.execute();
        while (stuff == null) {
            try {
                moreResults = stmtDeleteByVendCtcLstIdx.getMoreResults();
            } catch (SQLException e) {
                throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
            }
            if (moreResults) {
                try {
                    stuff = stmtDeleteByVendCtcLstIdx.getResultSet();
                } catch (SQLException e) {
                }
            } else if (-1 == stmtDeleteByVendCtcLstIdx.getUpdateCount()) {
                break;
            }
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWAccountEntryTable.java

public void updateAccountEntry(CFAccAuthorization Authorization, CFAccAccountEntryBuff Buff) {
    final String S_ProcName = "updateAccountEntry";
    if ("ACNY".equals(Buff.getClassCode())
            && (!schema.isTenantUser(Authorization, Buff.getRequiredTenantId(), "UpdateAccountEntry"))) {
        throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                "Permission denied -- User not part of TSecGroup UpdateAccountEntry");
    }// w ww  .j a v a 2s . c  o m
    ResultSet resultSet = null;
    try {
        long TenantId = Buff.getRequiredTenantId();
        long AccountId = Buff.getRequiredAccountId();
        UUID EntryId = Buff.getRequiredEntryId();
        UUID SplitEntryId = Buff.getOptionalSplitEntryId();
        Calendar EntryStamp = Buff.getRequiredEntryStamp();
        String Description = Buff.getRequiredDescription();
        Long TransferTenantId = Buff.getOptionalTransferTenantId();
        Long TransferAccountId = Buff.getOptionalTransferAccountId();
        Short DebitCurrencyId = Buff.getOptionalDebitCurrencyId();
        BigDecimal Debit = Buff.getOptionalDebit();
        Short CreditCurrencyId = Buff.getOptionalCreditCurrencyId();
        BigDecimal Credit = Buff.getOptionalCredit();
        short ConvertedCurrencyId = Buff.getRequiredConvertedCurrencyId();
        BigDecimal ConvertedAmount = Buff.getRequiredConvertedAmount();
        short BalanceCurrencyId = Buff.getRequiredBalanceCurrencyId();
        BigDecimal Balance = Buff.getRequiredBalance();
        int Revision = Buff.getRequiredRevision();
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_update_ac_entry( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "TIMESTAMP_FORMAT( ?, 'YYYY-MM-DD-HH24.MI.SS' )" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + " )";
        if (stmtUpdateByPKey == null) {
            stmtUpdateByPKey = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        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++, "ACNY");
        stmtUpdateByPKey.setLong(argIdx++, TenantId);
        stmtUpdateByPKey.setLong(argIdx++, AccountId);
        stmtUpdateByPKey.setString(argIdx++, EntryId.toString());
        if (SplitEntryId != null) {
            stmtUpdateByPKey.setString(argIdx++, SplitEntryId.toString());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtUpdateByPKey.setString(argIdx++, CFAccDb2LUWSchema.getTimestampString(EntryStamp));
        stmtUpdateByPKey.setString(argIdx++, Description);
        if (TransferTenantId != null) {
            stmtUpdateByPKey.setLong(argIdx++, TransferTenantId.longValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        if (TransferAccountId != null) {
            stmtUpdateByPKey.setLong(argIdx++, TransferAccountId.longValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        if (DebitCurrencyId != null) {
            stmtUpdateByPKey.setShort(argIdx++, DebitCurrencyId.shortValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        if (Debit != null) {
            stmtUpdateByPKey.setBigDecimal(argIdx++, Debit);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.NUMERIC);
        }
        if (CreditCurrencyId != null) {
            stmtUpdateByPKey.setShort(argIdx++, CreditCurrencyId.shortValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        if (Credit != null) {
            stmtUpdateByPKey.setBigDecimal(argIdx++, Credit);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.NUMERIC);
        }
        stmtUpdateByPKey.setShort(argIdx++, ConvertedCurrencyId);
        stmtUpdateByPKey.setBigDecimal(argIdx++, ConvertedAmount);
        stmtUpdateByPKey.setShort(argIdx++, BalanceCurrencyId);
        stmtUpdateByPKey.setBigDecimal(argIdx++, Balance);
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        resultSet = stmtUpdateByPKey.executeQuery();
        if (resultSet.next()) {
            CFAccAccountEntryBuff updatedBuff = unpackAccountEntryResultSetToBuff(resultSet);
            if (resultSet.next()) {
                resultSet.last();
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
            }
            Buff.setOptionalSplitEntryId(updatedBuff.getOptionalSplitEntryId());
            Buff.setRequiredEntryStamp(updatedBuff.getRequiredEntryStamp());
            Buff.setRequiredDescription(updatedBuff.getRequiredDescription());
            Buff.setOptionalTransferTenantId(updatedBuff.getOptionalTransferTenantId());
            Buff.setOptionalTransferAccountId(updatedBuff.getOptionalTransferAccountId());
            Buff.setOptionalDebitCurrencyId(updatedBuff.getOptionalDebitCurrencyId());
            Buff.setOptionalDebit(updatedBuff.getOptionalDebit());
            Buff.setOptionalCreditCurrencyId(updatedBuff.getOptionalCreditCurrencyId());
            Buff.setOptionalCredit(updatedBuff.getOptionalCredit());
            Buff.setRequiredConvertedCurrencyId(updatedBuff.getRequiredConvertedCurrencyId());
            Buff.setRequiredConvertedAmount(updatedBuff.getRequiredConvertedAmount());
            Buff.setRequiredBalanceCurrencyId(updatedBuff.getRequiredBalanceCurrencyId());
            Buff.setRequiredBalance(updatedBuff.getRequiredBalance());
            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().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccPgSql.CFAccPgSqlAccountEntryTable.java

public void updateAccountEntry(CFAccAuthorization Authorization, CFAccAccountEntryBuff Buff) {
    final String S_ProcName = "updateAccountEntry";
    ResultSet resultSet = null;/* ww w  . j a v  a  2  s.c  om*/
    try {
        long TenantId = Buff.getRequiredTenantId();
        long AccountId = Buff.getRequiredAccountId();
        UUID EntryId = Buff.getRequiredEntryId();
        UUID SplitEntryId = Buff.getOptionalSplitEntryId();
        Calendar EntryStamp = Buff.getRequiredEntryStamp();
        String Description = Buff.getRequiredDescription();
        Long TransferTenantId = Buff.getOptionalTransferTenantId();
        Long TransferAccountId = Buff.getOptionalTransferAccountId();
        Short DebitCurrencyId = Buff.getOptionalDebitCurrencyId();
        BigDecimal Debit = Buff.getOptionalDebit();
        Short CreditCurrencyId = Buff.getOptionalCreditCurrencyId();
        BigDecimal Credit = Buff.getOptionalCredit();
        short ConvertedCurrencyId = Buff.getRequiredConvertedCurrencyId();
        BigDecimal ConvertedAmount = Buff.getRequiredConvertedAmount();
        short BalanceCurrencyId = Buff.getRequiredBalanceCurrencyId();
        BigDecimal Balance = Buff.getRequiredBalance();
        int Revision = Buff.getRequiredRevision();
        Connection cnx = schema.getCnx();
        String sql = "select * from " + schema.getLowerSchemaDbName() + ".sp_update_ac_entry( ?, ?, ?, ?, ?, ?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                + "cast( to_timestamp( ?, 'YYYY-MM-DD HH24:MI:SS' ) as timestamp )" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + " )";
        if (stmtUpdateByPKey == null) {
            stmtUpdateByPKey = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        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++, "ACNY");
        stmtUpdateByPKey.setLong(argIdx++, TenantId);
        stmtUpdateByPKey.setLong(argIdx++, AccountId);
        stmtUpdateByPKey.setString(argIdx++, EntryId.toString());
        if (SplitEntryId != null) {
            stmtUpdateByPKey.setString(argIdx++, SplitEntryId.toString());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtUpdateByPKey.setString(argIdx++, CFAccPgSqlSchema.getTimestampString(EntryStamp));
        stmtUpdateByPKey.setString(argIdx++, Description);
        if (TransferTenantId != null) {
            stmtUpdateByPKey.setLong(argIdx++, TransferTenantId.longValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        if (TransferAccountId != null) {
            stmtUpdateByPKey.setLong(argIdx++, TransferAccountId.longValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        if (DebitCurrencyId != null) {
            stmtUpdateByPKey.setShort(argIdx++, DebitCurrencyId.shortValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        if (Debit != null) {
            stmtUpdateByPKey.setBigDecimal(argIdx++, Debit);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.NUMERIC);
        }
        if (CreditCurrencyId != null) {
            stmtUpdateByPKey.setShort(argIdx++, CreditCurrencyId.shortValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        if (Credit != null) {
            stmtUpdateByPKey.setBigDecimal(argIdx++, Credit);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.NUMERIC);
        }
        stmtUpdateByPKey.setShort(argIdx++, ConvertedCurrencyId);
        stmtUpdateByPKey.setBigDecimal(argIdx++, ConvertedAmount);
        stmtUpdateByPKey.setShort(argIdx++, BalanceCurrencyId);
        stmtUpdateByPKey.setBigDecimal(argIdx++, Balance);
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        resultSet = stmtUpdateByPKey.executeQuery();
        if (resultSet.next()) {
            CFAccAccountEntryBuff updatedBuff = unpackAccountEntryResultSetToBuff(resultSet);
            if (resultSet.next()) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response");
            }
            Buff.setOptionalSplitEntryId(updatedBuff.getOptionalSplitEntryId());
            Buff.setRequiredEntryStamp(updatedBuff.getRequiredEntryStamp());
            Buff.setRequiredDescription(updatedBuff.getRequiredDescription());
            Buff.setOptionalTransferTenantId(updatedBuff.getOptionalTransferTenantId());
            Buff.setOptionalTransferAccountId(updatedBuff.getOptionalTransferAccountId());
            Buff.setOptionalDebitCurrencyId(updatedBuff.getOptionalDebitCurrencyId());
            Buff.setOptionalDebit(updatedBuff.getOptionalDebit());
            Buff.setOptionalCreditCurrencyId(updatedBuff.getOptionalCreditCurrencyId());
            Buff.setOptionalCredit(updatedBuff.getOptionalCredit());
            Buff.setRequiredConvertedCurrencyId(updatedBuff.getRequiredConvertedCurrencyId());
            Buff.setRequiredConvertedAmount(updatedBuff.getRequiredConvertedAmount());
            Buff.setRequiredBalanceCurrencyId(updatedBuff.getRequiredBalanceCurrencyId());
            Buff.setRequiredBalance(updatedBuff.getRequiredBalance());
            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().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}

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

public void deleteAccountConfigByEmpCtcLstIdx(CFAccAuthorization Authorization, Long argEmpContactListTenantId,
        Long argEmpContactListId) {
    final String S_ProcName = "deleteAccountConfigByEmpCtcLstIdx";
    ResultSet resultSet = null;//from   w ww .ja  v a2 s  .  c o m
    try {
        Connection cnx = schema.getCnx();
        String sql = "begin call " + schema.getLowerSchemaDbName() + ".dl_acct_cfgbyempctclstidx( ?, ?, ?, ?, ?"
                + ", " + "?" + ", " + "?" + " ); end";
        if (stmtDeleteByEmpCtcLstIdx == null) {
            stmtDeleteByEmpCtcLstIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByEmpCtcLstIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByEmpCtcLstIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByEmpCtcLstIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByEmpCtcLstIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByEmpCtcLstIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (argEmpContactListTenantId != null) {
            stmtDeleteByEmpCtcLstIdx.setLong(argIdx++, argEmpContactListTenantId.longValue());
        } else {
            stmtDeleteByEmpCtcLstIdx.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        if (argEmpContactListId != null) {
            stmtDeleteByEmpCtcLstIdx.setLong(argIdx++, argEmpContactListId.longValue());
        } else {
            stmtDeleteByEmpCtcLstIdx.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        int rowsUpdated = stmtDeleteByEmpCtcLstIdx.executeUpdate();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}

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

public CFEnSyntaxEnglishParseBuff[] readBuffByScopeIdx(CFEnSyntaxAuthorization Authorization, Long ScopeId) {
    final String S_ProcName = "readBuffByScopeIdx";
    ResultSet resultSet = null;//from  w  w w .java  2  s . c  om
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByScopeIdx = null;
    List<CFEnSyntaxEnglishParseBuff> buffList = new LinkedList<CFEnSyntaxEnglishParseBuff>();
    try {
        stmtReadBuffByScopeIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_enparsebyscopeidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByScopeIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByScopeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByScopeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (ScopeId != null) {
            stmtReadBuffByScopeIdx.setLong(argIdx++, ScopeId.longValue());
        } else {
            stmtReadBuffByScopeIdx.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtReadBuffByScopeIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByScopeIdx.getObject(1);
        if (resultSet != null) {
            try {
                while (resultSet.next()) {
                    CFEnSyntaxEnglishParseBuff buff = unpackEnglishParseResultSetToBuff(resultSet);
                    buffList.add(buff);
                }
                try {
                    resultSet.close();
                } catch (SQLException e) {
                }
                resultSet = null;
            } catch (SQLException e) {
            }
        }
        int idx = 0;
        CFEnSyntaxEnglishParseBuff[] retBuff = new CFEnSyntaxEnglishParseBuff[buffList.size()];
        Iterator<CFEnSyntaxEnglishParseBuff> 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 (stmtReadBuffByScopeIdx != null) {
            try {
                stmtReadBuffByScopeIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByScopeIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlEnglishParseTable.java

public void updateEnglishParse(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnglishParseBuff Buff) {
    final String S_ProcName = "updateEnglishParse";
    ResultSet resultSet = null;//from   w  ww . j  a v a  2 s . c  o m
    try {
        String ClassCode = Buff.getClassCode();
        long Id = Buff.getRequiredId();
        Long ScopeId = Buff.getOptionalScopeId();
        String Name = Buff.getRequiredName();
        int Revision = Buff.getRequiredRevision();
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerDbSchemaName() + ".sp_update_enparse( ?, ?, ?, ?, ?, ?" + ", "
                + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )";
        if (stmtUpdateByPKey == null) {
            stmtUpdateByPKey = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        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);
        try {
            resultSet = stmtUpdateByPKey.executeQuery();
        } catch (SQLException e) {
            if (e.getErrorCode() != 1329) {
                throw e;
            }
            resultSet = null;
        }
        if ((resultSet != null) && resultSet.next()) {
            CFEnSyntaxEnglishParseBuff updatedBuff = unpackEnglishParseResultSetToBuff(resultSet);
            if ((resultSet != null) && 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().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMSSql.CFAccMSSqlAccountEntryTable.java

public void updateAccountEntry(CFAccAuthorization Authorization, CFAccAccountEntryBuff Buff) {
    final String S_ProcName = "updateAccountEntry";
    ResultSet resultSet = null;//w w w. j  av a 2s . co  m
    try {
        long TenantId = Buff.getRequiredTenantId();
        long AccountId = Buff.getRequiredAccountId();
        UUID EntryId = Buff.getRequiredEntryId();
        UUID SplitEntryId = Buff.getOptionalSplitEntryId();
        Calendar EntryStamp = Buff.getRequiredEntryStamp();
        String Description = Buff.getRequiredDescription();
        Long TransferTenantId = Buff.getOptionalTransferTenantId();
        Long TransferAccountId = Buff.getOptionalTransferAccountId();
        Short DebitCurrencyId = Buff.getOptionalDebitCurrencyId();
        BigDecimal Debit = Buff.getOptionalDebit();
        Short CreditCurrencyId = Buff.getOptionalCreditCurrencyId();
        BigDecimal Credit = Buff.getOptionalCredit();
        short ConvertedCurrencyId = Buff.getRequiredConvertedCurrencyId();
        BigDecimal ConvertedAmount = Buff.getRequiredConvertedAmount();
        short BalanceCurrencyId = Buff.getRequiredBalanceCurrencyId();
        BigDecimal Balance = Buff.getRequiredBalance();
        int Revision = Buff.getRequiredRevision();
        Connection cnx = schema.getCnx();
        String sql = "exec sp_update_ac_entry ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?";
        if (stmtUpdateByPKey == null) {
            stmtUpdateByPKey = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        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++, "ACNY");
        stmtUpdateByPKey.setLong(argIdx++, TenantId);
        stmtUpdateByPKey.setLong(argIdx++, AccountId);
        stmtUpdateByPKey.setString(argIdx++, EntryId.toString());
        if (SplitEntryId != null) {
            stmtUpdateByPKey.setString(argIdx++, SplitEntryId.toString());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtUpdateByPKey.setString(argIdx++, CFAccMSSqlSchema.getTimestampString(EntryStamp));
        stmtUpdateByPKey.setString(argIdx++, Description);
        if (TransferTenantId != null) {
            stmtUpdateByPKey.setLong(argIdx++, TransferTenantId.longValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        if (TransferAccountId != null) {
            stmtUpdateByPKey.setLong(argIdx++, TransferAccountId.longValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        if (DebitCurrencyId != null) {
            stmtUpdateByPKey.setShort(argIdx++, DebitCurrencyId.shortValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        if (Debit != null) {
            stmtUpdateByPKey.setBigDecimal(argIdx++, Debit);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.NUMERIC);
        }
        if (CreditCurrencyId != null) {
            stmtUpdateByPKey.setShort(argIdx++, CreditCurrencyId.shortValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        if (Credit != null) {
            stmtUpdateByPKey.setBigDecimal(argIdx++, Credit);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.NUMERIC);
        }
        stmtUpdateByPKey.setShort(argIdx++, ConvertedCurrencyId);
        stmtUpdateByPKey.setBigDecimal(argIdx++, ConvertedAmount);
        stmtUpdateByPKey.setShort(argIdx++, BalanceCurrencyId);
        stmtUpdateByPKey.setBigDecimal(argIdx++, Balance);
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        stmtUpdateByPKey.execute();
        boolean moreResults = true;
        resultSet = null;
        while (resultSet == null) {
            try {
                moreResults = stmtUpdateByPKey.getMoreResults();
            } catch (SQLException e) {
                throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
            }
            if (moreResults) {
                try {
                    resultSet = stmtUpdateByPKey.getResultSet();
                } catch (SQLException e) {
                }
            } else if (-1 == stmtUpdateByPKey.getUpdateCount()) {
                break;
            }
        }
        if (resultSet == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "resultSet");
        }
        if (resultSet.next()) {
            CFAccAccountEntryBuff updatedBuff = unpackAccountEntryResultSetToBuff(resultSet);
            if (resultSet.next()) {
                resultSet.last();
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
            }
            Buff.setOptionalSplitEntryId(updatedBuff.getOptionalSplitEntryId());
            Buff.setRequiredEntryStamp(updatedBuff.getRequiredEntryStamp());
            Buff.setRequiredDescription(updatedBuff.getRequiredDescription());
            Buff.setOptionalTransferTenantId(updatedBuff.getOptionalTransferTenantId());
            Buff.setOptionalTransferAccountId(updatedBuff.getOptionalTransferAccountId());
            Buff.setOptionalDebitCurrencyId(updatedBuff.getOptionalDebitCurrencyId());
            Buff.setOptionalDebit(updatedBuff.getOptionalDebit());
            Buff.setOptionalCreditCurrencyId(updatedBuff.getOptionalCreditCurrencyId());
            Buff.setOptionalCredit(updatedBuff.getOptionalCredit());
            Buff.setRequiredConvertedCurrencyId(updatedBuff.getRequiredConvertedCurrencyId());
            Buff.setRequiredConvertedAmount(updatedBuff.getRequiredConvertedAmount());
            Buff.setRequiredBalanceCurrencyId(updatedBuff.getRequiredBalanceCurrencyId());
            Buff.setRequiredBalance(updatedBuff.getRequiredBalance());
            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().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}

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

public void deleteAccountConfigByVendCtcLstIdx(CFAccAuthorization Authorization,
        Long argVendContactListTenantId, Long argVendContactListId) {
    final String S_ProcName = "deleteAccountConfigByVendCtcLstIdx";
    ResultSet resultSet = null;//from   w  ww  .  jav a  2  s.  co  m
    try {
        Connection cnx = schema.getCnx();
        String sql = "begin call " + schema.getLowerSchemaDbName()
                + ".dl_acct_cfgbyvendctclstidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end";
        if (stmtDeleteByVendCtcLstIdx == null) {
            stmtDeleteByVendCtcLstIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByVendCtcLstIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByVendCtcLstIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByVendCtcLstIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByVendCtcLstIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByVendCtcLstIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (argVendContactListTenantId != null) {
            stmtDeleteByVendCtcLstIdx.setLong(argIdx++, argVendContactListTenantId.longValue());
        } else {
            stmtDeleteByVendCtcLstIdx.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        if (argVendContactListId != null) {
            stmtDeleteByVendCtcLstIdx.setLong(argIdx++, argVendContactListId.longValue());
        } else {
            stmtDeleteByVendCtcLstIdx.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        int rowsUpdated = stmtDeleteByVendCtcLstIdx.executeUpdate();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}

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

public CFEnSyntaxEnglishParseBuff readBuffByUNameIdx(CFEnSyntaxAuthorization Authorization, Long ScopeId,
        String Name) {/*from ww  w.j av a2  s.  co  m*/
    final String S_ProcName = "readBuffByUNameIdx";
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByUNameIdx = null;
    try {
        stmtReadBuffByUNameIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_enparsebyunameidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByUNameIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByUNameIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUNameIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (ScopeId != null) {
            stmtReadBuffByUNameIdx.setLong(argIdx++, ScopeId.longValue());
        } else {
            stmtReadBuffByUNameIdx.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtReadBuffByUNameIdx.setString(argIdx++, Name);
        stmtReadBuffByUNameIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByUNameIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFEnSyntaxEnglishParseBuff buff = unpackEnglishParseResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByUNameIdx != null) {
            try {
                stmtReadBuffByUNameIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByUNameIdx = null;
        }
    }
}