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.bt.aloha.batchtest.PerformanceMeasurmentDao.java
public boolean record(String name, long runId, Metrics m) throws IllegalStateException { if (!exists) { log.warn("record skipped as schema does not exists"); return false; }/*from w w w . j a va 2 s. c om*/ long id = generateId(); String desc = m.getDescription() == null ? "" : m.getDescription().substring(0, Math.min(4096, m.getDescription().length())); Object[] args = new Object[] { id, runId, name, m.getUnitsPerSecond(), m.getAverageDuration(), m.getNumberOfRuns(), m.getNumberOfSuccessfulRuns(), m.getVariance(), m.getStandardDeviation(), new Timestamp(System.currentTimeMillis()), m.isSuccess(), desc, m.getThreadInfo(), m.getTestType() }; int[] types = new int[] { Types.BIGINT, Types.BIGINT, Types.VARCHAR, Types.DOUBLE, Types.DOUBLE, Types.BIGINT, Types.BIGINT, Types.DOUBLE, Types.DOUBLE, Types.TIMESTAMP, Types.BOOLEAN, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR }; try { int updated = jdbcTemplate.update( "insert into Performance (id, runid, name, unitPerSecond, averageDuration, numberOfRuns, " + "numberOfSuccessfulRuns, variance, standardDeviation, whenCreated, success, description, threadInfo, testType) " + "values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", args, types); if (updated < 1) log.warn("no rows inserted into performance table"); return updated == 1; } catch (RuntimeException e) { throw new IllegalStateException("Unable to record data", e); } }
From source file:com.flexive.core.storage.GenericDivisionExporter.java
/** * Dump a generic table to XML//from ww w. j av a 2s .c o m * * @param tableName name of the table * @param stmt an open statement * @param out output stream * @param sb an available and valid StringBuilder * @param xmlTag name of the xml tag to write per row * @param idColumn (optional) id column to sort results * @param onlyBinaries process binary fields (else these will be ignored) * @throws SQLException on errors * @throws IOException on errors */ private void dumpTable(String tableName, Statement stmt, OutputStream out, StringBuilder sb, String xmlTag, String idColumn, boolean onlyBinaries) throws SQLException, IOException { ResultSet rs = stmt.executeQuery("SELECT * FROM " + tableName + (StringUtils.isEmpty(idColumn) ? "" : " ORDER BY " + idColumn + " ASC")); final ResultSetMetaData md = rs.getMetaData(); String value, att; boolean hasSubTags; while (rs.next()) { hasSubTags = false; if (!onlyBinaries) { sb.setLength(0); sb.append(" <").append(xmlTag); } for (int i = 1; i <= md.getColumnCount(); i++) { value = null; att = md.getColumnName(i).toLowerCase(); switch (md.getColumnType(i)) { case java.sql.Types.DECIMAL: case java.sql.Types.NUMERIC: case java.sql.Types.BIGINT: if (!onlyBinaries) { value = String.valueOf(rs.getBigDecimal(i)); if (rs.wasNull()) value = null; } break; case java.sql.Types.INTEGER: case java.sql.Types.SMALLINT: case java.sql.Types.TINYINT: if (!onlyBinaries) { value = String.valueOf(rs.getLong(i)); if (rs.wasNull()) value = null; } break; case java.sql.Types.DOUBLE: case java.sql.Types.FLOAT: case java.sql.Types.REAL: if (!onlyBinaries) { value = String.valueOf(rs.getDouble(i)); if (rs.wasNull()) value = null; } break; case java.sql.Types.TIMESTAMP: case java.sql.Types.DATE: if (!onlyBinaries) { final Timestamp ts = rs.getTimestamp(i); if (rs.wasNull()) value = null; else value = FxFormatUtils.getDateTimeFormat().format(ts); } break; case java.sql.Types.BIT: case java.sql.Types.CHAR: case java.sql.Types.BOOLEAN: if (!onlyBinaries) { value = rs.getBoolean(i) ? "1" : "0"; if (rs.wasNull()) value = null; } break; case java.sql.Types.CLOB: case java.sql.Types.BLOB: case java.sql.Types.LONGVARBINARY: case java.sql.Types.LONGVARCHAR: case java.sql.Types.VARBINARY: case java.sql.Types.VARCHAR: case java.sql.Types.BINARY: case SQL_LONGNVARCHAR: case SQL_NCHAR: case SQL_NCLOB: case SQL_NVARCHAR: hasSubTags = true; break; default: LOG.warn("Unhandled type [" + md.getColumnType(i) + "] for [" + tableName + "." + att + "]"); } if (value != null && !onlyBinaries) sb.append(' ').append(att).append("=\"").append(value).append("\""); } if (hasSubTags) { if (!onlyBinaries) sb.append(">\n"); for (int i = 1; i <= md.getColumnCount(); i++) { switch (md.getColumnType(i)) { case java.sql.Types.VARBINARY: case java.sql.Types.LONGVARBINARY: case java.sql.Types.BLOB: case java.sql.Types.BINARY: if (idColumn == null) throw new IllegalArgumentException("Id column required to process binaries!"); String binFile = FOLDER_BINARY + "/BIN_" + String.valueOf(rs.getLong(idColumn)) + "_" + i + ".blob"; att = md.getColumnName(i).toLowerCase(); if (onlyBinaries) { if (!(out instanceof ZipOutputStream)) throw new IllegalArgumentException( "out has to be a ZipOutputStream to store binaries!"); ZipOutputStream zip = (ZipOutputStream) out; InputStream in = rs.getBinaryStream(i); if (rs.wasNull()) break; ZipEntry ze = new ZipEntry(binFile); zip.putNextEntry(ze); byte[] buffer = new byte[4096]; int read; while ((read = in.read(buffer)) != -1) zip.write(buffer, 0, read); in.close(); zip.closeEntry(); zip.flush(); } else { InputStream in = rs.getBinaryStream(i); //need to fetch to see if it is empty if (rs.wasNull()) break; in.close(); sb.append(" <").append(att).append(">").append(binFile).append("</").append(att) .append(">\n"); } break; case java.sql.Types.CLOB: case SQL_LONGNVARCHAR: case SQL_NCHAR: case SQL_NCLOB: case SQL_NVARCHAR: case java.sql.Types.LONGVARCHAR: case java.sql.Types.VARCHAR: if (!onlyBinaries) { value = rs.getString(i); if (rs.wasNull()) break; att = md.getColumnName(i).toLowerCase(); sb.append(" <").append(att).append('>'); escape(sb, value); sb.append("</").append(att).append(">\n"); } break; } } if (!onlyBinaries) sb.append(" </").append(xmlTag).append(">\n"); } else { if (!onlyBinaries) sb.append("/>\n"); } if (!onlyBinaries) write(out, sb); } }
From source file:com.splicemachine.db.impl.sql.compile.QueryTreeNode.java
/** * Bind the parameters of OFFSET n ROWS and FETCH FIRST n ROWS ONLY, if * any.//from w w w . j a v a 2 s . c o m * * @param offset the OFFSET parameter, if any * @param fetchFirst the FETCH parameter, if any * @throws StandardException Thrown on error */ public static void bindOffsetFetch(ValueNode offset, ValueNode fetchFirst) throws StandardException { if (offset instanceof ConstantNode) { DataValueDescriptor dvd = ((ConstantNode) offset).getValue(); long val = dvd.getLong(); if (val < 0) { throw StandardException.newException(SQLState.LANG_INVALID_ROW_COUNT_OFFSET, Long.toString(val)); } } else if (offset instanceof ParameterNode) { offset.setType(new DataTypeDescriptor(TypeId.getBuiltInTypeId(Types.BIGINT), false /* ignored tho; ends up nullable, so we test for NULL at execute time */)); } if (fetchFirst instanceof ConstantNode) { DataValueDescriptor dvd = ((ConstantNode) fetchFirst).getValue(); long val = dvd.getLong(); if (val < 1) { throw StandardException.newException(SQLState.LANG_INVALID_ROW_COUNT_FIRST, Long.toString(val)); } } else if (fetchFirst instanceof ParameterNode) { fetchFirst.setType(new DataTypeDescriptor(TypeId.getBuiltInTypeId(Types.BIGINT), false /* ignored tho; ends up nullable, so we test for NULL at execute time*/)); } }
From source file:dk.netarkivet.harvester.datamodel.HarvestDefinitionDBDAO.java
/** * Create a harvest definition in Database. The harvest definition object * should not have its ID set unless we are in the middle of migrating. * * @param harvestDefinition// w w w . j a v a 2 s . c o m * A new harvest definition to store in the database. * @return The harvestId for the just created harvest definition. * @see HarvestDefinitionDAO#create(HarvestDefinition) */ @Override public synchronized Long create(HarvestDefinition harvestDefinition) { Connection connection = HarvestDBConnection.get(); PreparedStatement s = null; try { Long id = harvestDefinition.getOid(); if (id == null) { id = generateNextID(connection); } connection.setAutoCommit(false); s = connection.prepareStatement( "INSERT INTO harvestdefinitions " + "( harvest_id, name, comments, numevents, submitted," + " isactive, edition, audience ) " + "VALUES ( ?, ?, ?, ?, ?, ?, ?,? )"); s.setLong(1, id); DBUtils.setName(s, 2, harvestDefinition, Constants.MAX_NAME_SIZE); DBUtils.setComments(s, 3, harvestDefinition, Constants.MAX_COMMENT_SIZE); s.setLong(4, harvestDefinition.getNumEvents()); Date submissiondate = new Date(); // Don't set on object, as we may yet rollback s.setTimestamp(5, new Timestamp(submissiondate.getTime())); s.setBoolean(6, harvestDefinition.getActive()); final int edition = 1; s.setLong(7, edition); s.setString(8, harvestDefinition.getAudience()); s.executeUpdate(); s.close(); if (harvestDefinition instanceof FullHarvest) { FullHarvest fh = (FullHarvest) harvestDefinition; s = connection.prepareStatement("INSERT INTO fullharvests " + "( harvest_id, maxobjects, maxbytes," + " maxjobrunningtime, previoushd, isindexready)" + "VALUES ( ?, ?, ?, ?, ?, ? )"); s.setLong(1, id); s.setLong(2, fh.getMaxCountObjects()); s.setLong(3, fh.getMaxBytes()); s.setLong(4, fh.getMaxJobRunningTime()); if (fh.getPreviousHarvestDefinition() != null) { s.setLong(5, fh.getPreviousHarvestDefinition().getOid()); } else { s.setNull(5, Types.BIGINT); } s.setBoolean(6, fh.getIndexReady()); s.executeUpdate(); } else if (harvestDefinition instanceof PartialHarvest) { PartialHarvest ph = (PartialHarvest) harvestDefinition; // Get schedule id long scheduleId = DBUtils.selectLongValue(connection, "SELECT schedule_id FROM schedules WHERE name = ?", ph.getSchedule().getName()); s = connection.prepareStatement("INSERT INTO partialharvests " + "( harvest_id, schedule_id, nextdate ) " + "VALUES ( ?, ?, ? )"); s.setLong(1, id); s.setLong(2, scheduleId); DBUtils.setDateMaybeNull(s, 3, ph.getNextDate()); s.executeUpdate(); createHarvestConfigsEntries(connection, ph, id); } else { String message = "Harvest definition " + harvestDefinition + " is of unknown class " + harvestDefinition.getClass(); log.warn(message); throw new ArgumentNotValid(message); } connection.commit(); // Now that we have committed, set new data on object. harvestDefinition.setSubmissionDate(submissiondate); harvestDefinition.setEdition(edition); harvestDefinition.setOid(id); // saving after receiving id saveExtendedFieldValues(connection, harvestDefinition); return id; } catch (SQLException e) { String message = "SQL error creating harvest definition " + harvestDefinition + " in database" + "\n" + ExceptionUtils.getSQLExceptionCause(e); log.warn(message, e); throw new IOFailure(message, e); } finally { DBUtils.closeStatementIfOpen(s); DBUtils.rollbackIfNeeded(connection, "creating", harvestDefinition); HarvestDBConnection.release(connection); } }
From source file:br.bookmark.db.util.ResultSetUtils.java
/** * Map JDBC objects to Java equivalents. * Used by getBean() and getBeans().//from w w w. j ava 2 s .c om * <p> * Some types not supported. * Many not work with all drivers. * <p> * Makes binary conversions of BIGINT, DATE, DECIMAL, DOUBLE, FLOAT, INTEGER, * REAL, SMALLINT, TIME, TIMESTAMP, TINYINT. * Makes Sting conversions of CHAR, CLOB, VARCHAR, LONGVARCHAR, BLOB, LONGVARBINARY, * VARBINARY. * <p> * DECIMAL, INTEGER, SMALLINT, TIMESTAMP, CHAR, VARCHAR tested with MySQL and Poolman. * Others not guaranteed. * @param classeDestino * @throws NoSuchFieldException * @throws SecurityException */ private static void putEntry(Map properties, ResultSetMetaData metaData, ResultSet resultSet, int i, Class classeDestino) throws Exception { /* In a perfect universe, this would be enough properties.put( metaData.getColumnName(i), resultSet.getObject(i)); But only String, Timestamp, and Integer seem to get through that way. */ String columnName = metaData.getColumnName(i); // Testa se uma FK /*Field[] fields = classeDestino.getDeclaredFields(); for (int j = 0; j < fields.length; j++) { if (fields[j].getAnnotation(DBFK.class) != null) { properties.put(columnName, resultSet.getString(i)); } }*/ //System.out.println(i+"-"+metaData.getColumnType(i)); switch (metaData.getColumnType(i)) { // http://java.sun.com/j2se/1.3.0/docs/api/java/sql/Types.html case Types.BIGINT: properties.put(columnName, new Long(resultSet.getLong(i))); break; case Types.DATE: properties.put(columnName, resultSet.getDate(i)); break; case Types.DECIMAL: case Types.DOUBLE: properties.put(columnName, new Double(resultSet.getDouble(i))); break; case Types.FLOAT: properties.put(columnName, new Float(resultSet.getFloat(i))); break; case Types.INTEGER: int valor = 0; try { // Se o campo esta vazio d erro valor = resultSet.getInt(i); } catch (SQLException e) { } properties.put(columnName, new Integer(valor)); break; case Types.REAL: properties.put(columnName, new Double(resultSet.getString(i))); break; case Types.SMALLINT: properties.put(columnName, new Short(resultSet.getShort(i))); break; case Types.TIME: properties.put(columnName, resultSet.getTime(i)); break; case Types.TIMESTAMP: properties.put(columnName, resultSet.getTimestamp(i)); break; // :FIXME: Throws java.lang.ClassCastException: java.lang.Integer // :FIXME: with Poolman and MySQL unless use getString. case Types.TINYINT: properties.put(columnName, new Byte(resultSet.getString(i))); break; case Types.CHAR: case Types.CLOB: case Types.VARCHAR: case Types.LONGVARCHAR: // :FIXME: Handle binaries differently? case Types.BLOB: case Types.LONGVARBINARY: case Types.VARBINARY: properties.put(columnName, resultSet.getString(i)); break; /* :FIXME: Add handlers for ARRAY BINARY BIT DISTINCT JAVA_OBJECT NULL NUMERIC OTHER REF STRUCT */ // Otherwise, pass as *String property to be converted default: properties.put(columnName + "String", resultSet.getString(i)); break; } // end switch }
From source file:org.jfree.data.jdbc.JDBCCategoryDataset.java
/** * Populates the dataset by executing the supplied query against the * existing database connection. If no connection exists then no action * is taken./*w w w . j av a2 s .c o m*/ * <p> * The results from the query are extracted and cached locally, thus * applying an upper limit on how many rows can be retrieved successfully. * * @param con the connection. * @param query the query. * * @throws SQLException if there is a problem executing the query. */ public void executeQuery(Connection con, String query) throws SQLException { Statement statement = null; ResultSet resultSet = null; try { statement = con.createStatement(); resultSet = statement.executeQuery(query); ResultSetMetaData metaData = resultSet.getMetaData(); int columnCount = metaData.getColumnCount(); if (columnCount < 2) { throw new SQLException("JDBCCategoryDataset.executeQuery() : insufficient columns " + "returned from the database."); } // Remove any previous old data int i = getRowCount(); while (--i >= 0) { removeRow(i); } while (resultSet.next()) { // first column contains the row key... Comparable rowKey = resultSet.getString(1); for (int column = 2; column <= columnCount; column++) { Comparable columnKey = metaData.getColumnName(column); int columnType = metaData.getColumnType(column); switch (columnType) { case Types.TINYINT: case Types.SMALLINT: case Types.INTEGER: case Types.BIGINT: case Types.FLOAT: case Types.DOUBLE: case Types.DECIMAL: case Types.NUMERIC: case Types.REAL: { Number value = (Number) resultSet.getObject(column); if (this.transpose) { setValue(value, columnKey, rowKey); } else { setValue(value, rowKey, columnKey); } break; } case Types.DATE: case Types.TIME: case Types.TIMESTAMP: { Date date = (Date) resultSet.getObject(column); Number value = new Long(date.getTime()); if (this.transpose) { setValue(value, columnKey, rowKey); } else { setValue(value, rowKey, columnKey); } break; } case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: { String string = (String) resultSet.getObject(column); try { Number value = Double.valueOf(string); if (this.transpose) { setValue(value, columnKey, rowKey); } else { setValue(value, rowKey, columnKey); } } catch (NumberFormatException e) { // suppress (value defaults to null) } break; } default: // not a value, can't use it (defaults to null) break; } } } fireDatasetChanged(new DatasetChangeInfo()); //TODO: fill in real change info } finally { if (resultSet != null) { try { resultSet.close(); } catch (Exception e) { // report this? } } if (statement != null) { try { statement.close(); } catch (Exception e) { // report this? } } } }
From source file:com.bt.aloha.dao.StateInfoDaoImpl.java
public void housekeep(String collectionTypeName, long maxTimeToLive, RowCallbackHandler rowCallBackHandler) { try {// w w w . j a va 2s .c om log.debug(String.format("Housekeeping: current number of objects in database is %d", size(collectionTypeName))); long houseKeepBefore = System.currentTimeMillis() - maxTimeToLive; Object[] params = new Object[] { houseKeepBefore, collectionTypeName }; int[] types = new int[] { Types.BIGINT, Types.VARCHAR }; int deleted = getJdbcTemplate().update(STATEINFO_DELETE_BY_HOUSEKEEPER_FLAGS_SQL, params, types); log.info(String.format("Removed %d objects from database", deleted)); getJdbcTemplate().query(STATEINFO_SELECT_BY_HOUSEKEEPER_FLAGS_SQL, params, rowCallBackHandler); int updated = getJdbcTemplate().update(STATEINFO_UPDATE_BY_HOUSEKEEPER_FLAGS_SQL, params, types); log.info(String.format("Forced housekeeping on %d objects from database", updated)); } catch (DataAccessException e) { log.error(String.format("Error occurred during database housekeeping: %s", e.getMessage())); } }
From source file:com.jaspersoft.jrx.query.PlSqlQueryExecuter.java
private void createStatement() throws JRException { String queryString = getQueryString(); if (connection != null && queryString != null && queryString.trim().length() > 0) { try {// www.ja va 2 s .com isStoredProcedure = isOracleStoredProcedure(queryString); if (isStoredProcedure) { statement = connection.prepareCall(queryString); } else { statement = connection.prepareStatement(queryString); } int fetchSize = JRPropertiesUtil.getInstance(getJasperReportsContext()).getIntegerProperty( dataset.getPropertiesMap(), JRJdbcQueryExecuterFactory.PROPERTY_JDBC_FETCH_SIZE, 0); if (fetchSize > 0) { statement.setFetchSize(fetchSize); } List<String> parameterNames = getCollectedParameterNames(); if (!parameterNames.isEmpty()) { for (int i = 0; i < parameterNames.size(); i++) { String parameterName = (String) parameterNames.get(i); JRValueParameter parameter = getValueParameter(parameterName); Class<?> clazz = parameter.getValueClass(); Object parameterValue = parameter.getValue(); if (clazz.equals(java.lang.Object.class)) { if (parameterValue == null) { statement.setNull(i + 1, Types.JAVA_OBJECT); } else { statement.setObject(i + 1, parameterValue); } } else if (clazz.equals(java.lang.Boolean.class)) { if (parameterValue == null) { statement.setNull(i + 1, Types.BIT); } else { statement.setBoolean(i + 1, ((Boolean) parameterValue).booleanValue()); } } else if (clazz.equals(java.lang.Byte.class)) { if (parameterValue == null) { statement.setNull(i + 1, Types.TINYINT); } else { statement.setByte(i + 1, ((Byte) parameterValue).byteValue()); } } else if (clazz.equals(java.lang.Double.class)) { if (parameterValue == null) { statement.setNull(i + 1, Types.DOUBLE); } else { statement.setDouble(i + 1, ((Double) parameterValue).doubleValue()); } } else if (clazz.equals(java.lang.Float.class)) { if (parameterValue == null) { statement.setNull(i + 1, Types.FLOAT); } else { statement.setFloat(i + 1, ((Float) parameterValue).floatValue()); } } else if (clazz.equals(java.lang.Integer.class)) { if (parameterValue == null) { statement.setNull(i + 1, Types.INTEGER); } else { statement.setInt(i + 1, ((Integer) parameterValue).intValue()); } } else if (clazz.equals(java.lang.Long.class)) { if (parameterValue == null) { statement.setNull(i + 1, Types.BIGINT); } else { statement.setLong(i + 1, ((Long) parameterValue).longValue()); } } else if (clazz.equals(java.lang.Short.class)) { if (parameterValue == null) { statement.setNull(i + 1, Types.SMALLINT); } else { statement.setShort(i + 1, ((Short) parameterValue).shortValue()); } } else if (clazz.equals(java.math.BigDecimal.class)) { if (parameterValue == null) { statement.setNull(i + 1, Types.DECIMAL); } else { statement.setBigDecimal(i + 1, (BigDecimal) parameterValue); } } else if (clazz.equals(java.lang.String.class)) { if (parameterValue == null) { statement.setNull(i + 1, Types.VARCHAR); } else { statement.setString(i + 1, parameterValue.toString()); } } else if (clazz.equals(java.util.Date.class)) { if (parameterValue == null) { statement.setNull(i + 1, Types.DATE); } else { statement.setDate(i + 1, new java.sql.Date(((java.util.Date) parameterValue).getTime())); } } else if (clazz.equals(java.sql.Timestamp.class)) { if (parameterValue == null) { statement.setNull(i + 1, Types.TIMESTAMP); } else { statement.setTimestamp(i + 1, (java.sql.Timestamp) parameterValue); } } else if (clazz.equals(java.sql.Time.class)) { if (parameterValue == null) { statement.setNull(i + 1, Types.TIME); } else { statement.setTime(i + 1, (java.sql.Time) parameterValue); } } else if (clazz.equals(java.sql.ResultSet.class)) { if (!isStoredProcedure) { throw new JRException("OUT paramater used in non-stored procedure call : " + parameterName + " class " + clazz.getName()); } else if (cursorParameter > 0) { throw new JRException("A stored procedure can have at most one cursor parameter : " + parameterName + " class " + clazz.getName()); } ((CallableStatement) statement).registerOutParameter(i + 1, ORACLE_CURSOR_TYPE); cursorParameter = i + 1; } else { throw new JRException("Parameter type not supported in query : " + parameterName + " class " + clazz.getName()); } } } } catch (SQLException e) { throw new JRException("Error preparing statement for executing the report query : " + "\n\n" + queryString + "\n\n", e); } } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSybase.CFAsteriskSybaseClusterTable.java
public long nextSecGroupMemberIdGen(CFSecurityAuthorization Authorization, CFSecurityClusterPKey PKey) { final String S_ProcName = "nextSecGroupMemberIdGen"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Not in a transaction"); }/*from w w w . java2s . c o m*/ Connection cnx = schema.getCnx(); long Id = PKey.getRequiredId(); CallableStatement stmtSelectNextSecGroupMemberIdGen = null; try { String sql = "{ call sp_next_secgroupmemberidgen( ?" + ", " + "?" + " ) }"; stmtSelectNextSecGroupMemberIdGen = cnx.prepareCall(sql); int argIdx = 1; stmtSelectNextSecGroupMemberIdGen.registerOutParameter(argIdx++, java.sql.Types.BIGINT); stmtSelectNextSecGroupMemberIdGen.setLong(argIdx++, Id); stmtSelectNextSecGroupMemberIdGen.execute(); long nextId = stmtSelectNextSecGroupMemberIdGen.getLong(1); return (nextId); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtSelectNextSecGroupMemberIdGen != null) { try { stmtSelectNextSecGroupMemberIdGen.close(); } catch (SQLException e) { } stmtSelectNextSecGroupMemberIdGen = null; } } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSybase.CFAsteriskSybaseTenantTable.java
public long nextTldIdGen(CFSecurityAuthorization Authorization, CFSecurityTenantPKey PKey) { final String S_ProcName = "nextTldIdGen"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Not in a transaction"); }/*from ww w . ja v a 2 s . c om*/ Connection cnx = schema.getCnx(); long Id = PKey.getRequiredId(); CallableStatement stmtSelectNextTldIdGen = null; try { String sql = "{ call sp_next_tldidgen( ?" + ", " + "?" + " ) }"; stmtSelectNextTldIdGen = cnx.prepareCall(sql); int argIdx = 1; stmtSelectNextTldIdGen.registerOutParameter(argIdx++, java.sql.Types.BIGINT); stmtSelectNextTldIdGen.setLong(argIdx++, Id); stmtSelectNextTldIdGen.execute(); long nextId = stmtSelectNextTldIdGen.getLong(1); return (nextId); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtSelectNextTldIdGen != null) { try { stmtSelectNextTldIdGen.close(); } catch (SQLException e) { } stmtSelectNextTldIdGen = null; } } }