public CFSecurityISOTimezoneBuff lockBuff( CFSecurityAuthorization Authorization, CFSecurityISOTimezonePKey PKey) { final String S_ProcName = "lockBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); short ISOTimezoneId = PKey.getRequiredISOTimezoneId(); String sql = "SELECT * FROM " + schema.getLowerDbSchemaName() + ".sp_lock_isotz( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtLockBuffByPKey == null) { stmtLockBuffByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtLockBuffByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtLockBuffByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtLockBuffByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtLockBuffByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtLockBuffByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtLockBuffByPKey.setShort(argIdx++, ISOTimezoneId); resultSet = stmtLockBuffByPKey.executeQuery(); if (resultSet.next()) { CFSecurityISOTimezoneBuff buff = unpackISOTimezoneResultSetToBuff(resultSet); if (resultSet.next()) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response"); } 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; } } }
public void deleteISOTimezoneByIdIdx( CFSecurityAuthorization Authorization, CFSecurityISOTimezonePKey argKey) { deleteISOTimezoneByIdIdx(Authorization, argKey.getRequiredISOTimezoneId()); }
public static String formatISOTimezonePKeyAttributes( String separator, CFSecurityISOTimezonePKey pkey) { String retval = CFLibXmlUtil.formatRequiredInt16(null, "ISOTimezoneId", pkey.getRequiredISOTimezoneId()); return (retval); }
public CFSecurityISOTimezoneBuff lockBuff( CFSecurityAuthorization Authorization, CFSecurityISOTimezonePKey PKey) { final String S_ProcName = "lockBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); short ISOTimezoneId = PKey.getRequiredISOTimezoneId(); String sql = "{ call sp_lock_isotz( ?, ?, ?, ?, ?" + ", " + "?" + " ) }"; if (stmtLockBuffByPKey == null) { stmtLockBuffByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtLockBuffByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtLockBuffByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtLockBuffByPKey.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtLockBuffByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtLockBuffByPKey.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtLockBuffByPKey.setShort(argIdx++, ISOTimezoneId); stmtLockBuffByPKey.execute(); boolean moreResults = true; resultSet = null; while (resultSet == null) { try { moreResults = stmtLockBuffByPKey.getMoreResults(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } if (moreResults) { try { resultSet = stmtLockBuffByPKey.getResultSet(); } catch (SQLException e) { } } else if (-1 == stmtLockBuffByPKey.getUpdateCount()) { break; } } if ((resultSet != null) && resultSet.next()) { CFSecurityISOTimezoneBuff buff = unpackISOTimezoneResultSetToBuff(resultSet); if (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; } } }