Example usage for java.sql Types INTEGER

List of usage examples for java.sql Types INTEGER

Introduction

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

Prototype

int INTEGER

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

Click Source Link

Document

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

Usage

From source file:nl.ordina.bag.etl.dao.AbstractBAGDAO.java

@Override
public void update(final Nummeraanduiding nummeraanduiding) throws DAOException {
    try {//from www.  j  a v a2  s . c o  m
        jdbcTemplate.update(new PreparedStatementCreator() {
            @Override
            public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
                PreparedStatement ps = connection.prepareStatement("update bag_nummeraanduiding set"
                        + " aanduiding_record_inactief = ?," + " huisnummer = ?," + " officieel = ?,"
                        + " huisletter = ?," + " huisnummertoevoeging = ?," + " postcode = ?,"
                        + " einddatum_tijdvak_geldigheid = ?," + " in_onderzoek = ?,"
                        + " type_adresseerbaar_object = ?," + " bron_documentdatum = ?,"
                        + " bron_documentnummer = ?," + " nummeraanduiding_status = ?,"
                        + " bag_woonplaats_id = ?," + " bag_openbare_ruimte_id = ?"
                        + " where bag_nummeraanduiding_id = ?" + " and aanduiding_record_correctie = ?"
                        + " and begindatum_tijdvak_geldigheid = ?");
                ps.setInt(1, nummeraanduiding.getAanduidingRecordInactief().ordinal());
                ps.setInt(2, nummeraanduiding.getHuisnummer());
                ps.setInt(3, nummeraanduiding.getOfficieel().ordinal());
                if (nummeraanduiding.getHuisletter() == null)
                    ps.setNull(4, Types.INTEGER);
                else
                    ps.setString(4, nummeraanduiding.getHuisletter());
                if (nummeraanduiding.getHuisnummertoevoeging() == null)
                    ps.setNull(5, Types.VARCHAR);
                else
                    ps.setString(5, nummeraanduiding.getHuisnummertoevoeging());
                if (nummeraanduiding.getPostcode() == null)
                    ps.setNull(6, Types.VARCHAR);
                else
                    ps.setString(6, nummeraanduiding.getPostcode());
                if (nummeraanduiding.getEinddatumTijdvakGeldigheid() == null)
                    ps.setNull(7, Types.TIMESTAMP);
                else
                    ps.setTimestamp(7,
                            new Timestamp(nummeraanduiding.getEinddatumTijdvakGeldigheid().getTime()));
                ps.setInt(8, nummeraanduiding.getInOnderzoek().ordinal());
                ps.setInt(9, nummeraanduiding.getTypeAdresseerbaarObject().ordinal());
                ps.setDate(10, new Date(nummeraanduiding.getDocumentdatum().getTime()));
                ps.setString(11, nummeraanduiding.getDocumentnummer());
                ps.setInt(12, nummeraanduiding.getNummeraanduidingStatus().ordinal());
                if (nummeraanduiding.getGerelateerdeWoonplaats() == null)
                    ps.setNull(13, Types.INTEGER);
                else
                    ps.setLong(13, nummeraanduiding.getGerelateerdeWoonplaats());
                ps.setLong(14, nummeraanduiding.getGerelateerdeOpenbareRuimte());
                ps.setLong(15, nummeraanduiding.getIdentificatie());
                ps.setLong(16, nummeraanduiding.getAanduidingRecordCorrectie());
                ps.setTimestamp(17, new Timestamp(nummeraanduiding.getBegindatumTijdvakGeldigheid().getTime()));
                return ps;
            }
        });
    } catch (DataAccessException e) {
        throw new DAOException("Error updating nummeraanduiding: " + nummeraanduiding.getIdentificatie(), e);
    }
}

From source file:com.zimbra.cs.db.DbMailItem.java

