List of usage examples for java.lang Short shortValue
@HotSpotIntrinsicCandidate public short shortValue()
From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleISOLanguageTable.java
public void updateISOLanguage(CFEnSyntaxAuthorization Authorization, CFEnSyntaxISOLanguageBuff Buff) { final String S_ProcName = "updateISOLanguage"; ResultSet resultSet = null;/*w w w .ja va2 s . co m*/ Connection cnx = schema.getCnx(); CallableStatement stmtUpdateByPKey = null; List<CFEnSyntaxISOLanguageBuff> buffList = new LinkedList<CFEnSyntaxISOLanguageBuff>(); try { short Id = Buff.getRequiredId(); String ISOCode = Buff.getRequiredISOCode(); String BaseLanguageCode = Buff.getRequiredBaseLanguageCode(); Short ISOCountryId = Buff.getOptionalISOCountryId(); int Revision = Buff.getRequiredRevision(); stmtUpdateByPKey = cnx .prepareCall("begin " + schema.getLowerDbSchemaName() + ".upd_iso_lang( ?, ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "? ); end;"); int argIdx = 1; stmtUpdateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR); 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(); resultSet = (ResultSet) stmtUpdateByPKey.getObject(1); if (resultSet != null) { try { 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().newRuntimeException(getClass(), S_ProcName, "upd_iso_lang() did not return a valid result cursor"); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "upd_iso_lang() did not return a result cursor"); } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } if (stmtUpdateByPKey != null) { try { stmtUpdateByPKey.close(); } catch (SQLException e) { } stmtUpdateByPKey = null; } } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskOracle.CFAsteriskOracleISOLanguageTable.java
public CFSecurityISOLanguageBuff[] readBuffByCountryIdx(CFSecurityAuthorization Authorization, Short ISOCountryId) { final String S_ProcName = "readBuffByCountryIdx"; ResultSet resultSet = null;// w ww.j a v a 2s .co m Connection cnx = schema.getCnx(); CallableStatement stmtReadBuffByCountryIdx = null; List<CFSecurityISOLanguageBuff> buffList = new LinkedList<CFSecurityISOLanguageBuff>(); try { stmtReadBuffByCountryIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".rd_iso_langbycountryidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadBuffByCountryIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR); stmtReadBuffByCountryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByCountryIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByCountryIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByCountryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByCountryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (ISOCountryId != null) { stmtReadBuffByCountryIdx.setShort(argIdx++, ISOCountryId.shortValue()); } else { stmtReadBuffByCountryIdx.setNull(argIdx++, java.sql.Types.SMALLINT); } stmtReadBuffByCountryIdx.execute(); resultSet = (ResultSet) stmtReadBuffByCountryIdx.getObject(1); if (resultSet != null) { try { while (resultSet.next()) { CFSecurityISOLanguageBuff buff = unpackISOLanguageResultSetToBuff(resultSet); buffList.add(buff); } try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } catch (SQLException e) { } } int idx = 0; CFSecurityISOLanguageBuff[] retBuff = new CFSecurityISOLanguageBuff[buffList.size()]; Iterator<CFSecurityISOLanguageBuff> 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 (stmtReadBuffByCountryIdx != null) { try { stmtReadBuffByCountryIdx.close(); } catch (SQLException e) { } stmtReadBuffByCountryIdx = null; } } }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmMySql.CFCrmMySqlContactTable.java
public CFCrmContactBuff[] readBuffByTimezoneIdx(CFCrmAuthorization Authorization, Short ISOTimezoneId) { final String S_ProcName = "readBuffByTimezoneIdx"; ResultSet resultSet = null;// w w w.j a v a 2 s . c o m try { Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_read_contact_by_timezoneidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtReadBuffByTimezoneIdx == null) { stmtReadBuffByTimezoneIdx = cnx.prepareStatement(sql); } int argIdx = 1; 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); } try { resultSet = stmtReadBuffByTimezoneIdx.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } List<CFCrmContactBuff> buffList = new LinkedList<CFCrmContactBuff>(); while ((resultSet != null) && resultSet.next()) { CFCrmContactBuff buff = unpackContactResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFCrmContactBuff[] retBuff = new CFCrmContactBuff[buffList.size()]; Iterator<CFCrmContactBuff> 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.CFAccPgSql.CFAccPgSqlContactTable.java
public void deleteContactByTimezoneIdx(CFAccAuthorization Authorization, Short argISOTimezoneId) { final String S_ProcName = "deleteContactByTimezoneIdx"; ResultSet resultSet = null;/*www . j a v a 2 s . c o m*/ try { Connection cnx = schema.getCnx(); String sql = "SELECT " + schema.getLowerSchemaDbName() + ".sp_delete_contact_by_timezoneidx( ?, ?, ?, ?, ?" + ", " + "?" + " ) as DeletedFlag"; 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); } resultSet = stmtDeleteByTimezoneIdx.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.CFAccMSSqlContactTable.java
public CFAccContactBuff[] readBuffByTimezoneIdx(CFAccAuthorization Authorization, Short ISOTimezoneId) { final String S_ProcName = "readBuffByTimezoneIdx"; ResultSet resultSet = null;//www. j a va 2s . com try { Connection cnx = schema.getCnx(); String sql = "{ call sp_read_contact_by_timezoneidx( ?, ?, ?, ?, ?" + ", " + "?" + " ) }"; if (stmtReadBuffByTimezoneIdx == null) { stmtReadBuffByTimezoneIdx = cnx.prepareStatement(sql); } int argIdx = 1; 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); } resultSet = stmtReadBuffByTimezoneIdx.executeQuery(); List<CFAccContactBuff> buffList = new LinkedList<CFAccContactBuff>(); if (resultSet != null) { while (resultSet.next()) { CFAccContactBuff buff = unpackContactResultSetToBuff(resultSet); buffList.add(buff); } } 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; } } }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmMySql.CFCrmMySqlContactURLTable.java
public void createContactURL(CFCrmAuthorization Authorization, CFCrmContactURLBuff Buff) { final String S_ProcName = "createContactURL"; 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 { long TenantId = Buff.getRequiredTenantId(); long ContactId = Buff.getRequiredContactId(); Short URLProtocolId = Buff.getOptionalURLProtocolId(); String Name = Buff.getRequiredName(); String URL = Buff.getRequiredURL(); Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_create_ctcurl( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; if (stmtCreateByPKey == null) { stmtCreateByPKey = cnx.prepareStatement(sql); } int argIdx = 1; stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtCreateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtCreateByPKey.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtCreateByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtCreateByPKey.setString(argIdx++, "CURL"); stmtCreateByPKey.setLong(argIdx++, TenantId); stmtCreateByPKey.setLong(argIdx++, ContactId); if (URLProtocolId != null) { stmtCreateByPKey.setShort(argIdx++, URLProtocolId.shortValue()); } else { stmtCreateByPKey.setNull(argIdx++, java.sql.Types.SMALLINT); } stmtCreateByPKey.setString(argIdx++, Name); stmtCreateByPKey.setString(argIdx++, URL); try { resultSet = stmtCreateByPKey.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } if ((resultSet != null) && resultSet.next()) { CFCrmContactURLBuff createdBuff = 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.setRequiredTenantId(createdBuff.getRequiredTenantId()); Buff.setRequiredContactURLId(createdBuff.getRequiredContactURLId()); Buff.setRequiredContactId(createdBuff.getRequiredContactId()); Buff.setOptionalURLProtocolId(createdBuff.getOptionalURLProtocolId()); Buff.setRequiredName(createdBuff.getRequiredName()); Buff.setRequiredURL(createdBuff.getRequiredURL()); Buff.setRequiredRevision(createdBuff.getRequiredRevision()); Buff.setCreatedByUserId(createdBuff.getCreatedByUserId()); Buff.setCreatedAt(createdBuff.getCreatedAt()); Buff.setUpdatedByUserId(createdBuff.getUpdatedByUserId()); Buff.setUpdatedAt(createdBuff.getUpdatedAt()); } 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 void deleteContactURLByProtocolIdx(CFAccAuthorization Authorization, Short argURLProtocolId) { final String S_ProcName = "deleteContactURLByProtocolIdx"; ResultSet resultSet = null;//w w w . ja va 2 s . c om try { Connection cnx = schema.getCnx(); String sql = "begin call " + schema.getLowerSchemaDbName() + ".dl_ctcurlbyprotocolidx( ?, ?, ?, ?, ?" + ", " + "?" + " ); end"; 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); } int rowsUpdated = stmtDeleteByProtocolIdx.executeUpdate(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleISOLanguageTable.java
public CFEnSyntaxISOLanguageBuff[] readBuffByCountryIdx(CFEnSyntaxAuthorization Authorization, Short ISOCountryId) { final String S_ProcName = "readBuffByCountryIdx"; ResultSet resultSet = null;//ww w .j ava2 s.c o m Connection cnx = schema.getCnx(); CallableStatement stmtReadBuffByCountryIdx = null; List<CFEnSyntaxISOLanguageBuff> buffList = new LinkedList<CFEnSyntaxISOLanguageBuff>(); try { stmtReadBuffByCountryIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".rd_iso_langbycountryidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadBuffByCountryIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR); stmtReadBuffByCountryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByCountryIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByCountryIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByCountryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByCountryIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (ISOCountryId != null) { stmtReadBuffByCountryIdx.setShort(argIdx++, ISOCountryId.shortValue()); } else { stmtReadBuffByCountryIdx.setNull(argIdx++, java.sql.Types.SMALLINT); } stmtReadBuffByCountryIdx.execute(); resultSet = (ResultSet) stmtReadBuffByCountryIdx.getObject(1); if (resultSet != null) { try { while (resultSet.next()) { CFEnSyntaxISOLanguageBuff buff = unpackISOLanguageResultSetToBuff(resultSet); buffList.add(buff); } try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } catch (SQLException e) { } } int idx = 0; CFEnSyntaxISOLanguageBuff[] retBuff = new CFEnSyntaxISOLanguageBuff[buffList.size()]; Iterator<CFEnSyntaxISOLanguageBuff> 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 (stmtReadBuffByCountryIdx != null) { try { stmtReadBuffByCountryIdx.close(); } catch (SQLException e) { } stmtReadBuffByCountryIdx = null; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMySql.CFAccMySqlContactTable.java
public CFAccContactBuff[] readBuffByTimezoneIdx(CFAccAuthorization Authorization, Short ISOTimezoneId) { final String S_ProcName = "readBuffByTimezoneIdx"; ResultSet resultSet = null;/*from w ww. ja v a2 s .c o m*/ try { Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerSchemaDbName() + ".sp_read_contact_by_timezoneidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtReadBuffByTimezoneIdx == null) { stmtReadBuffByTimezoneIdx = cnx.prepareStatement(sql); } int argIdx = 1; 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); } try { resultSet = stmtReadBuffByTimezoneIdx.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } List<CFAccContactBuff> buffList = new LinkedList<CFAccContactBuff>(); while ((resultSet != null) && resultSet.next()) { CFAccContactBuff buff = unpackContactResultSetToBuff(resultSet); buffList.add(buff); } 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; } } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccPgSql.CFAccPgSqlContactTable.java
public CFAccContactBuff[] readBuffByTimezoneIdx(CFAccAuthorization Authorization, Short ISOTimezoneId) { final String S_ProcName = "readBuffByTimezoneIdx"; ResultSet resultSet = null;/*w w w . ja v a 2 s . c om*/ try { Connection cnx = schema.getCnx(); String sql = "SELECT * FROM " + schema.getLowerSchemaDbName() + ".sp_read_contact_by_timezoneidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtReadBuffByTimezoneIdx == null) { stmtReadBuffByTimezoneIdx = cnx.prepareStatement(sql); } int argIdx = 1; 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); } resultSet = stmtReadBuffByTimezoneIdx.executeQuery(); List<CFAccContactBuff> buffList = new LinkedList<CFAccContactBuff>(); while (resultSet.next()) { CFAccContactBuff buff = unpackContactResultSetToBuff(resultSet); buffList.add(buff); } 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; } } }