Example usage for java.sql Types SMALLINT

List of usage examples for java.sql Types SMALLINT

Introduction

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

Prototype

int SMALLINT

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

Click Source Link

Document

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

Usage

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstPgSql.CFAstPgSqlISOLanguageTable.java

public void deleteISOLanguageByCountryIdx(CFAstAuthorization Authorization, Short argISOCountryId) {
    final String S_ProcName = "deleteISOLanguageByCountryIdx";
    ResultSet resultSet = null;/*from ww  w. j  a  v  a  2  s.  c  om*/
    try {
        Connection cnx = schema.getCnx();
        String sql = "SELECT " + schema.getLowerDbSchemaName()
                + ".sp_delete_iso_lang_by_countryidx( ?, ?, ?, ?, ?" + ", " + "?" + " ) as DeletedFlag";
        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 (argISOCountryId != null) {
            stmtDeleteByCountryIdx.setShort(argIdx++, argISOCountryId.shortValue());
        } else {
            stmtDeleteByCountryIdx.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        resultSet = stmtDeleteByCountryIdx.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.CFAccOracle.CFAccOracleContactTable.java

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

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

public void updateAddress(CFAccAuthorization Authorization, CFAccAddressBuff Buff) {
    final String S_ProcName = "updateAddress";
    ResultSet resultSet = null;//from   w ww. j  a va 2 s  .c  om
    try {
        long TenantId = Buff.getRequiredTenantId();
        long AddressId = Buff.getRequiredAddressId();
        long ContactId = Buff.getRequiredContactId();
        String Description = Buff.getRequiredDescription();
        String AddrLine1 = Buff.getOptionalAddrLine1();
        String AddrLine2 = Buff.getOptionalAddrLine2();
        String City = Buff.getOptionalCity();
        String State = Buff.getOptionalState();
        Short CountryId = Buff.getOptionalCountryId();
        String Zip = Buff.getOptionalZip();
        int Revision = Buff.getRequiredRevision();
        Connection cnx = schema.getCnx();
        String sql = "exec sp_update_address ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", "
                + "?";
        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++, "ADR");
        stmtUpdateByPKey.setLong(argIdx++, TenantId);
        stmtUpdateByPKey.setLong(argIdx++, AddressId);
        stmtUpdateByPKey.setLong(argIdx++, ContactId);
        stmtUpdateByPKey.setString(argIdx++, Description);
        if (AddrLine1 != null) {
            stmtUpdateByPKey.setString(argIdx++, AddrLine1);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (AddrLine2 != null) {
            stmtUpdateByPKey.setString(argIdx++, AddrLine2);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (City != null) {
            stmtUpdateByPKey.setString(argIdx++, City);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (State != null) {
            stmtUpdateByPKey.setString(argIdx++, State);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (CountryId != null) {
            stmtUpdateByPKey.setShort(argIdx++, CountryId.shortValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        if (Zip != null) {
            stmtUpdateByPKey.setString(argIdx++, Zip);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        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()) {
            CFAccAddressBuff updatedBuff = unpackAddressResultSetToBuff(resultSet);
            if (resultSet.next()) {
                resultSet.last();
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
            }
            Buff.setRequiredContactId(updatedBuff.getRequiredContactId());
            Buff.setRequiredDescription(updatedBuff.getRequiredDescription());
            Buff.setOptionalAddrLine1(updatedBuff.getOptionalAddrLine1());
            Buff.setOptionalAddrLine2(updatedBuff.getOptionalAddrLine2());
            Buff.setOptionalCity(updatedBuff.getOptionalCity());
            Buff.setOptionalState(updatedBuff.getOptionalState());
            Buff.setOptionalCountryId(updatedBuff.getOptionalCountryId());
            Buff.setOptionalZip(updatedBuff.getOptionalZip());
            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_0.CFAstDb2LUW.CFAstDb2LUWISOLanguageTable.java

public void deleteISOLanguageByCountryIdx(CFAstAuthorization Authorization, Short argISOCountryId) {
    final String S_ProcName = "deleteISOLanguageByCountryIdx";
    ResultSet resultSet = null;// w ww.j  a v a 2s .  c  o  m
    try {
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_delete_iso_lang_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 (argISOCountryId != null) {
            stmtDeleteByCountryIdx.setShort(argIdx++, argISOCountryId.shortValue());
        } else {
            stmtDeleteByCountryIdx.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        resultSet = stmtDeleteByCountryIdx.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.CFAccDb2LUW.CFAccDb2LUWISOLanguageTable.java

public void deleteISOLanguageByCountryIdx(CFAccAuthorization Authorization, Short argISOCountryId) {
    final String S_ProcName = "deleteISOLanguageByCountryIdx";
    ResultSet resultSet = null;/*from w  ww  .j a va2  s  . c  o m*/
    try {
        Connection cnx = schema.getCnx();
        final String sql = "CALL sp_delete_iso_lang_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 (argISOCountryId != null) {
            stmtDeleteByCountryIdx.setShort(argIdx++, argISOCountryId.shortValue());
        } else {
            stmtDeleteByCountryIdx.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        resultSet = stmtDeleteByCountryIdx.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.CFAccMySql.CFAccMySqlContactTable.java

public void updateContact(CFAccAuthorization Authorization, CFAccContactBuff Buff) {
    final String S_ProcName = "updateContact";
    ResultSet resultSet = null;/*  ww w .  ja  v  a2 s. c  o m*/
    try {
        long TenantId = Buff.getRequiredTenantId();
        long ContactId = Buff.getRequiredContactId();
        long ContactListId = Buff.getRequiredContactListId();
        Short ISOTimezoneId = Buff.getOptionalISOTimezoneId();
        String FullName = Buff.getRequiredFullName();
        String LastName = Buff.getOptionalLastName();
        String FirstName = Buff.getOptionalFirstName();
        String Custom = Buff.getOptionalCustom();
        String Custom2 = Buff.getOptionalCustom2();
        String Custom3 = Buff.getOptionalCustom3();
        int Revision = Buff.getRequiredRevision();
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerSchemaDbName() + ".sp_update_contact( ?, ?, ?, ?, ?, ?" + ", "
                + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"
                + ", " + "?" + ", " + "?" + ", " + "?" + " )";
        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++, "CTC");
        stmtUpdateByPKey.setLong(argIdx++, TenantId);
        stmtUpdateByPKey.setLong(argIdx++, ContactId);
        stmtUpdateByPKey.setLong(argIdx++, ContactListId);
        if (ISOTimezoneId != null) {
            stmtUpdateByPKey.setShort(argIdx++, ISOTimezoneId.shortValue());
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        stmtUpdateByPKey.setString(argIdx++, FullName);
        if (LastName != null) {
            stmtUpdateByPKey.setString(argIdx++, LastName);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (FirstName != null) {
            stmtUpdateByPKey.setString(argIdx++, FirstName);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (Custom != null) {
            stmtUpdateByPKey.setString(argIdx++, Custom);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (Custom2 != null) {
            stmtUpdateByPKey.setString(argIdx++, Custom2);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        if (Custom3 != null) {
            stmtUpdateByPKey.setString(argIdx++, Custom3);
        } else {
            stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.VARCHAR);
        }
        stmtUpdateByPKey.setInt(argIdx++, Revision);
        try {
            resultSet = stmtUpdateByPKey.executeQuery();
        } catch (SQLException e) {
            if (e.getErrorCode() != 1329) {
                throw e;
            }
            resultSet = null;
        }
        if ((resultSet != null) && resultSet.next()) {
            CFAccContactBuff updatedBuff = unpackContactResultSetToBuff(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.setRequiredContactListId(updatedBuff.getRequiredContactListId());
            Buff.setOptionalISOTimezoneId(updatedBuff.getOptionalISOTimezoneId());
            Buff.setRequiredFullName(updatedBuff.getRequiredFullName());
            Buff.setOptionalLastName(updatedBuff.getOptionalLastName());
            Buff.setOptionalFirstName(updatedBuff.getOptionalFirstName());
            Buff.setOptionalCustom(updatedBuff.getOptionalCustom());
            Buff.setOptionalCustom2(updatedBuff.getOptionalCustom2());
            Buff.setOptionalCustom3(updatedBuff.getOptionalCustom3());
            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.cfinternet.v2_1.CFInternetMySql.CFInternetMySqlISOLanguageTable.java

public void deleteISOLanguageByCountryIdx(CFInternetAuthorization Authorization, Short argISOCountryId) {
    final String S_ProcName = "deleteISOLanguageByCountryIdx";
    ResultSet resultSet = null;//  ww  w .  j  a  va 2s.  c o m
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerDbSchemaName()
                + ".sp_delete_iso_lang_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 (argISOCountryId != null) {
            stmtDeleteByCountryIdx.setShort(argIdx++, argISOCountryId.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.cfsecurity.v2_0.CFSecurityMySql.CFSecurityMySqlISOLanguageTable.java

public void deleteISOLanguageByCountryIdx(CFSecurityAuthorization Authorization, Short argISOCountryId) {
    final String S_ProcName = "deleteISOLanguageByCountryIdx";
    ResultSet resultSet = null;//from   w w  w. j  av a  2  s .c o m
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerSchemaDbName()
                + ".sp_delete_iso_lang_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 (argISOCountryId != null) {
            stmtDeleteByCountryIdx.setShort(argIdx++, argISOCountryId.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.cfinternet.v2_1.CFInternetMSSql.CFInternetMSSqlISOLanguageTable.java

public void deleteISOLanguageByCountryIdx(CFInternetAuthorization Authorization, Short argISOCountryId) {
    final String S_ProcName = "deleteISOLanguageByCountryIdx";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from  w  w w .j  a v  a  2 s  .  com*/
    ResultSet resultSet = null;
    try {
        Connection cnx = schema.getCnx();
        String sql = "exec sp_delete_iso_lang_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 (argISOCountryId != null) {
            stmtDeleteByCountryIdx.setShort(argIdx++, argISOCountryId.shortValue());
        } else {
            stmtDeleteByCountryIdx.setNull(argIdx++, java.sql.Types.SMALLINT);
        }
        Object stuff = null;
        boolean moreResults = stmtDeleteByCountryIdx.execute();
        while (stuff == null) {
            try {
                moreResults = stmtDeleteByCountryIdx.getMoreResults();
            } catch (SQLException e) {
                throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
            }
            if (moreResults) {
                try {
                    stuff = stmtDeleteByCountryIdx.getResultSet();
                } catch (SQLException e) {
                }
            } else if (-1 == stmtDeleteByCountryIdx.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:com.mirth.connect.donkey.test.util.TestUtils.java

private static String typeToString(int sqlType) {
    switch (sqlType) {
    case Types.ARRAY:
        return "ARRAY";
    case Types.BIGINT:
        return "BIGINT";
    case Types.BINARY:
        return "BINARY";
    case Types.BIT:
        return "BIT";
    case Types.BLOB:
        return "BLOB";
    case Types.BOOLEAN:
        return "BOOLEAN";
    case Types.CHAR:
        return "CHAR";
    case Types.CLOB:
        return "CLOB";
    case Types.DATALINK:
        return "DATALINK";
    case Types.DATE:
        return "DATE";
    case Types.DECIMAL:
        return "DECIMAL";
    case Types.DISTINCT:
        return "DISTINCT";
    case Types.DOUBLE:
        return "DOUBLE";
    case Types.FLOAT:
        return "FLOAT";
    case Types.INTEGER:
        return "INTEGER";
    case Types.JAVA_OBJECT:
        return "JAVA_OBJECT";
    case Types.LONGNVARCHAR:
        return "LONGNVARCHAR";
    case Types.LONGVARBINARY:
        return "LONGVARBINARY";
    case Types.LONGVARCHAR:
        return "LONGVARCHAR";
    case Types.NCHAR:
        return "NCHAR";
    case Types.NCLOB:
        return "NCLOB";
    case Types.NULL:
        return "NULL";
    case Types.NUMERIC:
        return "NUMERIC";
    case Types.NVARCHAR:
        return "NVARCHAR";
    case Types.OTHER:
        return "OTHER";
    case Types.REAL:
        return "REAL";
    case Types.REF:
        return "REF";
    case Types.ROWID:
        return "ROWID";
    case Types.SMALLINT:
        return "SMALLINT";
    case Types.SQLXML:
        return "SQLXML";
    case Types.STRUCT:
        return "STRUCT";
    case Types.TIME:
        return "TIME";
    case Types.TIMESTAMP:
        return "TIMESTAMP";
    case Types.TINYINT:
        return "TINYINT";
    case Types.VARBINARY:
        return "VARBINARY";
    case Types.VARCHAR:
        return "VARCHAR";
    default:/*from  w  w  w  . jav a  2s .c  om*/
        return "UNKNOWN";
    }
}