public void update(MailItem item, Metadata metadata) throws ServiceException {
    String name = item.getName().isEmpty() ? null : item.getName();
    checkNamingConstraint(mailbox, item.getFolderId(), name, item.getId());

    DbConnection conn = mailbox.getOperationConnection();
    PreparedStatement stmt = null;
    try {//from  w  w  w.  j  av  a  2 s. c om
        stmt = conn.prepareStatement("UPDATE " + getMailItemTableName(item)
                + " SET type = ?, imap_id = ?, index_id = ?, parent_id = ?, date = ?, size = ?, flags = ?,"
                + "  blob_digest = ?, sender = ?, recipients = ?, subject = ?, name = ?,"
                + "  metadata = ?, mod_metadata = ?, change_date = ?, mod_content = ?, locator = ?" + " WHERE "
                + IN_THIS_MAILBOX_AND + "id = ?");
        int pos = 1;
        stmt.setByte(pos++, item.getType().toByte());
        if (item.getImapUid() >= 0) {
            stmt.setInt(pos++, item.getImapUid());
        } else {
            stmt.setNull(pos++, Types.INTEGER);
        }
        if (item.getIndexStatus() == MailItem.IndexStatus.NO) {
            stmt.setNull(pos++, Types.INTEGER);
        } else {
            stmt.setInt(pos++, item.getIndexId());
        }
        // messages in virtual conversations are stored with a null parent_id
        if (item.getParentId() <= 0) {
            stmt.setNull(pos++, Types.INTEGER);
        } else {
            stmt.setInt(pos++, item.getParentId());
        }
        stmt.setInt(pos++, (int) (item.getDate() / 1000));
        stmt.setLong(pos++, item.getSize());
        stmt.setLong(pos++, item.getInternalFlagBitmask());
        stmt.setString(pos++, item.getDigest());
        stmt.setString(pos++, item.getSortSender());
        stmt.setString(pos++, item.getSortRecipients());
        stmt.setString(pos++, item.getSortSubject());
        stmt.setString(pos++, name);
        stmt.setString(pos++, checkMetadataLength(metadata.toString()));
        stmt.setInt(pos++, mailbox.getOperationChangeID());
        stmt.setInt(pos++, mailbox.getOperationTimestamp());
        stmt.setInt(pos++, item.getSavedSequence());
        stmt.setString(pos++, item.getLocator());
        pos = setMailboxId(stmt, mailbox, pos);
        stmt.setInt(pos++, item.getId());
        stmt.executeUpdate();

        if (mailbox.isItemModified(item, Change.FLAGS)) {
            DbTag.updateTagReferences(mailbox, item.getId(), item.getType(), item.getInternalFlagBitmask(),
                    item.isUnread(), item.getTags());
        }
    } catch (SQLException e) {
        // catch item_id uniqueness constraint violation and return failure
        if (Db.errorMatches(e, Db.Error.DUPLICATE_ROW)) {
            throw MailServiceException.ALREADY_EXISTS(item.getName(), e);
        } else {
            throw ServiceException
                    .FAILURE("Failed to update item mbox=" + mailbox.getId() + ",id=" + item.getId(), e);
        }
    } finally {
        DbPool.closeStatement(stmt);
    }
}

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

