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:helma.objectmodel.db.NodeManager.java

private void setStatementValue(PreparedStatement stmt, int stmtNumber, Property p, int columnType)
        throws SQLException {
    if (p.getValue() == null) {
        stmt.setNull(stmtNumber, columnType);
    } else {/*from  w  w w.j  a  va 2s.  co m*/
        switch (columnType) {
        case Types.BIT:
        case Types.BOOLEAN:
            stmt.setBoolean(stmtNumber, p.getBooleanValue());

            break;

        case Types.TINYINT:
        case Types.BIGINT:
        case Types.SMALLINT:
        case Types.INTEGER:
            stmt.setLong(stmtNumber, p.getIntegerValue());

            break;

        case Types.REAL:
        case Types.FLOAT:
        case Types.DOUBLE:
        case Types.NUMERIC:
        case Types.DECIMAL:
            stmt.setDouble(stmtNumber, p.getFloatValue());

            break;

        case Types.LONGVARBINARY:
        case Types.VARBINARY:
        case Types.BINARY:
        case Types.BLOB:
            Object b = p.getJavaObjectValue();
            if (b instanceof byte[]) {
                byte[] buf = (byte[]) b;
                try {
                    stmt.setBytes(stmtNumber, buf);
                } catch (SQLException x) {
                    ByteArrayInputStream bout = new ByteArrayInputStream(buf);
                    stmt.setBinaryStream(stmtNumber, bout, buf.length);
                }
            } else {
                throw new SQLException(
                        "expected byte[] for binary column '" + p.getName() + "', found " + b.getClass());
            }

            break;

        case Types.LONGVARCHAR:
            try {
                stmt.setString(stmtNumber, p.getStringValue());
            } catch (SQLException x) {
                String str = p.getStringValue();
                Reader r = new StringReader(str);
                stmt.setCharacterStream(stmtNumber, r, str.length());
            }

            break;

        case Types.CLOB:
            String val = p.getStringValue();
            Reader isr = new StringReader(val);
            stmt.setCharacterStream(stmtNumber, isr, val.length());

            break;

        case Types.CHAR:
        case Types.VARCHAR:
        case Types.OTHER:
            stmt.setString(stmtNumber, p.getStringValue());

            break;

        case Types.DATE:
        case Types.TIME:
        case Types.TIMESTAMP:
            stmt.setTimestamp(stmtNumber, p.getTimestampValue());

            break;

        case Types.NULL:
            stmt.setNull(stmtNumber, 0);

            break;

        default:
            stmt.setString(stmtNumber, p.getStringValue());

            break;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMySql.CFAccMySqlAccountConfigTable.java

public void deleteAccountConfigByEmpCtcLstIdx(CFAccAuthorization Authorization, Long argEmpContactListTenantId,
        Long argEmpContactListId) {
    final String S_ProcName = "deleteAccountConfigByEmpCtcLstIdx";
    ResultSet resultSet = null;//from  w  ww . j  a v  a2 s.com
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerSchemaDbName()
                + ".sp_delete_acct_cfg_by_empctclstidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )";
        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);
        }
        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.cfacc.v2_0.CFAccPgSql.CFAccPgSqlAccountConfigTable.java

public void deleteAccountConfigByEmpCtcLstIdx(CFAccAuthorization Authorization, Long argEmpContactListTenantId,
        Long argEmpContactListId) {
    final String S_ProcName = "deleteAccountConfigByEmpCtcLstIdx";
    ResultSet resultSet = null;//from   www . j  a  v  a 2  s . co  m
    try {
        Connection cnx = schema.getCnx();
        String sql = "SELECT " + schema.getLowerSchemaDbName()
                + ".sp_delete_acct_cfg_by_empctclstidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?"
                + " ) as DeletedFlag";
        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);
        }
        resultSet = stmtDeleteByEmpCtcLstIdx.executeQuery();
        if (resultSet.next()) {
            boolean deleteFlag = resultSet.getBoolean(1);
            if (resultSet.next()) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response");
            }
        } 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.CFAccDb2LUW.CFAccDb2LUWAccountConfigTable.java

public void deleteAccountConfigByEmpCtcLstIdx(CFAccAuthorization Authorization, Long argEmpContactListTenantId,
        Long argEmpContactListId) {
    final String S_ProcName = "deleteAccountConfigByEmpCtcLstIdx";
    ResultSet resultSet = null;// ww w .  jav a2 s  .  c  o m
    try {
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_delete_acct_cfg_by_empctclstidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?"
                + " )";
        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);
        }
        resultSet = stmtDeleteByEmpCtcLstIdx.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.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlEnglishParseTable.java

public CFEnSyntaxEnglishParseBuff[] readBuffByScopeIdx(CFEnSyntaxAuthorization Authorization, Long ScopeId) {
    final String S_ProcName = "readBuffByScopeIdx";
    ResultSet resultSet = null;/*from  www . j a va 2s  .com*/
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerDbSchemaName() + ".sp_read_enparse_by_scopeidx( ?, ?, ?, ?, ?"
                + ", " + "?" + " )";
        if (stmtReadBuffByScopeIdx == null) {
            stmtReadBuffByScopeIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        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);
        }
        try {
            resultSet = stmtReadBuffByScopeIdx.executeQuery();
        } catch (SQLException e) {
            if (e.getErrorCode() != 1329) {
                throw e;
            }
            resultSet = null;
        }
        List<CFEnSyntaxEnglishParseBuff> buffList = new LinkedList<CFEnSyntaxEnglishParseBuff>();
        while ((resultSet != null) && resultSet.next()) {
            CFEnSyntaxEnglishParseBuff buff = unpackEnglishParseResultSetToBuff(resultSet);
            buffList.add(buff);
        }
        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;
        }
    }
}

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

