List of usage examples for java.sql Types NUMERIC
int NUMERIC
To view the source code for java.sql Types NUMERIC.
Click Source Link
The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type NUMERIC
.
From source file:net.sourceforge.vulcan.spring.jdbc.BuildMessageInserter.java
public BuildMessageInserter(DataSource dataSource) { setDataSource(dataSource);//ww w .j a v a 2 s . c o m setSql("insert into build_messages " + "(build_id, message_type, message, line_number, file, code) " + "values (?, ?, ?, ?, ?, ?)"); declareParameter(new SqlParameter(Types.NUMERIC)); declareParameter(new SqlParameter(Types.VARCHAR)); declareParameter(new SqlParameter(Types.VARCHAR)); declareParameter(new SqlParameter(Types.NUMERIC)); declareParameter(new SqlParameter(Types.VARCHAR)); declareParameter(new SqlParameter(Types.VARCHAR)); compile(); }
From source file:net.sourceforge.vulcan.spring.jdbc.ModifiedPathInserter.java
public ModifiedPathInserter(DataSource dataSource) { setDataSource(dataSource);/* ww w . java2 s .c o m*/ setSql("insert into modified_paths " + "(build_id, change_set_id, modified_path, modification_type) " + "values (?, ?, ?, ?)"); declareParameter(new SqlParameter(Types.NUMERIC)); declareParameter(new SqlParameter(Types.NUMERIC)); declareParameter(new SqlParameter(Types.VARCHAR)); declareParameter(new SqlParameter(Types.CHAR)); compile(); }
From source file:org.talend.dataquality.record.linkage.ui.composite.table.SortComparator.java
public static ISortComparator getSortComparator(int javaDataType) throws ParseException { switch (javaDataType) { case Types.DATE: case Types.TIME: return new SortComparator() { @Override//from w w w. j a va2 s. c o m public int compareNotNull(Object value1, Object value2) throws ParseException { return java.sql.Date.valueOf(value1.toString()) .compareTo(java.sql.Date.valueOf(value2.toString())); } }; case Types.TIMESTAMP: return new SortComparator() { @Override public int compareNotNull(Object value1, Object value2) throws ParseException { return Timestamp.valueOf(value1.toString()).compareTo(Timestamp.valueOf(value2.toString())); } }; case Types.DOUBLE: case Types.REAL: case Types.FLOAT: return new SortComparator() { @Override public int compareNotNull(Object value1, Object value2) throws ParseException { return Double.valueOf(value1.toString()).compareTo(Double.valueOf(value2.toString())); } }; case Types.INTEGER: case Types.TINYINT: case Types.SMALLINT: case Types.NUMERIC: return new SortComparator() { @Override public int compareNotNull(Object value1, Object value2) throws ParseException { return Integer.valueOf(value1.toString()).compareTo(Integer.valueOf(value2.toString())); } }; case Types.BIGINT: return new SortComparator() { @Override public int compareNotNull(Object value1, Object value2) throws ParseException { return Long.valueOf(value1.toString()).compareTo(Long.valueOf(value2.toString())); } }; case Types.DECIMAL: return new SortComparator() { @Override public int compareNotNull(Object value1, Object value2) throws ParseException { if (value1 instanceof BigDecimal) { return ((BigDecimal) value1).compareTo((BigDecimal) value2); } BigDecimal b1 = new BigDecimal(value1.toString()); BigDecimal b2 = new BigDecimal(value2.toString()); return b1.compareTo(b2); } }; case Types.BOOLEAN: case Types.BIT: return new SortComparator() { @Override public int compareNotNull(Object value1, Object value2) throws ParseException { return Boolean.valueOf(value1.toString()).compareTo(Boolean.valueOf(value2.toString())); } }; default:// String return new SortComparator() { @Override public int compareNotNull(Object value1, Object value2) throws ParseException { return value1.toString().compareTo(value2.toString()); } }; } }
From source file:net.sourceforge.vulcan.spring.jdbc.TestFailureInserter.java
public TestFailureInserter(DataSource dataSource) { setDataSource(dataSource);/*w w w .j a v a2 s .c o m*/ setSql("insert into test_failures " + "(build_id, name, message, details, first_consecutive_build_number) " + "values (?, ?, ?, ?, ?)"); declareParameter(new SqlParameter(Types.NUMERIC)); declareParameter(new SqlParameter(Types.VARCHAR)); declareParameter(new SqlParameter(Types.VARCHAR)); declareParameter(new SqlParameter(Types.VARCHAR)); declareParameter(new SqlParameter(Types.NUMERIC)); compile(); }
From source file:net.sourceforge.vulcan.spring.jdbc.ChangeSetInserter.java
public ChangeSetInserter(DataSource dataSource) { setDataSource(dataSource);/* w ww .j ava 2s.com*/ setSql("insert into change_sets " + "(build_id, change_set_id, message, revision_label, commit_timestamp, author, author_email) " + "values (?, ?, ?, ?, ?, ?, ?)"); declareParameter(new SqlParameter(Types.NUMERIC)); declareParameter(new SqlParameter(Types.NUMERIC)); declareParameter(new SqlParameter(Types.VARCHAR)); declareParameter(new SqlParameter(Types.VARCHAR)); declareParameter(new SqlParameter(Types.TIMESTAMP)); declareParameter(new SqlParameter(Types.VARCHAR)); declareParameter(new SqlParameter(Types.VARCHAR)); compile(); modifiedPathInserter = new ModifiedPathInserter(dataSource); }
From source file:net.sourceforge.vulcan.spring.jdbc.TestFailureQuery.java
public TestFailureQuery(DataSource dataSource) { super(dataSource, "select name, message, details, first_consecutive_build_number " + "from test_failures where build_id = ?"); declareParameter(new SqlParameter("build_id", Types.NUMERIC)); compile();/*from ww w .j a va 2 s .co m*/ }
From source file:net.sourceforge.vulcan.spring.jdbc.MetricsQuery.java
public MetricsQuery(DataSource dataSource) { super(dataSource, "select message_key, metric_type, data " + "from metrics where build_id = ? order by message_key"); declareParameter(new SqlParameter("build_id", Types.NUMERIC)); compile();//from ww w . j a v a2 s . c o m }
From source file:net.sourceforge.vulcan.spring.jdbc.BuildMessagesQuery.java
public BuildMessagesQuery(DataSource dataSource) { super(dataSource, "select message_type, message, code, file, line_number " + "from build_messages where build_id = ? order by message_type, file, line_number, message"); declareParameter(new SqlParameter("build_id", Types.NUMERIC)); compile();/*www. j a v a 2 s . c o m*/ }
From source file:net.sourceforge.vulcan.spring.jdbc.ModifiedPathQuery.java
public ModifiedPathQuery(DataSource dataSource) { super(dataSource, "select modified_path, modification_type " + "from modified_paths where build_id = ? and change_set_id = ? order by modified_path"); declareParameter(new SqlParameter("build_id", Types.NUMERIC)); declareParameter(new SqlParameter("modified_path", Types.NUMERIC)); compile();/*from w ww. j a v a 2s . co m*/ }
From source file:org.apache.ddlutils.io.converters.NumberConverter.java
/** * {@inheritDoc}//from w w w. j ava 2 s .c o m */ public Object convertFromString(String textRep, int sqlTypeCode) throws ConversionException { if (textRep == null) { return null; } else { Class targetClass = null; switch (sqlTypeCode) { case Types.BIGINT: targetClass = Long.class; break; case Types.BIT: case Types.BOOLEAN: targetClass = Boolean.class; break; case Types.DECIMAL: case Types.NUMERIC: targetClass = BigDecimal.class; break; case Types.DOUBLE: case Types.FLOAT: targetClass = Double.class; break; case Types.INTEGER: targetClass = Integer.class; break; case Types.REAL: targetClass = Float.class; break; case Types.SMALLINT: case Types.TINYINT: targetClass = Short.class; break; } return targetClass == null ? textRep : ConvertUtils.convert(textRep, targetClass); } }