List of usage examples for java.lang Short shortValue
@HotSpotIntrinsicCandidate public short shortValue()
From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmDb2LUW.CFCrmDb2LUWContactURLTable.java
public void updateContactURL(CFCrmAuthorization Authorization, CFCrmContactURLBuff Buff) { final String S_ProcName = "updateContactURL"; if ("CURL".equals(Buff.getClassCode()) && (!schema.isTenantUser(Authorization, Buff.getRequiredTenantId(), "UpdateContactURL"))) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Permission denied -- User not part of TSecGroup UpdateContactURL"); }//from w w w .jav a 2 s .co m ResultSet resultSet = null; try { long TenantId = Buff.getRequiredTenantId(); long ContactURLId = Buff.getRequiredContactURLId(); long ContactId = Buff.getRequiredContactId(); Short URLProtocolId = Buff.getOptionalURLProtocolId(); String Name = Buff.getRequiredName(); String URL = Buff.getRequiredURL(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); final String sql = "CALL sp_update_ctcurl( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; 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++, "CURL"); stmtUpdateByPKey.setLong(argIdx++, TenantId); stmtUpdateByPKey.setLong(argIdx++, ContactURLId); stmtUpdateByPKey.setLong(argIdx++, ContactId); if (URLProtocolId != null) { stmtUpdateByPKey.setShort(argIdx++, URLProtocolId.shortValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } stmtUpdateByPKey.setString(argIdx++, Name); stmtUpdateByPKey.setString(argIdx++, URL); stmtUpdateByPKey.setInt(argIdx++, Revision); resultSet = stmtUpdateByPKey.executeQuery(); if (resultSet.next()) { CFCrmContactURLBuff updatedBuff = unpackContactURLResultSetToBuff(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.setOptionalURLProtocolId(updatedBuff.getOptionalURLProtocolId()); Buff.setRequiredName(updatedBuff.getRequiredName()); Buff.setRequiredURL(updatedBuff.getRequiredURL()); Buff.setRequiredRevision(updatedBuff.getRequiredRevision()); } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected a single-record response, " + resultSet.getRow() + " rows selected"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleContactTable.java
public void deleteContactByTimezoneIdx(CFAccAuthorization Authorization, Short argISOTimezoneId) { final String S_ProcName = "deleteContactByTimezoneIdx"; ResultSet resultSet = null;//from w w w . ja v a 2 s.co m try { Connection cnx = schema.getCnx(); String sql = "begin call " + schema.getLowerSchemaDbName() + ".dl_contactbytimezoneidx( ?, ?, ?, ?, ?" + ", " + "?" + " ); end"; if (stmtDeleteByTimezoneIdx == null) { stmtDeleteByTimezoneIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByTimezoneIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByTimezoneIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByTimezoneIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByTimezoneIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByTimezoneIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argISOTimezoneId != null) { stmtDeleteByTimezoneIdx.setShort(argIdx++, argISOTimezoneId.shortValue()); } else { stmtDeleteByTimezoneIdx.setNull(argIdx++, java.sql.Types.SMALLINT); } int rowsUpdated = stmtDeleteByTimezoneIdx.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.CFAccDb2LUW.CFAccDb2LUWContactURLTable.java
public void updateContactURL(CFAccAuthorization Authorization, CFAccContactURLBuff Buff) { final String S_ProcName = "updateContactURL"; if ("CURL".equals(Buff.getClassCode()) && (!schema.isTenantUser(Authorization, Buff.getRequiredTenantId(), "UpdateContactURL"))) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Permission denied -- User not part of TSecGroup UpdateContactURL"); }/*from ww w .ja v a2s . c om*/ ResultSet resultSet = null; try { long TenantId = Buff.getRequiredTenantId(); long ContactURLId = Buff.getRequiredContactURLId(); long ContactId = Buff.getRequiredContactId(); Short URLProtocolId = Buff.getOptionalURLProtocolId(); String Name = Buff.getRequiredName(); String URL = Buff.getRequiredURL(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); final String sql = "CALL sp_update_ctcurl( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; 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++, "CURL"); stmtUpdateByPKey.setLong(argIdx++, TenantId); stmtUpdateByPKey.setLong(argIdx++, ContactURLId); stmtUpdateByPKey.setLong(argIdx++, ContactId); if (URLProtocolId != null) { stmtUpdateByPKey.setShort(argIdx++, URLProtocolId.shortValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } stmtUpdateByPKey.setString(argIdx++, Name); stmtUpdateByPKey.setString(argIdx++, URL); stmtUpdateByPKey.setInt(argIdx++, Revision); resultSet = stmtUpdateByPKey.executeQuery(); if (resultSet.next()) { CFAccContactURLBuff updatedBuff = unpackContactURLResultSetToBuff(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.setOptionalURLProtocolId(updatedBuff.getOptionalURLProtocolId()); Buff.setRequiredName(updatedBuff.getRequiredName()); Buff.setRequiredURL(updatedBuff.getRequiredURL()); 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 void updateContactURL(CFCrmAuthorization Authorization, CFCrmContactURLBuff Buff) { final String S_ProcName = "updateContactURL"; ResultSet resultSet = null;/* www .j a v a 2 s .c o m*/ try { long TenantId = Buff.getRequiredTenantId(); long ContactURLId = Buff.getRequiredContactURLId(); long ContactId = Buff.getRequiredContactId(); Short URLProtocolId = Buff.getOptionalURLProtocolId(); String Name = Buff.getRequiredName(); String URL = Buff.getRequiredURL(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_update_ctcurl( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; 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++, "CURL"); stmtUpdateByPKey.setLong(argIdx++, TenantId); stmtUpdateByPKey.setLong(argIdx++, ContactURLId); stmtUpdateByPKey.setLong(argIdx++, ContactId); if (URLProtocolId != null) { stmtUpdateByPKey.setShort(argIdx++, URLProtocolId.shortValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } stmtUpdateByPKey.setString(argIdx++, Name); stmtUpdateByPKey.setString(argIdx++, URL); stmtUpdateByPKey.setInt(argIdx++, Revision); try { resultSet = stmtUpdateByPKey.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } if ((resultSet != null) && resultSet.next()) { CFCrmContactURLBuff updatedBuff = unpackContactURLResultSetToBuff(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.setRequiredContactId(updatedBuff.getRequiredContactId()); Buff.setOptionalURLProtocolId(updatedBuff.getOptionalURLProtocolId()); Buff.setRequiredName(updatedBuff.getRequiredName()); Buff.setRequiredURL(updatedBuff.getRequiredURL()); 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.CFCrmMSSqlContactTable.java
public void deleteContactByTimezoneIdx(CFCrmAuthorization Authorization, Short argISOTimezoneId) { final String S_ProcName = "deleteContactByTimezoneIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }//from w ww. ja va 2 s .c o m ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); String sql = "exec sp_delete_contact_by_timezoneidx ?, ?, ?, ?, ?" + ", " + "?"; if (stmtDeleteByTimezoneIdx == null) { stmtDeleteByTimezoneIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByTimezoneIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByTimezoneIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByTimezoneIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByTimezoneIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByTimezoneIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argISOTimezoneId != null) { stmtDeleteByTimezoneIdx.setShort(argIdx++, argISOTimezoneId.shortValue()); } else { stmtDeleteByTimezoneIdx.setNull(argIdx++, java.sql.Types.SMALLINT); } Object stuff = null; boolean moreResults = stmtDeleteByTimezoneIdx.execute(); while (stuff == null) { try { moreResults = stmtDeleteByTimezoneIdx.getMoreResults(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } if (moreResults) { try { stuff = stmtDeleteByTimezoneIdx.getResultSet(); } catch (SQLException e) { } } else if (-1 == stmtDeleteByTimezoneIdx.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.cfcrm.v2_1.CFCrmMSSql.CFCrmMSSqlContactURLTable.java
public void updateContactURL(CFCrmAuthorization Authorization, CFCrmContactURLBuff Buff) { final String S_ProcName = "updateContactURL"; ResultSet resultSet = null;/*w w w .j a va2s. co m*/ try { long TenantId = Buff.getRequiredTenantId(); long ContactURLId = Buff.getRequiredContactURLId(); long ContactId = Buff.getRequiredContactId(); Short URLProtocolId = Buff.getOptionalURLProtocolId(); String Name = Buff.getRequiredName(); String URL = Buff.getRequiredURL(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); String sql = "exec sp_update_ctcurl ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"; 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++, "CURL"); stmtUpdateByPKey.setLong(argIdx++, TenantId); stmtUpdateByPKey.setLong(argIdx++, ContactURLId); stmtUpdateByPKey.setLong(argIdx++, ContactId); if (URLProtocolId != null) { stmtUpdateByPKey.setShort(argIdx++, URLProtocolId.shortValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } stmtUpdateByPKey.setString(argIdx++, Name); stmtUpdateByPKey.setString(argIdx++, URL); 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()) { CFCrmContactURLBuff updatedBuff = unpackContactURLResultSetToBuff(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.setOptionalURLProtocolId(updatedBuff.getOptionalURLProtocolId()); Buff.setRequiredName(updatedBuff.getRequiredName()); Buff.setRequiredURL(updatedBuff.getRequiredURL()); Buff.setRequiredRevision(updatedBuff.getRequiredRevision()); } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected a single-record response, " + resultSet.getRow() + " rows selected"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMySql.CFAccMySqlContactURLTable.java
public void updateContactURL(CFAccAuthorization Authorization, CFAccContactURLBuff Buff) { final String S_ProcName = "updateContactURL"; ResultSet resultSet = null;/* www . j a v a 2 s . c om*/ try { long TenantId = Buff.getRequiredTenantId(); long ContactURLId = Buff.getRequiredContactURLId(); long ContactId = Buff.getRequiredContactId(); Short URLProtocolId = Buff.getOptionalURLProtocolId(); String Name = Buff.getRequiredName(); String URL = Buff.getRequiredURL(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerSchemaDbName() + ".sp_update_ctcurl( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; 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++, "CURL"); stmtUpdateByPKey.setLong(argIdx++, TenantId); stmtUpdateByPKey.setLong(argIdx++, ContactURLId); stmtUpdateByPKey.setLong(argIdx++, ContactId); if (URLProtocolId != null) { stmtUpdateByPKey.setShort(argIdx++, URLProtocolId.shortValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } stmtUpdateByPKey.setString(argIdx++, Name); stmtUpdateByPKey.setString(argIdx++, URL); stmtUpdateByPKey.setInt(argIdx++, Revision); try { resultSet = stmtUpdateByPKey.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } if ((resultSet != null) && resultSet.next()) { CFAccContactURLBuff updatedBuff = unpackContactURLResultSetToBuff(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.setRequiredContactId(updatedBuff.getRequiredContactId()); Buff.setOptionalURLProtocolId(updatedBuff.getOptionalURLProtocolId()); Buff.setRequiredName(updatedBuff.getRequiredName()); Buff.setRequiredURL(updatedBuff.getRequiredURL()); Buff.setRequiredRevision(updatedBuff.getRequiredRevision()); } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected a single-record response, " + resultSet.getRow() + " rows selected"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMSSql.CFAccMSSqlContactTable.java
public void deleteContactByTimezoneIdx(CFAccAuthorization Authorization, Short argISOTimezoneId) { final String S_ProcName = "deleteContactByTimezoneIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/* w w w . j a v a2s. c om*/ ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); String sql = "exec sp_delete_contact_by_timezoneidx ?, ?, ?, ?, ?" + ", " + "?"; if (stmtDeleteByTimezoneIdx == null) { stmtDeleteByTimezoneIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByTimezoneIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByTimezoneIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByTimezoneIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByTimezoneIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByTimezoneIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argISOTimezoneId != null) { stmtDeleteByTimezoneIdx.setShort(argIdx++, argISOTimezoneId.shortValue()); } else { stmtDeleteByTimezoneIdx.setNull(argIdx++, java.sql.Types.SMALLINT); } Object stuff = null; boolean moreResults = stmtDeleteByTimezoneIdx.execute(); while (stuff == null) { try { moreResults = stmtDeleteByTimezoneIdx.getMoreResults(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } if (moreResults) { try { stuff = stmtDeleteByTimezoneIdx.getResultSet(); } catch (SQLException e) { } } else if (-1 == stmtDeleteByTimezoneIdx.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.CFAccMSSql.CFAccMSSqlContactURLTable.java
public void updateContactURL(CFAccAuthorization Authorization, CFAccContactURLBuff Buff) { final String S_ProcName = "updateContactURL"; ResultSet resultSet = null;/*from w w w .j a va 2s . c o m*/ try { long TenantId = Buff.getRequiredTenantId(); long ContactURLId = Buff.getRequiredContactURLId(); long ContactId = Buff.getRequiredContactId(); Short URLProtocolId = Buff.getOptionalURLProtocolId(); String Name = Buff.getRequiredName(); String URL = Buff.getRequiredURL(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); String sql = "exec sp_update_ctcurl ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?"; 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++, "CURL"); stmtUpdateByPKey.setLong(argIdx++, TenantId); stmtUpdateByPKey.setLong(argIdx++, ContactURLId); stmtUpdateByPKey.setLong(argIdx++, ContactId); if (URLProtocolId != null) { stmtUpdateByPKey.setShort(argIdx++, URLProtocolId.shortValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } stmtUpdateByPKey.setString(argIdx++, Name); stmtUpdateByPKey.setString(argIdx++, URL); 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()) { CFAccContactURLBuff updatedBuff = unpackContactURLResultSetToBuff(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.setOptionalURLProtocolId(updatedBuff.getOptionalURLProtocolId()); Buff.setRequiredName(updatedBuff.getRequiredName()); Buff.setRequiredURL(updatedBuff.getRequiredURL()); Buff.setRequiredRevision(updatedBuff.getRequiredRevision()); } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Expected a single-record response, " + resultSet.getRow() + " rows selected"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleContactURLTable.java
public CFAccContactURLBuff[] readBuffByProtocolIdx(CFAccAuthorization Authorization, Short URLProtocolId) { final String S_ProcName = "readBuffByProtocolIdx"; ResultSet resultSet = null;//from www . ja va 2 s . c o m Connection cnx = schema.getCnx(); CallableStatement stmtReadBuffByProtocolIdx = null; List<CFAccContactURLBuff> buffList = new LinkedList<CFAccContactURLBuff>(); try { stmtReadBuffByProtocolIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName() + ".rd_ctcurlbyprotocolidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadBuffByProtocolIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR); 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); } stmtReadBuffByProtocolIdx.execute(); resultSet = (ResultSet) stmtReadBuffByProtocolIdx.getObject(1); if (resultSet != null) { try { while (resultSet.next()) { CFAccContactURLBuff buff = unpackContactURLResultSetToBuff(resultSet); buffList.add(buff); } try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } catch (SQLException e) { } } 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; } if (stmtReadBuffByProtocolIdx != null) { try { stmtReadBuffByProtocolIdx.close(); } catch (SQLException e) { } stmtReadBuffByProtocolIdx = null; } } }