public void deleteAccountConfigByEmpCtcLstIdx(CFAccAuthorization Authorization, Long argEmpContactListTenantId,
        Long argEmpContactListId) {
    final String S_ProcName = "deleteAccountConfigByEmpCtcLstIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//from  w  ww .ja  v  a  2s .c o  m
    ResultSet resultSet = null;
    try {
        Connection cnx = schema.getCnx();
        String sql = "exec sp_delete_acct_cfg_by_empctclstidx ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?";
        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);
        }
        Object stuff = null;
        boolean moreResults = stmtDeleteByEmpCtcLstIdx.execute();
        while (stuff == null) {
            try {
                moreResults = stmtDeleteByEmpCtcLstIdx.getMoreResults();
            } catch (SQLException e) {
                throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
            }
            if (moreResults) {
                try {
                    stuff = stmtDeleteByEmpCtcLstIdx.getResultSet();
                } catch (SQLException e) {
                }
            } else if (-1 == stmtDeleteByEmpCtcLstIdx.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.CFAccMySql.CFAccMySqlAccountConfigTable.java

public void deleteAccountConfigByVendCtcLstIdx(CFAccAuthorization Authorization,
        Long argVendContactListTenantId, Long argVendContactListId) {
    final String S_ProcName = "deleteAccountConfigByVendCtcLstIdx";
    ResultSet resultSet = null;/* w w w.j a v  a  2s  .c om*/
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerSchemaDbName()
                + ".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);
        }
        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.cfacc.v2_0.CFAccOracle.CFAccOracleAccountConfigTable.java

public void deleteAccountConfigByCustCtcLstIdx(CFAccAuthorization Authorization,
        Long argCustContactListTenantId, Long argCustContactListId) {
    final String S_ProcName = "deleteAccountConfigByCustCtcLstIdx";
    ResultSet resultSet = null;/*www.java 2s .co m*/
    try {
        Connection cnx = schema.getCnx();
        String sql = "begin call " + schema.getLowerSchemaDbName()
                + ".dl_acct_cfgbycustctclstidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end";
        if (stmtDeleteByCustCtcLstIdx == null) {
            stmtDeleteByCustCtcLstIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByCustCtcLstIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByCustCtcLstIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByCustCtcLstIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByCustCtcLstIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByCustCtcLstIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (argCustContactListTenantId != null) {
            stmtDeleteByCustCtcLstIdx.setLong(argIdx++, argCustContactListTenantId.longValue());
        } else {
            stmtDeleteByCustCtcLstIdx.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        if (argCustContactListId != null) {
            stmtDeleteByCustCtcLstIdx.setLong(argIdx++, argCustContactListId.longValue());
        } else {
            stmtDeleteByCustCtcLstIdx.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        int rowsUpdated = stmtDeleteByCustCtcLstIdx.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.CFEnSyntaxMySql.CFEnSyntaxMySqlEnglishParseTable.java

public CFEnSyntaxEnglishParseBuff readBuffByUNameIdx(CFEnSyntaxAuthorization Authorization, Long ScopeId,
        String Name) {//w  w  w  . ja  v  a  2s  . com
    final String S_ProcName = "readBuffByUNameIdx";
    ResultSet resultSet = null;
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerDbSchemaName() + ".sp_read_enparse_by_unameidx( ?, ?, ?, ?, ?"
                + ", " + "?" + ", " + "?" + " )";
        if (stmtReadBuffByUNameIdx == null) {
            stmtReadBuffByUNameIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        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);
        try {
            resultSet = stmtReadBuffByUNameIdx.executeQuery();
        } catch (SQLException e) {
            if (e.getErrorCode() != 1329) {
                throw e;
            }
            resultSet = null;
        }
        if ((resultSet != null) && resultSet.next()) {
            CFEnSyntaxEnglishParseBuff buff = 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");
            }
            return (buff);
        } else {
            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;
        }
    }
}

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

public void deleteAccountConfigByVendCtcLstIdx(CFAccAuthorization Authorization,
        Long argVendContactListTenantId, Long argVendContactListId) {
    final String S_ProcName = "deleteAccountConfigByVendCtcLstIdx";
    ResultSet resultSet = null;//from  w ww  .j a  v  a2s  . c  om
    try {
        Connection cnx = schema.getCnx();
        String sql = "SELECT " + schema.getLowerSchemaDbName()
                + ".sp_delete_acct_cfg_by_vendctclstidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?"
                + " ) as DeletedFlag";
        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()) {
            boolean deleteFlag = resultSet.getBoolean(1);
            if (resultSet.next()) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response");
            }
        } 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;
        }
    }
}