List of usage examples for java.sql Types BIGINT
int BIGINT
To view the source code for java.sql Types BIGINT.
Click Source Link
The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type BIGINT
.
From source file:com.flexive.ejb.beans.BriefcaseEngineBean.java
/** * {@inheritDoc}//from w w w. j a v a 2s . c om */ @Override @TransactionAttribute(TransactionAttributeType.REQUIRED) public void addItemData(long briefcaseId, List<BriefcaseItemData> itemDatas) throws FxApplicationException { if (itemDatas == null || itemDatas.size() == 0) return; Briefcase br = load(briefcaseId); // check read permissions Connection con = null; PreparedStatement stmt = null; long lastId = -1; int pos = -1; try { con = Database.getDbConnection(); for (BriefcaseItemData itemData : itemDatas) { if (lastId != itemData.getId()) { lastId = itemData.getId(); if (stmt != null) { stmt.executeBatch(); stmt.close(); } //existance check and evaluate position stmt = con.prepareStatement( "SELECT COUNT(*) FROM " + TBL_BRIEFCASE_DATA + " WHERE briefcase_id=? AND id=?"); stmt.setLong(1, briefcaseId); stmt.setLong(2, itemData.getId()); ResultSet rs = stmt.executeQuery(); if (rs == null || !rs.next() || rs.getLong(1) != 1) throw new FxNotFoundException(LOG, "ex.briefcase.notFound.item", itemData.getId(), br.getName()); stmt.close(); stmt = con.prepareStatement( "SELECT MAX(pos) FROM " + TBL_BRIEFCASE_DATA_ITEM + " WHERE briefcase_id=? AND id=?"); stmt.setLong(1, briefcaseId); stmt.setLong(2, itemData.getId()); rs = stmt.executeQuery(); pos = rs.next() ? rs.getInt(1) : 0; stmt.close(); stmt = con.prepareStatement("INSERT INTO " + TBL_BRIEFCASE_DATA_ITEM + "(briefcase_id, id, pos, intflag1, intflag2, intflag3, longflag1, longflag2, metadata) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"); stmt.setLong(1, briefcaseId); stmt.setLong(2, itemData.getId()); } if (stmt == null) { LOG.fatal("PreparedStatement was null trying to add briefcase item data!"); continue; } stmt.setLong(3, ++pos); if (itemData.isIntFlagSet(1)) stmt.setInt(4, itemData.getIntFlag1()); else stmt.setNull(4, Types.INTEGER); if (itemData.isIntFlagSet(2)) stmt.setInt(5, itemData.getIntFlag2()); else stmt.setNull(5, Types.INTEGER); if (itemData.isIntFlagSet(3)) stmt.setInt(6, itemData.getIntFlag3()); else stmt.setNull(6, Types.INTEGER); if (itemData.isLongFlagSet(1)) stmt.setLong(7, itemData.getLongFlag1()); else stmt.setNull(7, Types.BIGINT); if (itemData.isLongFlagSet(2)) stmt.setLong(8, itemData.getLongFlag2()); else stmt.setNull(8, Types.BIGINT); stmt.setString(9, itemData.getMetaData()); stmt.addBatch(); } if (stmt != null) stmt.executeBatch(); } catch (Exception e) { EJBUtils.rollback(ctx); throw new FxUpdateException(LOG, e, "ex.briefcase.addItemData", br.getName(), lastId, e.getMessage()); } finally { Database.closeObjects(BriefcaseEngineBean.class, con, stmt); } }
From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlEnHeadTable.java
public void updateEnHead(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnHeadBuff Buff) { final String S_ProcName = "updateEnHead"; ResultSet resultSet = null;/*w w w. j a v a 2 s. com*/ try { String ClassCode = Buff.getClassCode(); long Id = Buff.getRequiredId(); Long ScopeId = Buff.getOptionalScopeId(); String Name = Buff.getRequiredName(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_update_enhead( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; 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++, ClassCode); stmtUpdateByPKey.setLong(argIdx++, Id); if (ScopeId != null) { stmtUpdateByPKey.setLong(argIdx++, ScopeId.longValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } stmtUpdateByPKey.setString(argIdx++, Name); stmtUpdateByPKey.setInt(argIdx++, Revision); try { resultSet = stmtUpdateByPKey.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } if ((resultSet != null) && resultSet.next()) { CFEnSyntaxEnHeadBuff updatedBuff = unpackEnHeadResultSetToBuff(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.setOptionalScopeId(updatedBuff.getOptionalScopeId()); Buff.setRequiredName(updatedBuff.getRequiredName()); 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.CFEnSyntaxMySql.CFEnSyntaxMySqlEnWordTable.java
public void updateEnWord(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnWordBuff Buff) { final String S_ProcName = "updateEnWord"; ResultSet resultSet = null;// ww w. jav a2s.c om try { String ClassCode = Buff.getClassCode(); long Id = Buff.getRequiredId(); Long ScopeId = Buff.getOptionalScopeId(); String Name = Buff.getRequiredName(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_update_enword( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; 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++, ClassCode); stmtUpdateByPKey.setLong(argIdx++, Id); if (ScopeId != null) { stmtUpdateByPKey.setLong(argIdx++, ScopeId.longValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } stmtUpdateByPKey.setString(argIdx++, Name); stmtUpdateByPKey.setInt(argIdx++, Revision); try { resultSet = stmtUpdateByPKey.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } if ((resultSet != null) && resultSet.next()) { CFEnSyntaxEnWordBuff updatedBuff = unpackEnWordResultSetToBuff(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.setOptionalScopeId(updatedBuff.getOptionalScopeId()); Buff.setRequiredName(updatedBuff.getRequiredName()); 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.CFEnSyntaxMySql.CFEnSyntaxMySqlEnTenseTable.java
public void updateEnTense(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnTenseBuff Buff) { final String S_ProcName = "updateEnTense"; ResultSet resultSet = null;//from w w w .j av a2 s . c om try { String ClassCode = Buff.getClassCode(); long Id = Buff.getRequiredId(); Long ScopeId = Buff.getOptionalScopeId(); String Name = Buff.getRequiredName(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_update_entense( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; 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++, ClassCode); stmtUpdateByPKey.setLong(argIdx++, Id); if (ScopeId != null) { stmtUpdateByPKey.setLong(argIdx++, ScopeId.longValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } stmtUpdateByPKey.setString(argIdx++, Name); stmtUpdateByPKey.setInt(argIdx++, Revision); try { resultSet = stmtUpdateByPKey.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } if ((resultSet != null) && resultSet.next()) { CFEnSyntaxEnTenseBuff updatedBuff = unpackEnTenseResultSetToBuff(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.setOptionalScopeId(updatedBuff.getOptionalScopeId()); Buff.setRequiredName(updatedBuff.getRequiredName()); 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.CFEnSyntaxMySql.CFEnSyntaxMySqlEnObjectTable.java
public void updateEnObject(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnObjectBuff Buff) { final String S_ProcName = "updateEnObject"; ResultSet resultSet = null;/* w ww . j a v a 2 s. c om*/ try { String ClassCode = Buff.getClassCode(); long Id = Buff.getRequiredId(); Long ScopeId = Buff.getOptionalScopeId(); String Name = Buff.getRequiredName(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_update_enobj( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; 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++, ClassCode); stmtUpdateByPKey.setLong(argIdx++, Id); if (ScopeId != null) { stmtUpdateByPKey.setLong(argIdx++, ScopeId.longValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } stmtUpdateByPKey.setString(argIdx++, Name); stmtUpdateByPKey.setInt(argIdx++, Revision); try { resultSet = stmtUpdateByPKey.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } if ((resultSet != null) && resultSet.next()) { CFEnSyntaxEnObjectBuff updatedBuff = unpackEnObjectResultSetToBuff(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.setOptionalScopeId(updatedBuff.getOptionalScopeId()); Buff.setRequiredName(updatedBuff.getRequiredName()); 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.CFEnSyntaxMySql.CFEnSyntaxMySqlEnClauseTable.java
public void updateEnClause(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnClauseBuff Buff) { final String S_ProcName = "updateEnClause"; ResultSet resultSet = null;//from w ww . ja v a 2s . c o m try { String ClassCode = Buff.getClassCode(); long Id = Buff.getRequiredId(); Long ScopeId = Buff.getOptionalScopeId(); String Name = Buff.getRequiredName(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_update_enclause( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; 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++, ClassCode); stmtUpdateByPKey.setLong(argIdx++, Id); if (ScopeId != null) { stmtUpdateByPKey.setLong(argIdx++, ScopeId.longValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } stmtUpdateByPKey.setString(argIdx++, Name); stmtUpdateByPKey.setInt(argIdx++, Revision); try { resultSet = stmtUpdateByPKey.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } if ((resultSet != null) && resultSet.next()) { CFEnSyntaxEnClauseBuff updatedBuff = unpackEnClauseResultSetToBuff(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.setOptionalScopeId(updatedBuff.getOptionalScopeId()); Buff.setRequiredName(updatedBuff.getRequiredName()); 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.CFEnSyntaxMySql.CFEnSyntaxMySqlEnPhraseTable.java
public void updateEnPhrase(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnPhraseBuff Buff) { final String S_ProcName = "updateEnPhrase"; ResultSet resultSet = null;/*from w w w . java2 s.c o m*/ try { String ClassCode = Buff.getClassCode(); long Id = Buff.getRequiredId(); Long ScopeId = Buff.getOptionalScopeId(); String Name = Buff.getRequiredName(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_update_enphrase( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; 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++, ClassCode); stmtUpdateByPKey.setLong(argIdx++, Id); if (ScopeId != null) { stmtUpdateByPKey.setLong(argIdx++, ScopeId.longValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } stmtUpdateByPKey.setString(argIdx++, Name); stmtUpdateByPKey.setInt(argIdx++, Revision); try { resultSet = stmtUpdateByPKey.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } if ((resultSet != null) && resultSet.next()) { CFEnSyntaxEnPhraseBuff updatedBuff = unpackEnPhraseResultSetToBuff(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.setOptionalScopeId(updatedBuff.getOptionalScopeId()); Buff.setRequiredName(updatedBuff.getRequiredName()); 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.CFEnSyntaxMySql.CFEnSyntaxMySqlEnSubjectTable.java
public void updateEnSubject(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnSubjectBuff Buff) { final String S_ProcName = "updateEnSubject"; ResultSet resultSet = null;//from w w w.j a v a 2 s .c o m try { String ClassCode = Buff.getClassCode(); long Id = Buff.getRequiredId(); Long ScopeId = Buff.getOptionalScopeId(); String Name = Buff.getRequiredName(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_update_ensubj( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; 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++, ClassCode); stmtUpdateByPKey.setLong(argIdx++, Id); if (ScopeId != null) { stmtUpdateByPKey.setLong(argIdx++, ScopeId.longValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } stmtUpdateByPKey.setString(argIdx++, Name); stmtUpdateByPKey.setInt(argIdx++, Revision); try { resultSet = stmtUpdateByPKey.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } if ((resultSet != null) && resultSet.next()) { CFEnSyntaxEnSubjectBuff updatedBuff = unpackEnSubjectResultSetToBuff(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.setOptionalScopeId(updatedBuff.getOptionalScopeId()); Buff.setRequiredName(updatedBuff.getRequiredName()); 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.CFEnSyntaxMySql.CFEnSyntaxMySqlEnSentenceTable.java
public void updateEnSentence(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnSentenceBuff Buff) { final String S_ProcName = "updateEnSentence"; ResultSet resultSet = null;/*www.j a va 2 s .co m*/ try { String ClassCode = Buff.getClassCode(); long Id = Buff.getRequiredId(); Long ScopeId = Buff.getOptionalScopeId(); String Name = Buff.getRequiredName(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_update_ensent( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; 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++, ClassCode); stmtUpdateByPKey.setLong(argIdx++, Id); if (ScopeId != null) { stmtUpdateByPKey.setLong(argIdx++, ScopeId.longValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } stmtUpdateByPKey.setString(argIdx++, Name); stmtUpdateByPKey.setInt(argIdx++, Revision); try { resultSet = stmtUpdateByPKey.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } if ((resultSet != null) && resultSet.next()) { CFEnSyntaxEnSentenceBuff updatedBuff = unpackEnSentenceResultSetToBuff(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.setOptionalScopeId(updatedBuff.getOptionalScopeId()); Buff.setRequiredName(updatedBuff.getRequiredName()); 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.CFEnSyntaxMySql.CFEnSyntaxMySqlEnModifierTable.java
public void updateEnModifier(CFEnSyntaxAuthorization Authorization, CFEnSyntaxEnModifierBuff Buff) { final String S_ProcName = "updateEnModifier"; ResultSet resultSet = null;//from w w w .j ava2 s . c o m try { String ClassCode = Buff.getClassCode(); long Id = Buff.getRequiredId(); Long ScopeId = Buff.getOptionalScopeId(); String Name = Buff.getRequiredName(); int Revision = Buff.getRequiredRevision(); Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_update_enmodif( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + ", " + "?" + ", " + "?" + " )"; 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++, ClassCode); stmtUpdateByPKey.setLong(argIdx++, Id); if (ScopeId != null) { stmtUpdateByPKey.setLong(argIdx++, ScopeId.longValue()); } else { stmtUpdateByPKey.setNull(argIdx++, java.sql.Types.BIGINT); } stmtUpdateByPKey.setString(argIdx++, Name); stmtUpdateByPKey.setInt(argIdx++, Revision); try { resultSet = stmtUpdateByPKey.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } if ((resultSet != null) && resultSet.next()) { CFEnSyntaxEnModifierBuff updatedBuff = unpackEnModifierResultSetToBuff(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.setOptionalScopeId(updatedBuff.getOptionalScopeId()); Buff.setRequiredName(updatedBuff.getRequiredName()); 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; } } }