public void deleteAttachmentByMimeTypeIdx(CFAccAuthorization Authorization, Integer argMimeTypeId) {
    final String S_ProcName = "deleteAttachmentByMimeTypeIdx";
    ResultSet resultSet = null;/*from ww  w . j  a v a2 s.  com*/
    try {
        Connection cnx = schema.getCnx();
        String sql = "begin call " + schema.getLowerSchemaDbName() + ".dl_attchmntbymimetypeidx( ?, ?, ?, ?, ?"
                + ", " + "?" + " ); end";
        if (stmtDeleteByMimeTypeIdx == null) {
            stmtDeleteByMimeTypeIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByMimeTypeIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByMimeTypeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByMimeTypeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByMimeTypeIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByMimeTypeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (argMimeTypeId != null) {
            stmtDeleteByMimeTypeIdx.setInt(argIdx++, argMimeTypeId.intValue());
        } else {
            stmtDeleteByMimeTypeIdx.setNull(argIdx++, java.sql.Types.INTEGER);
        }
        int rowsUpdated = stmtDeleteByMimeTypeIdx.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.cfcore.v2_0.CFGenKbMySql.CFGenKbMySqlGelModifierTable.java

public void updateGelModifier(CFGenKbAuthorization Authorization, CFGenKbGelModifierBuff Buff) {
    final String S_ProcName = "updateGelModifier";
    ResultSet resultSet = null;/*  w w w .  ja v  a2s.  c o m*/
    try {
        String ClassCode = Buff.getClassCode();
        long TenantId = Buff.getRequiredTenantId();
        long CartridgeId = Buff.getRequiredCartridgeId();
        int GelInstId = Buff.getRequiredGelInstId();
        Integer CallerId = Buff.getOptionalCallerId();
        Integer PrevId = Buff.getOptionalPrevId();
        Integer NextId = Buff.getOptionalNextId();
        String SourceText = Buff.getRequiredSourceText();
        Integer FirstInstId = Buff.getOptionalFirstInstId();
        Integer LastInstId = Buff.getOptionalLastInstId();
        Integer RemainderInstId = Buff.getOptionalRemainderInstId();
        int Revision = Buff.getRequiredRevision();
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerSchemaDbName() + ".sp_update_gelmodifier( ?, ?, ?, ?, ?, ?" + ", "
                + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + " )";
        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++, TenantId);
        stmtUpdateByPKey.setLong(argIdx++, CartridgeId);
        stmtUpdateByPKey.setInt(argIdx++, GelInstId);
        if (CallerId != null) {
            stmtUpdateByPKey.setInt(argIdx++, CallerId.intValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.INTEGER);
        }
        if (PrevId != null) {
            stmtUpdateByPKey.setInt(argIdx++, PrevId.intValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.INTEGER);
        }
        if (NextId != null) {
            stmtUpdateByPKey.setInt(argIdx++, NextId.intValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.INTEGER);
        }
        stmtUpdateByPKey.setString(argIdx++, SourceText);
        if (FirstInstId != null) {
            stmtUpdateByPKey.setInt(argIdx++, FirstInstId.intValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.INTEGER);
        }
        if (LastInstId != null) {
            stmtUpdateByPKey.setInt(argIdx++, LastInstId.intValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.INTEGER);
        }
        if (RemainderInstId != null) {
            stmtUpdateByPKey.setInt(argIdx++, RemainderInstId.intValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.INTEGER);
        }
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        try {
            resultSet = stmtUpdateByPKey.executeQuery();
        } catch (SQLException e) {
            if (e.getErrorCode() != 1329) {
                throw e;
            }
            resultSet = null;
        }
        if ((resultSet != null) && resultSet.next()) {
            CFGenKbGelModifierBuff updatedBuff = unpackGelModifierResultSetToBuff(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.setOptionalCallerId(updatedBuff.getOptionalCallerId());
            Buff.setOptionalPrevId(updatedBuff.getOptionalPrevId());
            Buff.setOptionalNextId(updatedBuff.getOptionalNextId());
            Buff.setRequiredSourceText(updatedBuff.getRequiredSourceText());
            Buff.setOptionalFirstInstId(updatedBuff.getOptionalFirstInstId());
            Buff.setOptionalLastInstId(updatedBuff.getOptionalLastInstId());
            Buff.setOptionalRemainderInstId(updatedBuff.getOptionalRemainderInstId());
            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:com.manydesigns.portofino.actions.admin.appwizard.ApplicationWizard.java

protected void detectBooleanColumn(Table table, Column column) {
    if (detectedBooleanColumns.contains(column)) {
        return;// www .j  a  va 2  s.c o m
    }

    if (column.getJdbcType() == Types.INTEGER || column.getJdbcType() == Types.DECIMAL
            || column.getJdbcType() == Types.NUMERIC) {
        logger.info("Detecting whether numeric column " + column.getQualifiedName()
                + " is boolean by examining " + "its values...");

        // Detect booleans
        Connection connection = null;

        try {
            connection = connectionProvider.acquireConnection();
            liquibase.database.Database implementation = DatabaseFactory.getInstance()
                    .findCorrectDatabaseImplementation(new JdbcConnection(connection));
            String sql = "select count(" + implementation.escapeDatabaseObject(column.getColumnName()) + ") "
                    + "from " + implementation.escapeTableName(table.getSchemaName(), table.getTableName());
            PreparedStatement statement = connection.prepareStatement(sql);
            setQueryTimeout(statement, 1);
            statement.setMaxRows(1);
            ResultSet rs = statement.executeQuery();
            Long count = null;
            if (rs.next()) {
                count = safeGetLong(rs, 1);
            }

            if (count == null || count < 10) {
                logger.info("Cannot determine if numeric column {} is boolean, count is {}",
                        column.getQualifiedName(), count);
                return;
            }

            sql = "select distinct(" + implementation.escapeDatabaseObject(column.getColumnName()) + ") "
                    + "from " + implementation.escapeTableName(table.getSchemaName(), table.getTableName());
            statement = connection.prepareStatement(sql);
            setQueryTimeout(statement, 1);
            statement.setMaxRows(3);
            rs = statement.executeQuery();
            int valueCount = 0;
            boolean only0and1 = true;
            while (rs.next()) {
                valueCount++;
                if (valueCount > 2) {
                    only0and1 = false;
                    break;
                }
                Long value = safeGetLong(rs, 1);
                only0and1 &= value != null && (value == 0 || value == 1);
            }
            if (only0and1 && valueCount == 2) {
                logger.info("Column appears to be of boolean type.");
                column.setJavaType(Boolean.class.getName());
            } else {
                logger.info("Column appears not to be of boolean type.");
            }
            statement.close();
        } catch (Exception e) {
            logger.debug("Could not determine whether column " + column.getQualifiedName() + " is boolean", e);
            logger.info("Could not determine whether column " + column.getQualifiedName() + " is boolean");
        } finally {
            try {
                if (connection != null) {
                    connection.close();
                }
            } catch (SQLException e) {
                logger.error("Could not close connection", e);
            }
        }
        detectedBooleanColumns.add(column);
    }
}

From source file:com.enonic.vertical.engine.handlers.MenuHandler.java

private void removeShortcut(int menuItemKey) throws VerticalRemoveException {
    StringBuffer sql = XDG.generateUpdateSQL(db.tMenuItem,
            new Column[] { db.tMenuItem.mei_mei_lShortcut, db.tMenuItem.mei_bShortcutForward },
            new Column[] { db.tMenuItem.mei_lKey }, null);
    Connection con = null;/*from  www  .j  av  a 2s  . c om*/
    PreparedStatement prepStmt = null;
    try {
        con = getConnection();
        prepStmt = con.prepareStatement(sql.toString());
        prepStmt.setNull(1, Types.INTEGER);
        prepStmt.setNull(2, Types.INTEGER);
        prepStmt.setInt(3, menuItemKey);
        prepStmt.executeUpdate();
    } catch (SQLException sqle) {
        String message = "Failed to create menu item shortcut: %t";
        VerticalEngineLogger.errorCreate(this.getClass(), 0, message, sqle);
    } finally {
        close(con);
        close(prepStmt);
    }
}

From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbMySql.CFGenKbMySqlGelPopTable.java

public void deleteGelPopByCallerIdx(CFGenKbAuthorization Authorization, long argTenantId, long argCartridgeId,
        Integer argCallerId) {//from   w  w  w .  java  2s.com
    final String S_ProcName = "deleteGelPopByCallerIdx";
    ResultSet resultSet = null;
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerSchemaDbName() + ".sp_delete_gelpop_by_calleridx( ?, ?, ?, ?, ?"
                + ", " + "?" + ", " + "?" + ", " + "?" + " )";
        if (stmtDeleteByCallerIdx == null) {
            stmtDeleteByCallerIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByCallerIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByCallerIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByCallerIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByCallerIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByCallerIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByCallerIdx.setLong(argIdx++, argTenantId);
        stmtDeleteByCallerIdx.setLong(argIdx++, argCartridgeId);
        if (argCallerId != null) {
            stmtDeleteByCallerIdx.setInt(argIdx++, argCallerId.intValue());
        } else {
            stmtDeleteByCallerIdx.setNull(argIdx++, java.sql.Types.INTEGER);
        }
        stmtDeleteByCallerIdx.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.cfcore.v2_0.CFGenKbMySql.CFGenKbMySqlGelReferenceTable.java

public void deleteGelReferenceByCallerIdx(CFGenKbAuthorization Authorization, long argTenantId,
        long argCartridgeId, Integer argCallerId) {
    final String S_ProcName = "deleteGelReferenceByCallerIdx";
    ResultSet resultSet = null;//from   w  ww  .j a  va 2 s  .  c o m
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerSchemaDbName() + ".sp_delete_gelrefer_by_calleridx( ?, ?, ?, ?, ?"
                + ", " + "?" + ", " + "?" + ", " + "?" + " )";
        if (stmtDeleteByCallerIdx == null) {
            stmtDeleteByCallerIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByCallerIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByCallerIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByCallerIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByCallerIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByCallerIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByCallerIdx.setLong(argIdx++, argTenantId);
        stmtDeleteByCallerIdx.setLong(argIdx++, argCartridgeId);
        if (argCallerId != null) {
            stmtDeleteByCallerIdx.setInt(argIdx++, argCallerId.intValue());
        } else {
            stmtDeleteByCallerIdx.setNull(argIdx++, java.sql.Types.INTEGER);
        }
        stmtDeleteByCallerIdx.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.cfcore.v2_0.CFGenKbMySql.CFGenKbMySqlGelPrefixLineTable.java

public void deleteGelPrefixLineByCallerIdx(CFGenKbAuthorization Authorization, long argTenantId,
        long argCartridgeId, Integer argCallerId) {
    final String S_ProcName = "deleteGelPrefixLineByCallerIdx";
    ResultSet resultSet = null;//  ww w  .ja  v  a2 s  .c  o m
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerSchemaDbName()
                + ".sp_delete_gelprefix_by_calleridx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?"
                + " )";
        if (stmtDeleteByCallerIdx == null) {
            stmtDeleteByCallerIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByCallerIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByCallerIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByCallerIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByCallerIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByCallerIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByCallerIdx.setLong(argIdx++, argTenantId);
        stmtDeleteByCallerIdx.setLong(argIdx++, argCartridgeId);
        if (argCallerId != null) {
            stmtDeleteByCallerIdx.setInt(argIdx++, argCallerId.intValue());
        } else {
            stmtDeleteByCallerIdx.setNull(argIdx++, java.sql.Types.INTEGER);
        }
        stmtDeleteByCallerIdx.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.cfcore.v2_0.CFGenKbOracle.CFGenKbOracleGelExpansionTable.java

public void deleteGelExpansionByCallerIdx(CFGenKbAuthorization Authorization, long argTenantId,
        long argCartridgeId, Integer argCallerId) {
    final String S_ProcName = "deleteGelExpansionByCallerIdx";
    ResultSet resultSet = null;//from   www  . j  a  va2 s  . c om
    try {
        Connection cnx = schema.getCnx();
        String sql = "begin call " + schema.getLowerSchemaDbName()
                + ".dl_gelexpansionbycalleridx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?"
                + " ); end";
        if (stmtDeleteByCallerIdx == null) {
            stmtDeleteByCallerIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByCallerIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByCallerIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByCallerIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByCallerIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByCallerIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByCallerIdx.setLong(argIdx++, argTenantId);
        stmtDeleteByCallerIdx.setLong(argIdx++, argCartridgeId);
        if (argCallerId != null) {
            stmtDeleteByCallerIdx.setInt(argIdx++, argCallerId.intValue());
        } else {
            stmtDeleteByCallerIdx.setNull(argIdx++, java.sql.Types.INTEGER);
        }
        int rowsUpdated = stmtDeleteByCallerIdx.executeUpdate();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}