Example usage for java.lang Short shortValue

List of usage examples for java.lang Short shortValue

Introduction

In this page you can find the example usage for java.lang Short shortValue.

Prototype

@HotSpotIntrinsicCandidate
public short shortValue() 

Source Link

Document

Returns the value of this Short as a short .

Usage

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSybase.CFAsteriskSybaseISOLanguageTable.java

public void updateISOLanguage(CFSecurityAuthorization Authorization, CFSecurityISOLanguageBuff Buff) {
    final String S_ProcName = "updateISOLanguage";
    ResultSet resultSet = null;/*ww  w  .  j av a  2 s  . c  om*/
    try {
        short Id = Buff.getRequiredId();
        String ISOCode = Buff.getRequiredISOCode();
        String BaseLanguageCode = Buff.getRequiredBaseLanguageCode();
        Short ISOCountryId = Buff.getOptionalISOCountryId();
        int Revision = Buff.getRequiredRevision();
        Connection cnx = schema.getCnx();
        String sql = "exec sp_update_iso_lang ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                + "?" + ", " + "?";
        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++, "ISLN");
        stmtUpdateByPKey.setShort(argIdx++, Id);
        stmtUpdateByPKey.setString(argIdx++, ISOCode);
        stmtUpdateByPKey.setString(argIdx++, BaseLanguageCode);
        if (ISOCountryId != null) {
            stmtUpdateByPKey.setShort(argIdx++, ISOCountryId.shortValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        resultSet = stmtUpdateByPKey.executeQuery();
        if (resultSet.next()) {
            CFSecurityISOLanguageBuff updatedBuff = unpackISOLanguageResultSetToBuff(resultSet);
            if (resultSet.next()) {
                resultSet.last();
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
            }
            Buff.setRequiredISOCode(updatedBuff.getRequiredISOCode());
            Buff.setRequiredBaseLanguageCode(updatedBuff.getRequiredBaseLanguageCode());
            Buff.setOptionalISOCountryId(updatedBuff.getOptionalISOCountryId());
            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.cfasterisk.v2_1.CFAstSybase.CFAstSybaseISOLanguageTable.java

public void updateISOLanguage(CFAstAuthorization Authorization, CFAstISOLanguageBuff Buff) {
    final String S_ProcName = "updateISOLanguage";
    ResultSet resultSet = null;//  w  ww. j  a va2 s.co  m
    try {
        short Id = Buff.getRequiredId();
        String ISOCode = Buff.getRequiredISOCode();
        String BaseLanguageCode = Buff.getRequiredBaseLanguageCode();
        Short ISOCountryId = Buff.getOptionalISOCountryId();
        int Revision = Buff.getRequiredRevision();
        Connection cnx = schema.getCnx();
        String sql = "exec sp_update_iso_lang ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                + "?" + ", " + "?";
        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++, "ISLN");
        stmtUpdateByPKey.setShort(argIdx++, Id);
        stmtUpdateByPKey.setString(argIdx++, ISOCode);
        stmtUpdateByPKey.setString(argIdx++, BaseLanguageCode);
        if (ISOCountryId != null) {
            stmtUpdateByPKey.setShort(argIdx++, ISOCountryId.shortValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        resultSet = stmtUpdateByPKey.executeQuery();
        if (resultSet.next()) {
            CFAstISOLanguageBuff updatedBuff = unpackISOLanguageResultSetToBuff(resultSet);
            if (resultSet.next()) {
                resultSet.last();
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
            }
            Buff.setRequiredISOCode(updatedBuff.getRequiredISOCode());
            Buff.setRequiredBaseLanguageCode(updatedBuff.getRequiredBaseLanguageCode());
            Buff.setOptionalISOCountryId(updatedBuff.getOptionalISOCountryId());
            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.cfcrm.v2_1.CFCrmMSSql.CFCrmMSSqlContactURLTable.java

public CFCrmContactURLBuff[] readBuffByProtocolIdx(CFCrmAuthorization Authorization, Short URLProtocolId) {
    final String S_ProcName = "readBuffByProtocolIdx";
    ResultSet resultSet = null;/*www. j  a  v  a2 s .com*/
    try {
        Connection cnx = schema.getCnx();
        String sql = "{ call sp_read_ctcurl_by_protocolidx( ?, ?, ?, ?, ?" + ", " + "?" + " ) }";
        if (stmtReadBuffByProtocolIdx == null) {
            stmtReadBuffByProtocolIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtReadBuffByProtocolIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByProtocolIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByProtocolIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByProtocolIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByProtocolIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (URLProtocolId != null) {
            stmtReadBuffByProtocolIdx.setShort(argIdx++, URLProtocolId.shortValue());
        } else {
            stmtReadBuffByProtocolIdx.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        resultSet = stmtReadBuffByProtocolIdx.executeQuery();
        List<CFCrmContactURLBuff> buffList = new LinkedList<CFCrmContactURLBuff>();
        if (resultSet != null) {
            while (resultSet.next()) {
                CFCrmContactURLBuff buff = unpackContactURLResultSetToBuff(resultSet);
                buffList.add(buff);
            }
        }
        int idx = 0;
        CFCrmContactURLBuff[] retBuff = new CFCrmContactURLBuff[buffList.size()];
        Iterator<CFCrmContactURLBuff> 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.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlISOLanguageTable.java

public void updateISOLanguage(CFEnSyntaxAuthorization Authorization, CFEnSyntaxISOLanguageBuff Buff) {
    final String S_ProcName = "updateISOLanguage";
    ResultSet resultSet = null;/*from  ww w  .  j a  va 2 s . com*/
    try {
        short Id = Buff.getRequiredId();
        String ISOCode = Buff.getRequiredISOCode();
        String BaseLanguageCode = Buff.getRequiredBaseLanguageCode();
        Short ISOCountryId = Buff.getOptionalISOCountryId();
        int Revision = Buff.getRequiredRevision();
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerDbSchemaName() + ".sp_update_iso_lang( ?, ?, ?, ?, ?, ?" + ", "
                + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )";
        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++, "ISLN");
        stmtUpdateByPKey.setShort(argIdx++, Id);
        stmtUpdateByPKey.setString(argIdx++, ISOCode);
        stmtUpdateByPKey.setString(argIdx++, BaseLanguageCode);
        if (ISOCountryId != null) {
            stmtUpdateByPKey.setShort(argIdx++, ISOCountryId.shortValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        try {
            resultSet = stmtUpdateByPKey.executeQuery();
        } catch (SQLException e) {
            if (e.getErrorCode() != 1329) {
                throw e;
            }
            resultSet = null;
        }
        if ((resultSet != null) && resultSet.next()) {
            CFEnSyntaxISOLanguageBuff updatedBuff = unpackISOLanguageResultSetToBuff(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.setRequiredISOCode(updatedBuff.getRequiredISOCode());
            Buff.setRequiredBaseLanguageCode(updatedBuff.getRequiredBaseLanguageCode());
            Buff.setOptionalISOCountryId(updatedBuff.getOptionalISOCountryId());
            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.cfensyntax.v2_2.CFEnSyntaxMSSql.CFEnSyntaxMSSqlISOLanguageTable.java

public void updateISOLanguage(CFEnSyntaxAuthorization Authorization, CFEnSyntaxISOLanguageBuff Buff) {
    final String S_ProcName = "updateISOLanguage";
    ResultSet resultSet = null;//from  w  w  w . jav a2  s  .com
    try {
        short Id = Buff.getRequiredId();
        String ISOCode = Buff.getRequiredISOCode();
        String BaseLanguageCode = Buff.getRequiredBaseLanguageCode();
        Short ISOCountryId = Buff.getOptionalISOCountryId();
        int Revision = Buff.getRequiredRevision();
        Connection cnx = schema.getCnx();
        String sql = "exec sp_update_iso_lang ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                + "?" + ", " + "?";
        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++, "ISLN");
        stmtUpdateByPKey.setShort(argIdx++, Id);
        stmtUpdateByPKey.setString(argIdx++, ISOCode);
        stmtUpdateByPKey.setString(argIdx++, BaseLanguageCode);
        if (ISOCountryId != null) {
            stmtUpdateByPKey.setShort(argIdx++, ISOCountryId.shortValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        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()) {
            CFEnSyntaxISOLanguageBuff updatedBuff = unpackISOLanguageResultSetToBuff(resultSet);
            if (resultSet.next()) {
                resultSet.last();
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
            }
            Buff.setRequiredISOCode(updatedBuff.getRequiredISOCode());
            Buff.setRequiredBaseLanguageCode(updatedBuff.getRequiredBaseLanguageCode());
            Buff.setOptionalISOCountryId(updatedBuff.getOptionalISOCountryId());
            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.cfcrm.v2_1.CFCrmMySql.CFCrmMySqlContactURLTable.java

public CFCrmContactURLBuff[] readBuffByProtocolIdx(CFCrmAuthorization Authorization, Short URLProtocolId) {
    final String S_ProcName = "readBuffByProtocolIdx";
    ResultSet resultSet = null;//from w w w. j a  v a 2  s. co  m
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerDbSchemaName() + ".sp_read_ctcurl_by_protocolidx( ?, ?, ?, ?, ?"
                + ", " + "?" + " )";
        if (stmtReadBuffByProtocolIdx == null) {
            stmtReadBuffByProtocolIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtReadBuffByProtocolIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByProtocolIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByProtocolIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByProtocolIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByProtocolIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (URLProtocolId != null) {
            stmtReadBuffByProtocolIdx.setShort(argIdx++, URLProtocolId.shortValue());
        } else {
            stmtReadBuffByProtocolIdx.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        try {
            resultSet = stmtReadBuffByProtocolIdx.executeQuery();
        } catch (SQLException e) {
            if (e.getErrorCode() != 1329) {
                throw e;
            }
            resultSet = null;
        }
        List<CFCrmContactURLBuff> buffList = new LinkedList<CFCrmContactURLBuff>();
        while ((resultSet != null) && resultSet.next()) {
            CFCrmContactURLBuff buff = unpackContactURLResultSetToBuff(resultSet);
            buffList.add(buff);
        }
        int idx = 0;
        CFCrmContactURLBuff[] retBuff = new CFCrmContactURLBuff[buffList.size()];
        Iterator<CFCrmContactURLBuff> 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.cfcrm.v2_1.CFCrmMySql.CFCrmMySqlAddressTable.java

public void deleteAddressByCountryIdx(CFCrmAuthorization Authorization, Short argCountryId) {
    final String S_ProcName = "deleteAddressByCountryIdx";
    ResultSet resultSet = null;/*from  w ww  .j  av  a 2  s .c o m*/
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerDbSchemaName() + ".sp_delete_address_by_countryidx( ?, ?, ?, ?, ?"
                + ", " + "?" + " )";
        if (stmtDeleteByCountryIdx == null) {
            stmtDeleteByCountryIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByCountryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByCountryIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByCountryIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByCountryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByCountryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (argCountryId != null) {
            stmtDeleteByCountryIdx.setShort(argIdx++, argCountryId.shortValue());
        } else {
            stmtDeleteByCountryIdx.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        stmtDeleteByCountryIdx.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.CFAccPgSqlContactURLTable.java

public void deleteContactURLByProtocolIdx(CFAccAuthorization Authorization, Short argURLProtocolId) {
    final String S_ProcName = "deleteContactURLByProtocolIdx";
    ResultSet resultSet = null;/*from  w w w  .j  a  v a  2s.c o m*/
    try {
        Connection cnx = schema.getCnx();
        String sql = "SELECT " + schema.getLowerSchemaDbName()
                + ".sp_delete_ctcurl_by_protocolidx( ?, ?, ?, ?, ?" + ", " + "?" + " ) as DeletedFlag";
        if (stmtDeleteByProtocolIdx == null) {
            stmtDeleteByProtocolIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByProtocolIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByProtocolIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByProtocolIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByProtocolIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByProtocolIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (argURLProtocolId != null) {
            stmtDeleteByProtocolIdx.setShort(argIdx++, argURLProtocolId.shortValue());
        } else {
            stmtDeleteByProtocolIdx.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        resultSet = stmtDeleteByProtocolIdx.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.CFAccMSSql.CFAccMSSqlContactURLTable.java

public CFAccContactURLBuff[] readBuffByProtocolIdx(CFAccAuthorization Authorization, Short URLProtocolId) {
    final String S_ProcName = "readBuffByProtocolIdx";
    ResultSet resultSet = null;// w  ww  .  ja v  a  2s  .c  o  m
    try {
        Connection cnx = schema.getCnx();
        String sql = "{ call sp_read_ctcurl_by_protocolidx( ?, ?, ?, ?, ?" + ", " + "?" + " ) }";
        if (stmtReadBuffByProtocolIdx == null) {
            stmtReadBuffByProtocolIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtReadBuffByProtocolIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByProtocolIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByProtocolIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByProtocolIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByProtocolIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (URLProtocolId != null) {
            stmtReadBuffByProtocolIdx.setShort(argIdx++, URLProtocolId.shortValue());
        } else {
            stmtReadBuffByProtocolIdx.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        resultSet = stmtReadBuffByProtocolIdx.executeQuery();
        List<CFAccContactURLBuff> buffList = new LinkedList<CFAccContactURLBuff>();
        if (resultSet != null) {
            while (resultSet.next()) {
                CFAccContactURLBuff buff = unpackContactURLResultSetToBuff(resultSet);
                buffList.add(buff);
            }
        }
        int idx = 0;
        CFAccContactURLBuff[] retBuff = new CFAccContactURLBuff[buffList.size()];
        Iterator<CFAccContactURLBuff> iter = buffList.iterator();
        while (iter.hasNext()) {
            retBuff[idx++] = iter.next();
        }
        return (retBuff);
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}

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

public CFAccContactURLBuff[] readBuffByProtocolIdx(CFAccAuthorization Authorization, Short URLProtocolId) {
    final String S_ProcName = "readBuffByProtocolIdx";
    ResultSet resultSet = null;/*from w ww  . j av  a 2s .c om*/
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerSchemaDbName() + ".sp_read_ctcurl_by_protocolidx( ?, ?, ?, ?, ?"
                + ", " + "?" + " )";
        if (stmtReadBuffByProtocolIdx == null) {
            stmtReadBuffByProtocolIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtReadBuffByProtocolIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByProtocolIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByProtocolIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByProtocolIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByProtocolIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (URLProtocolId != null) {
            stmtReadBuffByProtocolIdx.setShort(argIdx++, URLProtocolId.shortValue());
        } else {
            stmtReadBuffByProtocolIdx.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        try {
            resultSet = stmtReadBuffByProtocolIdx.executeQuery();
        } catch (SQLException e) {
            if (e.getErrorCode() != 1329) {
                throw e;
            }
            resultSet = null;
        }
        List<CFAccContactURLBuff> buffList = new LinkedList<CFAccContactURLBuff>();
        while ((resultSet != null) && resultSet.next()) {
            CFAccContactURLBuff buff = unpackContactURLResultSetToBuff(resultSet);
            buffList.add(buff);
        }
        int idx = 0;
        CFAccContactURLBuff[] retBuff = new CFAccContactURLBuff[buffList.size()];
        Iterator<CFAccContactURLBuff> iter = buffList.iterator();
        while (iter.hasNext()) {
            retBuff[idx++] = iter.next();
        }
        return (retBuff);
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}