List of usage examples for java.sql Types INTEGER
int INTEGER
To view the source code for java.sql Types INTEGER.
Click Source Link
The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type INTEGER
.
From source file:org.codehaus.grepo.procedure.config.ScanTestRepository1.java
/** * @param p1 Procedure param1./*from w w w. j a v a 2 s .c o m*/ * @param p2 Procedure param2. */ @GenericProcedure(sql = "grepo_test.simple_proc1") @Out(name = "p_result", sqlType = Types.VARCHAR) void executeSimpleProc(@In(name = "p_string", sqlType = Types.VARCHAR) String p1, @In(name = "p_integer", sqlType = Types.INTEGER) Integer p2);
From source file:com.nabla.wapp.server.json.SqlColumn.java
public SqlColumn(String label, int type, int length) { this.label = label; this.type = (type == Types.TINYINT) ? (length == 1 ? Types.BOOLEAN : type) : type; if (log.isDebugEnabled()) { String s;//from w w w. j a va 2 s . c o m switch (this.type) { case Types.BIGINT: case Types.INTEGER: case Types.SMALLINT: case Types.TINYINT: s = "INTEGER"; break; case Types.BOOLEAN: case Types.BIT: s = "BOOLEAN"; break; case Types.DATE: s = "DATE"; break; case Types.TIMESTAMP: s = "TIMESTAMP"; break; case Types.DOUBLE: s = "DOUBLE"; break; case Types.FLOAT: s = "FLOAT"; break; case Types.NULL: s = "NULL"; break; default: s = "STRING"; break; } log.debug("column '" + this.label + "' " + s); } }
From source file:demo.repository.DemoProcedure.java
/** * Executes {@code GREPO_DEMO.DEMO_PROCEDURE}. * * @param param1 The p_string param.// ww w . j ava2 s. c o m * @param param2 The p_integer param. * @return Returns the p_result. */ @GenericProcedure(sql = "grepo_demo.demo_procedure", returnParamName = "p_result") @Out(name = "p_result", sqlType = Types.VARCHAR) String executeDemoProcedure(@In(name = "p_string", sqlType = Types.VARCHAR) String param1, @In(name = "p_integer", sqlType = Types.INTEGER) int param2);
From source file:com.streamsets.pipeline.stage.it.AllNullTypesIT.java
@Parameterized.Parameters(name = "type({0})") public static Collection<Object[]> data() throws Exception { return Arrays.asList(new Object[][] { { Field.create(Field.Type.BOOLEAN, null), true, Types.BOOLEAN }, { Field.create(Field.Type.CHAR, null), true, Types.VARCHAR }, { Field.create(Field.Type.BYTE, null), false, 0 }, { Field.create(Field.Type.SHORT, null), true, Types.INTEGER }, { Field.create(Field.Type.INTEGER, null), true, Types.INTEGER }, { Field.create(Field.Type.LONG, null), true, Types.BIGINT }, { Field.create(Field.Type.FLOAT, null), true, Types.FLOAT }, { Field.create(Field.Type.DOUBLE, null), true, Types.DOUBLE }, { Field.create(Field.Type.DATE, null), true, Types.DATE }, { Field.create(Field.Type.DATETIME, null), true, Types.VARCHAR }, { Field.create(Field.Type.TIME, null), true, Types.VARCHAR }, { Field.create(Field.Type.DECIMAL, null), true, Types.DECIMAL }, { Field.create(Field.Type.STRING, null), true, Types.VARCHAR }, { Field.create(Field.Type.BYTE_ARRAY, null), true, Types.BINARY }, { Field.create(Field.Type.MAP, null), false, 0 }, { Field.create(Field.Type.LIST, null), false, 0 }, { Field.create(Field.Type.LIST_MAP, null), false, 0 }, }); }
From source file:Spring.Repaso01.ClienteDAO.java
@Override public void modificacion(Cliente c) { String modQuery = "update Cliente set Nombre = ?, Ape1 = ?, Ape2 = ?, Saldo = ? where idCliente = ?"; Object[] params = new Object[] { c.getNombre(), c.getApe1(), c.getApe2(), c.getSaldo(), c.getIdCliente() }; int[] types = new int[] { Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.DECIMAL, Types.INTEGER }; jdbcTemplate.update(modQuery, params, types); }
From source file:com.espertech.esper.util.TestSQLTypeMapUtil.java
public void testMapping() { Map<Integer, Class> testData = new HashMap<Integer, Class>(); testData.put(Types.CHAR, String.class); testData.put(Types.VARCHAR, String.class); testData.put(Types.LONGVARCHAR, String.class); testData.put(Types.NUMERIC, BigDecimal.class); testData.put(Types.DECIMAL, BigDecimal.class); testData.put(Types.BIT, Boolean.class); testData.put(Types.BOOLEAN, Boolean.class); testData.put(Types.TINYINT, Byte.class); testData.put(Types.SMALLINT, Short.class); testData.put(Types.INTEGER, Integer.class); testData.put(Types.BIGINT, Long.class); testData.put(Types.REAL, Float.class); testData.put(Types.FLOAT, Double.class); testData.put(Types.DOUBLE, Double.class); testData.put(Types.BINARY, byte[].class); testData.put(Types.VARBINARY, byte[].class); testData.put(Types.LONGVARBINARY, byte[].class); testData.put(Types.DATE, java.sql.Date.class); testData.put(Types.TIMESTAMP, java.sql.Timestamp.class); testData.put(Types.TIME, java.sql.Time.class); testData.put(Types.CLOB, java.sql.Clob.class); testData.put(Types.BLOB, java.sql.Blob.class); testData.put(Types.ARRAY, java.sql.Array.class); testData.put(Types.STRUCT, java.sql.Struct.class); testData.put(Types.REF, java.sql.Ref.class); testData.put(Types.DATALINK, java.net.URL.class); for (int type : testData.keySet()) { Class result = SQLTypeMapUtil.sqlTypeToClass(type, null); log.debug(".testMapping Mapping " + type + " to " + result.getSimpleName()); assertEquals(testData.get(type), result); }// w ww . j a va2 s . co m assertEquals(String.class, SQLTypeMapUtil.sqlTypeToClass(Types.JAVA_OBJECT, "java.lang.String")); assertEquals(String.class, SQLTypeMapUtil.sqlTypeToClass(Types.DISTINCT, "java.lang.String")); }
From source file:konditer.client.dao.CakeAndTypeDao.java
@Override public void addCakeAndType(int cakeAndTypeId, int cakeId, int cakeTypeId) { String SQL_QUERY = "INSERT INTO cakes_and_types ( CAKE_AND_TYPE_ID, " + "CAKE_ID, " + "CAKE_TYPE_ID ) " + "VALUES (?,?,?)"; try {//from ww w. ja v a2 s . co m int rowCount = jdbcTemplate.update(SQL_QUERY, new Object[] { cakeAndTypeId, cakeId, cakeTypeId }, new int[] { Types.INTEGER, Types.INTEGER, Types.INTEGER }); Logger.getLogger(CakeDao.class.getName()).log(Level.SEVERE, " {0} ? {1} .", new Object[] { cakeId, rowCount }); } catch (DataAccessException e) { Logger.getLogger(CakeDao.class.getName()).log(Level.SEVERE, ". {0} .", cakeId); } }
From source file:com.mec.DAO.Passport.UserDAO.java
public Usuario getUser(String nombre, String clave) { Usuario u = null;//from w w w .jav a 2s . com SimpleJdbcCall jdbcCall = new SimpleJdbcCall(ds).withCatalogName("dbo") .withProcedureName("paValidarUsuario").withoutProcedureColumnMetaDataAccess() .declareParameters(new SqlParameter("NombreUsuario", Types.VARCHAR)) .declareParameters(new SqlParameter("Clave", Types.VARCHAR)) .declareParameters(new SqlOutParameter("UserId", Types.INTEGER)) .declareParameters(new SqlOutParameter("ErrText", Types.VARCHAR)); SqlParameterSource in = new MapSqlParameterSource().addValue("NombreUsuario", nombre).addValue("Clave", clave); Map<String, Object> r = jdbcCall.execute(in); Integer userId = null; String errText = ""; for (Map.Entry<String, Object> entry : r.entrySet()) { String key = entry.getKey(); if (key.equals("UserId")) { userId = (Integer) entry.getValue(); } else if (key.equals("ErrText")) { errText = (String) entry.getValue(); } } if (userId != null && errText.equals("Ok")) { List<GrantedAuthority> roles = getUserRoles(userId); u = new Usuario(userId, roles); } return u; }
From source file:RowSetModel.java
public Class getColumnClass(int column) { String cname;//from w w w .jav a 2s . c om int type; try { ResultSetMetaData meta = rowSet.getMetaData(); if (meta == null) { return null; } type = meta.getColumnType(column + 1); } catch (SQLException e) { e.printStackTrace(); return super.getColumnClass(column); } switch (type) { case Types.BIT: { cname = "java.lang.Boolean"; break; } case Types.TINYINT: { cname = "java.lang.Byte"; break; } case Types.SMALLINT: { cname = "java.lang.Short"; break; } case Types.INTEGER: { cname = "java.lang.Integer"; break; } case Types.BIGINT: { cname = "java.lang.Long"; break; } case Types.FLOAT: case Types.REAL: { cname = "java.lang.Float"; break; } case Types.DOUBLE: { cname = "java.lang.Double"; break; } case Types.NUMERIC: { cname = "java.lang.Number"; break; } case Types.DECIMAL: { cname = "java.math.BigDecimal"; break; } case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: { cname = "java.lang.String"; break; } case Types.DATE: { cname = "java.sql.Date"; break; } case Types.TIME: { cname = "java.sql.Time"; break; } case Types.TIMESTAMP: { cname = "java.sql.Timestamp"; break; } case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: { cname = "byte[]"; break; } case Types.OTHER: case Types.JAVA_OBJECT: { cname = "java.lang.Object"; break; } case Types.CLOB: { cname = "java.sql.Clob"; break; } case Types.BLOB: { cname = "java.ssql.Blob"; break; } case Types.REF: { cname = "java.sql.Ref"; break; } case Types.STRUCT: { cname = "java.sql.Struct"; break; } default: { return super.getColumnClass(column); } } try { return Class.forName(cname); } catch (Exception e) { e.printStackTrace(); return super.getColumnClass(column); } }
From source file:at.alladin.rmbt.db.fields.IntField.java
@Override public void getField(final PreparedStatement ps, final int idx) throws SQLException { if (value == null) ps.setNull(idx, Types.INTEGER); else/*from w ww. j av a2 s . c o m*/ ps.setInt(idx, value); }