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.tesora.dve.db.NativeType.java
public boolean isIntegralType() { return dataType == Types.BIGINT || dataType == Types.INTEGER || dataType == Types.TINYINT || dataType == Types.SMALLINT; }
From source file:com.opengamma.masterdb.portfolio.DbPortfolioMaster.java
/** * Recursively create the arguments to insert into the tree existing nodes. * /*www . j a va2 s .c om*/ * @param portfolioUid the portfolio unique identifier, not null * @param parentNodeUid the parent node unique identifier, not null * @param node the root node, not null * @param update true if updating portfolio, false if adding new portfolio * @param portfolioId the portfolio id, not null * @param portfolioOid the portfolio oid, not null * @param parentNodeId the parent node id, null if root node * @param parentNodeOid the parent node oid, null if root node * @param counter the counter to create the node id, use {@code getAndIncrement}, not null * @param depth the depth of the node in the portfolio * @param argsList the list of arguments to build, not null * @param posList the list of arguments to for inserting positions, not null */ protected void insertBuildArgs(final UniqueId portfolioUid, final UniqueId parentNodeUid, final ManageablePortfolioNode node, final boolean update, final Long portfolioId, final Long portfolioOid, final Long parentNodeId, final Long parentNodeOid, final AtomicInteger counter, final int depth, final List<DbMapSqlParameterSource> argsList, final List<DbMapSqlParameterSource> posList) { // need to insert parent before children for referential integrity final Long nodeId = nextId("prt_master_seq"); final Long nodeOid = (update && node.getUniqueId() != null ? extractOid(node.getUniqueId()) : nodeId); UniqueId nodeUid = createUniqueId(nodeOid, nodeId); node.setUniqueId(nodeUid); node.setParentNodeId(parentNodeUid); node.setPortfolioId(portfolioUid); final DbMapSqlParameterSource treeArgs = new DbMapSqlParameterSource().addValue("node_id", nodeId) .addValue("node_oid", nodeOid).addValue("portfolio_id", portfolioId) .addValue("portfolio_oid", portfolioOid).addValue("parent_node_id", parentNodeId, Types.BIGINT) .addValue("parent_node_oid", parentNodeOid, Types.BIGINT).addValue("depth", depth) .addValue("name", StringUtils.defaultString(node.getName())); argsList.add(treeArgs); // store position links Set<ObjectId> positionIds = new LinkedHashSet<ObjectId>(node.getPositionIds()); node.getPositionIds().clear(); node.getPositionIds().addAll(positionIds); for (ObjectId positionId : positionIds) { final DbMapSqlParameterSource posArgs = new DbMapSqlParameterSource().addValue("node_id", nodeId) .addValue("key_scheme", positionId.getScheme()).addValue("key_value", positionId.getValue()); posList.add(posArgs); } // store the left/right before/after the child loop and back fill into stored args row treeArgs.addValue("tree_left", counter.getAndIncrement()); for (ManageablePortfolioNode childNode : node.getChildNodes()) { insertBuildArgs(portfolioUid, nodeUid, childNode, update, portfolioId, portfolioOid, nodeId, nodeOid, counter, depth + 1, argsList, posList); } treeArgs.addValue("tree_right", counter.getAndIncrement()); }
From source file:jongo.jdbc.JDBCExecutor.java
/** * Utility method which registers in a CallableStatement object the different {@link jongo.jdbc.StoredProcedureParam} * instances in the given list. Returns a List of {@link jongo.jdbc.StoredProcedureParam} with all the OUT parameters * registered in the CallableStatement/*w w w . j a va 2 s .co m*/ * @param cs the CallableStatement object where the parameters are registered. * @param params a list of {@link jongo.jdbc.StoredProcedureParam} * @return a list of OUT {@link jongo.jdbc.StoredProcedureParam} * @throws SQLException if we fail to register any of the parameters in the CallableStatement */ private static List<StoredProcedureParam> addParameters(final CallableStatement cs, final List<StoredProcedureParam> params) throws SQLException { List<StoredProcedureParam> outParams = new ArrayList<StoredProcedureParam>(); int i = 1; for (StoredProcedureParam p : params) { final Integer sqlType = p.getType(); if (p.isOutParameter()) { l.debug("Adding OUT parameter " + p.toString()); cs.registerOutParameter(i++, sqlType); outParams.add(p); } else { l.debug("Adding IN parameter " + p.toString()); switch (sqlType) { case Types.BIGINT: case Types.INTEGER: case Types.TINYINT: // case Types.NUMERIC: cs.setInt(i++, Integer.valueOf(p.getValue())); break; case Types.DATE: cs.setDate(i++, (Date) JongoUtils.parseValue(p.getValue())); break; case Types.TIME: cs.setTime(i++, (Time) JongoUtils.parseValue(p.getValue())); break; case Types.TIMESTAMP: cs.setTimestamp(i++, (Timestamp) JongoUtils.parseValue(p.getValue())); break; case Types.DECIMAL: cs.setBigDecimal(i++, (BigDecimal) JongoUtils.parseValue(p.getValue())); break; case Types.DOUBLE: cs.setDouble(i++, Double.valueOf(p.getValue())); break; case Types.FLOAT: cs.setLong(i++, Long.valueOf(p.getValue())); break; default: cs.setString(i++, p.getValue()); break; } } } return outParams; }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSybase.CFAsteriskSybaseClusterTable.java
public long nextServiceIdGen(CFSecurityAuthorization Authorization, CFSecurityClusterPKey PKey) { final String S_ProcName = "nextServiceIdGen"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Not in a transaction"); }/*from ww w . ja va 2s. co m*/ Connection cnx = schema.getCnx(); long Id = PKey.getRequiredId(); CallableStatement stmtSelectNextServiceIdGen = null; try { String sql = "{ call sp_next_serviceidgen( ?" + ", " + "?" + " ) }"; stmtSelectNextServiceIdGen = cnx.prepareCall(sql); int argIdx = 1; stmtSelectNextServiceIdGen.registerOutParameter(argIdx++, java.sql.Types.BIGINT); stmtSelectNextServiceIdGen.setLong(argIdx++, Id); stmtSelectNextServiceIdGen.execute(); long nextId = stmtSelectNextServiceIdGen.getLong(1); return (nextId); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtSelectNextServiceIdGen != null) { try { stmtSelectNextServiceIdGen.close(); } catch (SQLException e) { } stmtSelectNextServiceIdGen = null; } } }
From source file:com.liferay.portal.upgrade.util.Table.java
public void setColumn(PreparedStatement ps, int index, Integer type, String value) throws Exception { int t = type.intValue(); int paramIndex = index + 1; if (t == Types.BIGINT) { ps.setLong(paramIndex, GetterUtil.getLong(value)); } else if (t == Types.BOOLEAN) { ps.setBoolean(paramIndex, GetterUtil.getBoolean(value)); } else if ((t == Types.CLOB) || (t == Types.VARCHAR)) { value = StringUtil.replace(value, SAFE_CHARS[1], SAFE_CHARS[0]); ps.setString(paramIndex, value); } else if (t == Types.DOUBLE) { ps.setDouble(paramIndex, GetterUtil.getDouble(value)); } else if (t == Types.FLOAT) { ps.setFloat(paramIndex, GetterUtil.getFloat(value)); } else if (t == Types.INTEGER) { ps.setInt(paramIndex, GetterUtil.getInteger(value)); } else if (t == Types.SMALLINT) { ps.setShort(paramIndex, GetterUtil.getShort(value)); } else if (t == Types.TIMESTAMP) { if (StringPool.NULL.equals(value)) { ps.setTimestamp(paramIndex, null); } else {/*from w w w . ja va2s .co m*/ DateFormat df = DateUtil.getISOFormat(); ps.setTimestamp(paramIndex, new Timestamp(df.parse(value).getTime())); } } else { throw new UpgradeException("Upgrade code using unsupported class type " + type); } }
From source file:com.mapd.utility.SQLImporter.java
private String getColType(int cType, int precision, int scale) { if (precision > 19) { precision = 19;/* w ww . ja va 2 s . com*/ } if (scale > 19) { scale = 18; } switch (cType) { case java.sql.Types.TINYINT: case java.sql.Types.SMALLINT: return ("SMALLINT"); case java.sql.Types.INTEGER: return ("INTEGER"); case java.sql.Types.BIGINT: return ("BIGINT"); case java.sql.Types.FLOAT: return ("FLOAT"); case java.sql.Types.DECIMAL: return ("DECIMAL(" + precision + "," + scale + ")"); case java.sql.Types.DOUBLE: return ("DOUBLE"); case java.sql.Types.REAL: return ("REAL"); case java.sql.Types.NUMERIC: return ("NUMERIC(" + precision + "," + scale + ")"); case java.sql.Types.TIME: return ("TIME"); case java.sql.Types.TIMESTAMP: return ("TIMESTAMP"); case java.sql.Types.DATE: return ("DATE"); case java.sql.Types.BOOLEAN: case java.sql.Types.BIT: // deal with postgress treating boolean as bit... this will bite me return ("BOOLEAN"); case java.sql.Types.NVARCHAR: case java.sql.Types.VARCHAR: case java.sql.Types.NCHAR: case java.sql.Types.CHAR: case java.sql.Types.LONGVARCHAR: case java.sql.Types.LONGNVARCHAR: return ("TEXT ENCODING DICT"); default: throw new AssertionError("Column type " + cType + " not Supported"); } }
From source file:com.squid.core.domain.operators.ExtendedType.java
public static IDomain computeDomain(int data_type, int size, int scale) { switch (data_type) { case Types.BOOLEAN: case Types.BIT:// on PG systems, this is how a boolean is actually represented by the driver return IDomain.BOOLEAN; case Types.TINYINT: case Types.BIGINT: case Types.INTEGER: case Types.SMALLINT: return IDomain.NUMERIC; /////////////////////////// case Types.REAL: case Types.DOUBLE: case Types.FLOAT: return IDomain.CONTINUOUS; case Types.NUMERIC: case Types.DECIMAL: return scale > 0 || size == 0 ? IDomain.CONTINUOUS : IDomain.NUMERIC; case Types.CHAR: case Types.NCHAR: case Types.VARCHAR: case Types.NVARCHAR: case Types.LONGVARCHAR: case Types.CLOB: return IDomain.STRING; /////////////////////////// case Types.TIME: return IDomain.TIME; case Types.DATE: return IDomain.DATE; case Types.TIMESTAMP: return IDomain.TIMESTAMP; /////////////////////////// default:/*from www.j a v a 2 s .c o m*/ return IDomain.UNKNOWN; } }
From source file:org.waarp.common.database.data.AbstractDbData.java
/** * Get one value into DbValue from ResultSet * //from w w w. j av a 2s .com * @param rs * @param value * @throws WaarpDatabaseSqlException */ static public void getTrueValue(ResultSet rs, DbValue value) throws WaarpDatabaseSqlException { try { switch (value.type) { case Types.VARCHAR: value.value = rs.getString(value.column); break; case Types.LONGVARCHAR: value.value = rs.getString(value.column); break; case Types.BIT: value.value = rs.getBoolean(value.column); break; case Types.TINYINT: value.value = rs.getByte(value.column); break; case Types.SMALLINT: value.value = rs.getShort(value.column); break; case Types.INTEGER: value.value = rs.getInt(value.column); break; case Types.BIGINT: value.value = rs.getLong(value.column); break; case Types.REAL: value.value = rs.getFloat(value.column); break; case Types.DOUBLE: value.value = rs.getDouble(value.column); break; case Types.VARBINARY: value.value = rs.getBytes(value.column); break; case Types.DATE: value.value = rs.getDate(value.column); break; case Types.TIMESTAMP: value.value = rs.getTimestamp(value.column); break; case Types.CLOB: value.value = rs.getClob(value.column).getCharacterStream(); break; case Types.BLOB: value.value = rs.getBlob(value.column).getBinaryStream(); break; default: throw new WaarpDatabaseSqlException("Type not supported: " + value.type + " for " + value.column); } } catch (SQLException e) { DbSession.error(e); throw new WaarpDatabaseSqlException("Getting values in error: " + value.type + " for " + value.column, e); } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSybase.CFAstSybaseClusterTable.java
public long nextServiceIdGen(CFAstAuthorization Authorization, CFAstClusterPKey PKey) { final String S_ProcName = "nextServiceIdGen"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Not in a transaction"); }//from w ww . j av a 2s .co m Connection cnx = schema.getCnx(); long Id = PKey.getRequiredId(); CallableStatement stmtSelectNextServiceIdGen = null; try { String sql = "{ call sp_next_serviceidgen( ?" + ", " + "?" + " ) }"; stmtSelectNextServiceIdGen = cnx.prepareCall(sql); int argIdx = 1; stmtSelectNextServiceIdGen.registerOutParameter(argIdx++, java.sql.Types.BIGINT); stmtSelectNextServiceIdGen.setLong(argIdx++, Id); stmtSelectNextServiceIdGen.execute(); long nextId = stmtSelectNextServiceIdGen.getLong(1); return (nextId); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtSelectNextServiceIdGen != null) { try { stmtSelectNextServiceIdGen.close(); } catch (SQLException e) { } stmtSelectNextServiceIdGen = null; } } }
From source file:com.nabla.wapp.server.auth.UserManager.java
public boolean updateUserRoleTable() throws SQLException { final Map<Integer, Map<Integer, Set<Integer>>> userRoles = loadUserRoles(); Database.executeUpdate(conn, "DELETE FROM user_role;"); final PreparedStatement stmt = conn .prepareStatement("INSERT INTO user_role (object_id, user_id, role_id) VALUES(?,?,?);"); try {/*w w w. j a v a 2 s . c o m*/ stmt.clearBatch(); for (Map.Entry<Integer, Map<Integer, Set<Integer>>> e : userRoles.entrySet()) { if (e.getKey() == null) stmt.setNull(1, Types.BIGINT); else stmt.setInt(1, e.getKey()); for (Map.Entry<Integer, Set<Integer>> ee : e.getValue().entrySet()) { stmt.setInt(2, ee.getKey()); for (Integer roleId : ee.getValue()) { stmt.setInt(3, roleId); stmt.addBatch(); } } } return Database.isBatchCompleted(stmt.executeBatch()); } finally { stmt.close(); } }