List of usage examples for java.sql Types SMALLINT
int SMALLINT
To view the source code for java.sql Types SMALLINT.
Click Source Link
The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type SMALLINT
.
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstOracle.CFAstOracleISOLanguageTable.java
public void updateISOLanguage(CFAstAuthorization Authorization, CFAstISOLanguageBuff Buff) { final String S_ProcName = "updateISOLanguage"; ResultSet resultSet = null;//ww w . java 2 s .c o m Connection cnx = schema.getCnx(); CallableStatement stmtUpdateByPKey = null; List<CFAstISOLanguageBuff> buffList = new LinkedList<CFAstISOLanguageBuff>(); 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()) { 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().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.cfacc.v2_0.CFAccOracle.CFAccOracleISOLanguageTable.java
public void updateISOLanguage(CFAccAuthorization Authorization, CFAccISOLanguageBuff Buff) { final String S_ProcName = "updateISOLanguage"; ResultSet resultSet = null;/*www . j a va 2 s . c o m*/ Connection cnx = schema.getCnx(); CallableStatement stmtUpdateByPKey = null; List<CFAccISOLanguageBuff> buffList = new LinkedList<CFAccISOLanguageBuff>(); 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.getLowerSchemaDbName() + ".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()) { CFAccISOLanguageBuff 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.cfcrm.v2_1.CFCrmMySql.CFCrmMySqlContactTable.java
public CFCrmContactBuff[] readBuffByTimezoneIdx(CFCrmAuthorization Authorization, Short ISOTimezoneId) { final String S_ProcName = "readBuffByTimezoneIdx"; ResultSet resultSet = null;//from www. java2 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.CFAccMSSql.CFAccMSSqlAddressTable.java
public CFAccAddressBuff[] readBuffByCountryIdx(CFAccAuthorization Authorization, Short CountryId) { final String S_ProcName = "readBuffByCountryIdx"; ResultSet resultSet = null;//w w w.j av a2 s. c o m try { Connection cnx = schema.getCnx(); String sql = "{ call sp_read_address_by_countryidx( ?, ?, ?, ?, ?" + ", " + "?" + " ) }"; if (stmtReadBuffByCountryIdx == null) { stmtReadBuffByCountryIdx = cnx.prepareStatement(sql); } int argIdx = 1; 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 (CountryId != null) { stmtReadBuffByCountryIdx.setShort(argIdx++, CountryId.shortValue()); } else { stmtReadBuffByCountryIdx.setNull(argIdx++, java.sql.Types.SMALLINT); } resultSet = stmtReadBuffByCountryIdx.executeQuery(); List<CFAccAddressBuff> buffList = new LinkedList<CFAccAddressBuff>(); if (resultSet != null) { while (resultSet.next()) { CFAccAddressBuff buff = unpackAddressResultSetToBuff(resultSet); buffList.add(buff); } } int idx = 0; CFAccAddressBuff[] retBuff = new CFAccAddressBuff[buffList.size()]; Iterator<CFAccAddressBuff> 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 updateContactURL(CFCrmAuthorization Authorization, CFCrmContactURLBuff Buff) { final String S_ProcName = "updateContactURL"; ResultSet resultSet = null;//from w w w .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.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleISOLanguageTable.java
public void updateISOLanguage(CFEnSyntaxAuthorization Authorization, CFEnSyntaxISOLanguageBuff Buff) { final String S_ProcName = "updateISOLanguage"; ResultSet resultSet = null;//from w w w. j a va2 s . com 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.cfacc.v2_0.CFAccMSSql.CFAccMSSqlContactTable.java
public CFAccContactBuff[] readBuffByTimezoneIdx(CFAccAuthorization Authorization, Short ISOTimezoneId) { final String S_ProcName = "readBuffByTimezoneIdx"; ResultSet resultSet = null;//from w w w. j a v a 2 s .c om 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.cfacc.v2_0.CFAccMSSql.CFAccMSSqlContactURLTable.java
public void updateContactURL(CFAccAuthorization Authorization, CFAccContactURLBuff Buff) { final String S_ProcName = "updateContactURL"; ResultSet resultSet = null;// w w w. ja va2 s .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()) { 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.CFAccMySql.CFAccMySqlAddressTable.java
public CFAccAddressBuff[] readBuffByCountryIdx(CFAccAuthorization Authorization, Short CountryId) { final String S_ProcName = "readBuffByCountryIdx"; ResultSet resultSet = null;//from w ww.j a v a 2 s .co m try { Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerSchemaDbName() + ".sp_read_address_by_countryidx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtReadBuffByCountryIdx == null) { stmtReadBuffByCountryIdx = cnx.prepareStatement(sql); } int argIdx = 1; 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 (CountryId != null) { stmtReadBuffByCountryIdx.setShort(argIdx++, CountryId.shortValue()); } else { stmtReadBuffByCountryIdx.setNull(argIdx++, java.sql.Types.SMALLINT); } try { resultSet = stmtReadBuffByCountryIdx.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } List<CFAccAddressBuff> buffList = new LinkedList<CFAccAddressBuff>(); while ((resultSet != null) && resultSet.next()) { CFAccAddressBuff buff = unpackAddressResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFAccAddressBuff[] retBuff = new CFAccAddressBuff[buffList.size()]; Iterator<CFAccAddressBuff> 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.CFAccMySqlContactTable.java
public CFAccContactBuff[] readBuffByTimezoneIdx(CFAccAuthorization Authorization, Short ISOTimezoneId) { final String S_ProcName = "readBuffByTimezoneIdx"; ResultSet resultSet = null;//from w w w . j av a 2 s . co 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; } } }