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:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccPgSql.CFAccPgSqlAccountEntryTable.java
public CFAccAccountEntryBuff[] readBuffByXfrAcctIdx(CFAccAuthorization Authorization, Long TransferTenantId, Long TransferAccountId) { final String S_ProcName = "readBuffByXfrAcctIdx"; ResultSet resultSet = null;//from w ww. ja v a 2 s . c om try { Connection cnx = schema.getCnx(); String sql = "SELECT * FROM " + schema.getLowerSchemaDbName() + ".sp_read_ac_entry_by_xfracctidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )"; if (stmtReadBuffByXfrAcctIdx == null) { stmtReadBuffByXfrAcctIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByXfrAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByXfrAcctIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByXfrAcctIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByXfrAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByXfrAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (TransferTenantId != null) { stmtReadBuffByXfrAcctIdx.setLong(argIdx++, TransferTenantId.longValue()); } else { stmtReadBuffByXfrAcctIdx.setNull(argIdx++, java.sql.Types.BIGINT); } if (TransferAccountId != null) { stmtReadBuffByXfrAcctIdx.setLong(argIdx++, TransferAccountId.longValue()); } else { stmtReadBuffByXfrAcctIdx.setNull(argIdx++, java.sql.Types.BIGINT); } resultSet = stmtReadBuffByXfrAcctIdx.executeQuery(); List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>(); while (resultSet.next()) { CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFAccAccountEntryBuff[] retBuff = new CFAccAccountEntryBuff[buffList.size()]; Iterator<CFAccAccountEntryBuff> 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:helma.objectmodel.db.NodeManager.java
/** * Create a new Node from a ResultSet.//w w w .ja va2 s.co m */ public Node createNode(DbMapping dbm, ResultSet rs, DbColumn[] columns, int offset) throws SQLException, IOException, ClassNotFoundException { HashMap propBuffer = new HashMap(); String id = null; String name = null; String protoName = dbm.getTypeName(); DbMapping dbmap = dbm; Node node = new Node(safe); for (int i = 0; i < columns.length; i++) { int columnNumber = i + 1 + offset; // set prototype? if (columns[i].isPrototypeField()) { String protoId = rs.getString(columnNumber); protoName = dbm.getPrototypeName(protoId); if (protoName != null) { dbmap = getDbMapping(protoName); if (dbmap == null) { // invalid prototype name! app.logError("No prototype defined for prototype mapping \"" + protoName + "\" - Using default prototype \"" + dbm.getTypeName() + "\"."); dbmap = dbm; protoName = dbmap.getTypeName(); } } } // set id? if (columns[i].isIdField()) { id = rs.getString(columnNumber); // if id == null, the object doesn't actually exist - return null if (id == null) { return null; } } // set name? if (columns[i].isNameField()) { name = rs.getString(columnNumber); } Property newprop = new Property(node); switch (columns[i].getType()) { case Types.BIT: case Types.BOOLEAN: newprop.setBooleanValue(rs.getBoolean(columnNumber)); break; case Types.TINYINT: case Types.BIGINT: case Types.SMALLINT: case Types.INTEGER: newprop.setIntegerValue(rs.getLong(columnNumber)); break; case Types.REAL: case Types.FLOAT: case Types.DOUBLE: newprop.setFloatValue(rs.getDouble(columnNumber)); break; case Types.DECIMAL: case Types.NUMERIC: BigDecimal num = rs.getBigDecimal(columnNumber); if (num == null) { break; } if (num.scale() > 0) { newprop.setFloatValue(num.doubleValue()); } else { newprop.setIntegerValue(num.longValue()); } break; case Types.VARBINARY: case Types.BINARY: newprop.setJavaObjectValue(rs.getBytes(columnNumber)); break; case Types.BLOB: case Types.LONGVARBINARY: { InputStream in = rs.getBinaryStream(columnNumber); if (in == null) { break; } ByteArrayOutputStream bout = new ByteArrayOutputStream(); byte[] buffer = new byte[2048]; int read; while ((read = in.read(buffer)) > -1) { bout.write(buffer, 0, read); } newprop.setJavaObjectValue(bout.toByteArray()); } break; case Types.LONGVARCHAR: try { newprop.setStringValue(rs.getString(columnNumber)); } catch (SQLException x) { Reader in = rs.getCharacterStream(columnNumber); if (in == null) { newprop.setStringValue(null); break; } StringBuffer out = new StringBuffer(); char[] buffer = new char[2048]; int read; while ((read = in.read(buffer)) > -1) { out.append(buffer, 0, read); } newprop.setStringValue(out.toString()); } break; case Types.CHAR: case Types.VARCHAR: case Types.OTHER: newprop.setStringValue(rs.getString(columnNumber)); break; case Types.DATE: case Types.TIME: case Types.TIMESTAMP: newprop.setDateValue(rs.getTimestamp(columnNumber)); break; case Types.NULL: newprop.setStringValue(null); break; case Types.CLOB: Clob cl = rs.getClob(columnNumber); if (cl == null) { newprop.setStringValue(null); break; } char[] c = new char[(int) cl.length()]; Reader isr = cl.getCharacterStream(); isr.read(c); newprop.setStringValue(String.copyValueOf(c)); break; default: newprop.setStringValue(rs.getString(columnNumber)); break; } if (rs.wasNull()) { newprop.setStringValue(null); } propBuffer.put(columns[i].getName(), newprop); // mark property as clean, since it's fresh from the db newprop.dirty = false; } if (id == null) { return null; } else { Transactor tx = Transactor.getInstance(); if (tx != null) { // Check if the node is already registered with the transactor - // it may be in the process of being DELETED, but do return the // new node if the old one has been marked as INVALID. DbKey key = new DbKey(dbmap, id); Node dirtyNode = tx.getDirtyNode(key); if (dirtyNode != null && dirtyNode.getState() != Node.INVALID) { return dirtyNode; } } } Hashtable propMap = new Hashtable(); DbColumn[] columns2 = dbmap.getColumns(); for (int i = 0; i < columns2.length; i++) { Relation rel = columns2[i].getRelation(); if (rel != null && rel.isPrimitiveOrReference()) { Property prop = (Property) propBuffer.get(columns2[i].getName()); if (prop == null) { continue; } prop.setName(rel.propName); // if the property is a pointer to another node, change the property type to NODE if (rel.isReference() && rel.usesPrimaryKey()) { // FIXME: References to anything other than the primary key are not supported prop.convertToNodeReference(rel); } propMap.put(rel.propName, prop); } } node.init(dbmap, id, name, protoName, propMap); return node; }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMSSql.CFAccMSSqlAccountEntryTable.java
public CFAccAccountEntryBuff[] readBuffByXfrAcctIdx(CFAccAuthorization Authorization, Long TransferTenantId, Long TransferAccountId) { final String S_ProcName = "readBuffByXfrAcctIdx"; ResultSet resultSet = null;//from w w w.j av a2 s. com try { Connection cnx = schema.getCnx(); String sql = "{ call sp_read_ac_entry_by_xfracctidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ) }"; if (stmtReadBuffByXfrAcctIdx == null) { stmtReadBuffByXfrAcctIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByXfrAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByXfrAcctIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByXfrAcctIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByXfrAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByXfrAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (TransferTenantId != null) { stmtReadBuffByXfrAcctIdx.setLong(argIdx++, TransferTenantId.longValue()); } else { stmtReadBuffByXfrAcctIdx.setNull(argIdx++, java.sql.Types.BIGINT); } if (TransferAccountId != null) { stmtReadBuffByXfrAcctIdx.setLong(argIdx++, TransferAccountId.longValue()); } else { stmtReadBuffByXfrAcctIdx.setNull(argIdx++, java.sql.Types.BIGINT); } resultSet = stmtReadBuffByXfrAcctIdx.executeQuery(); List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>(); if (resultSet != null) { while (resultSet.next()) { CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); buffList.add(buff); } } int idx = 0; CFAccAccountEntryBuff[] retBuff = new CFAccAccountEntryBuff[buffList.size()]; Iterator<CFAccAccountEntryBuff> 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.CFAccMySqlAccountEntryTable.java
public CFAccAccountEntryBuff[] readBuffByXfrAcctIdx(CFAccAuthorization Authorization, Long TransferTenantId, Long TransferAccountId) { final String S_ProcName = "readBuffByXfrAcctIdx"; ResultSet resultSet = null;/*from w ww. jav a2s .c o m*/ try { Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerSchemaDbName() + ".sp_read_ac_entry_by_xfracctidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )"; if (stmtReadBuffByXfrAcctIdx == null) { stmtReadBuffByXfrAcctIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByXfrAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByXfrAcctIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByXfrAcctIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByXfrAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByXfrAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (TransferTenantId != null) { stmtReadBuffByXfrAcctIdx.setLong(argIdx++, TransferTenantId.longValue()); } else { stmtReadBuffByXfrAcctIdx.setNull(argIdx++, java.sql.Types.BIGINT); } if (TransferAccountId != null) { stmtReadBuffByXfrAcctIdx.setLong(argIdx++, TransferAccountId.longValue()); } else { stmtReadBuffByXfrAcctIdx.setNull(argIdx++, java.sql.Types.BIGINT); } try { resultSet = stmtReadBuffByXfrAcctIdx.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>(); while ((resultSet != null) && resultSet.next()) { CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFAccAccountEntryBuff[] retBuff = new CFAccAccountEntryBuff[buffList.size()]; Iterator<CFAccAccountEntryBuff> 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.CFAccOracle.CFAccOracleAccountTable.java
public void deleteAccountByRollupAcctIdx(CFAccAuthorization Authorization, Long argRollupTenantId, Long argRollupAccountId) { final String S_ProcName = "deleteAccountByRollupAcctIdx"; ResultSet resultSet = null;//from ww w . ja va 2s . c o m try { Connection cnx = schema.getCnx(); String sql = "begin call " + schema.getLowerSchemaDbName() + ".dl_acctbyrollupacctidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end"; if (stmtDeleteByRollupAcctIdx == null) { stmtDeleteByRollupAcctIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByRollupAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByRollupAcctIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByRollupAcctIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByRollupAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByRollupAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argRollupTenantId != null) { stmtDeleteByRollupAcctIdx.setLong(argIdx++, argRollupTenantId.longValue()); } else { stmtDeleteByRollupAcctIdx.setNull(argIdx++, java.sql.Types.BIGINT); } if (argRollupAccountId != null) { stmtDeleteByRollupAcctIdx.setLong(argIdx++, argRollupAccountId.longValue()); } else { stmtDeleteByRollupAcctIdx.setNull(argIdx++, java.sql.Types.BIGINT); } int rowsUpdated = stmtDeleteByRollupAcctIdx.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.CFAccPgSql.CFAccPgSqlAccountConfigTable.java
public void deleteAccountConfigByCustCtcLstIdx(CFAccAuthorization Authorization, Long argCustContactListTenantId, Long argCustContactListId) { final String S_ProcName = "deleteAccountConfigByCustCtcLstIdx"; ResultSet resultSet = null;/* w w w .j ava2 s. c o m*/ try { Connection cnx = schema.getCnx(); String sql = "SELECT " + schema.getLowerSchemaDbName() + ".sp_delete_acct_cfg_by_custctclstidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ) as DeletedFlag"; if (stmtDeleteByCustCtcLstIdx == null) { stmtDeleteByCustCtcLstIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByCustCtcLstIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByCustCtcLstIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByCustCtcLstIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByCustCtcLstIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByCustCtcLstIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argCustContactListTenantId != null) { stmtDeleteByCustCtcLstIdx.setLong(argIdx++, argCustContactListTenantId.longValue()); } else { stmtDeleteByCustCtcLstIdx.setNull(argIdx++, java.sql.Types.BIGINT); } if (argCustContactListId != null) { stmtDeleteByCustCtcLstIdx.setLong(argIdx++, argCustContactListId.longValue()); } else { stmtDeleteByCustCtcLstIdx.setNull(argIdx++, java.sql.Types.BIGINT); } resultSet = stmtDeleteByCustCtcLstIdx.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.CFAccDb2LUW.CFAccDb2LUWAccountConfigTable.java
public void deleteAccountConfigByCustCtcLstIdx(CFAccAuthorization Authorization, Long argCustContactListTenantId, Long argCustContactListId) { final String S_ProcName = "deleteAccountConfigByCustCtcLstIdx"; ResultSet resultSet = null;//from w ww . jav a2 s. c o m try { Connection cnx = schema.getCnx(); final String sql = "CALL sp_delete_acct_cfg_by_custctclstidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )"; if (stmtDeleteByCustCtcLstIdx == null) { stmtDeleteByCustCtcLstIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByCustCtcLstIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByCustCtcLstIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByCustCtcLstIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByCustCtcLstIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByCustCtcLstIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argCustContactListTenantId != null) { stmtDeleteByCustCtcLstIdx.setLong(argIdx++, argCustContactListTenantId.longValue()); } else { stmtDeleteByCustCtcLstIdx.setNull(argIdx++, java.sql.Types.BIGINT); } if (argCustContactListId != null) { stmtDeleteByCustCtcLstIdx.setLong(argIdx++, argCustContactListId.longValue()); } else { stmtDeleteByCustCtcLstIdx.setNull(argIdx++, java.sql.Types.BIGINT); } resultSet = stmtDeleteByCustCtcLstIdx.executeQuery(); if (resultSet.next()) { int deleteFlag = resultSet.getInt(1); if (resultSet.next()) { resultSet.last(); throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect multi-record response, " + resultSet.getRow() + " rows selected"); } } 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.CFAccMySql.CFAccMySqlAccountConfigTable.java
public void deleteAccountConfigByCustCtcLstIdx(CFAccAuthorization Authorization, Long argCustContactListTenantId, Long argCustContactListId) { final String S_ProcName = "deleteAccountConfigByCustCtcLstIdx"; ResultSet resultSet = null;/*from w w w .j a va 2 s . c o m*/ try { Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerSchemaDbName() + ".sp_delete_acct_cfg_by_custctclstidx( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )"; if (stmtDeleteByCustCtcLstIdx == null) { stmtDeleteByCustCtcLstIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByCustCtcLstIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByCustCtcLstIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByCustCtcLstIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByCustCtcLstIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByCustCtcLstIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argCustContactListTenantId != null) { stmtDeleteByCustCtcLstIdx.setLong(argIdx++, argCustContactListTenantId.longValue()); } else { stmtDeleteByCustCtcLstIdx.setNull(argIdx++, java.sql.Types.BIGINT); } if (argCustContactListId != null) { stmtDeleteByCustCtcLstIdx.setLong(argIdx++, argCustContactListId.longValue()); } else { stmtDeleteByCustCtcLstIdx.setNull(argIdx++, java.sql.Types.BIGINT); } stmtDeleteByCustCtcLstIdx.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.CFAccMSSql.CFAccMSSqlAccountConfigTable.java
public void deleteAccountConfigByCustCtcLstIdx(CFAccAuthorization Authorization, Long argCustContactListTenantId, Long argCustContactListId) { final String S_ProcName = "deleteAccountConfigByCustCtcLstIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }// w ww . j a va 2 s . c om ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); String sql = "exec sp_delete_acct_cfg_by_custctclstidx ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?"; if (stmtDeleteByCustCtcLstIdx == null) { stmtDeleteByCustCtcLstIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtDeleteByCustCtcLstIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByCustCtcLstIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtDeleteByCustCtcLstIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtDeleteByCustCtcLstIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtDeleteByCustCtcLstIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (argCustContactListTenantId != null) { stmtDeleteByCustCtcLstIdx.setLong(argIdx++, argCustContactListTenantId.longValue()); } else { stmtDeleteByCustCtcLstIdx.setNull(argIdx++, java.sql.Types.BIGINT); } if (argCustContactListId != null) { stmtDeleteByCustCtcLstIdx.setLong(argIdx++, argCustContactListId.longValue()); } else { stmtDeleteByCustCtcLstIdx.setNull(argIdx++, java.sql.Types.BIGINT); } Object stuff = null; boolean moreResults = stmtDeleteByCustCtcLstIdx.execute(); while (stuff == null) { try { moreResults = stmtDeleteByCustCtcLstIdx.getMoreResults(); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } if (moreResults) { try { stuff = stmtDeleteByCustCtcLstIdx.getResultSet(); } catch (SQLException e) { } } else if (-1 == stmtDeleteByCustCtcLstIdx.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.CFAccOracle.CFAccOracleAccountEntryTable.java
public CFAccAccountEntryBuff[] readBuffByXfrAcctIdx(CFAccAuthorization Authorization, Long TransferTenantId, Long TransferAccountId) { final String S_ProcName = "readBuffByXfrAcctIdx"; ResultSet resultSet = null;/*from w w w .ja v a2s .c o m*/ Connection cnx = schema.getCnx(); CallableStatement stmtReadBuffByXfrAcctIdx = null; List<CFAccAccountEntryBuff> buffList = new LinkedList<CFAccAccountEntryBuff>(); try { stmtReadBuffByXfrAcctIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName() + ".rd_ac_entrybyxfracctidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadBuffByXfrAcctIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR); stmtReadBuffByXfrAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByXfrAcctIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByXfrAcctIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByXfrAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByXfrAcctIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); if (TransferTenantId != null) { stmtReadBuffByXfrAcctIdx.setLong(argIdx++, TransferTenantId.longValue()); } else { stmtReadBuffByXfrAcctIdx.setNull(argIdx++, java.sql.Types.BIGINT); } if (TransferAccountId != null) { stmtReadBuffByXfrAcctIdx.setLong(argIdx++, TransferAccountId.longValue()); } else { stmtReadBuffByXfrAcctIdx.setNull(argIdx++, java.sql.Types.BIGINT); } stmtReadBuffByXfrAcctIdx.execute(); resultSet = (ResultSet) stmtReadBuffByXfrAcctIdx.getObject(1); if (resultSet != null) { try { while (resultSet.next()) { CFAccAccountEntryBuff buff = unpackAccountEntryResultSetToBuff(resultSet); buffList.add(buff); } try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } catch (SQLException e) { } } int idx = 0; CFAccAccountEntryBuff[] retBuff = new CFAccAccountEntryBuff[buffList.size()]; Iterator<CFAccAccountEntryBuff> 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 (stmtReadBuffByXfrAcctIdx != null) { try { stmtReadBuffByXfrAcctIdx.close(); } catch (SQLException e) { } stmtReadBuffByXfrAcctIdx = null; } } }