Example usage for java.sql Types VARCHAR

List of usage examples for java.sql Types VARCHAR

Introduction

In this page you can find the example usage for java.sql Types VARCHAR.

Prototype

int VARCHAR

To view the source code for java.sql Types VARCHAR.

Click Source Link

Document

The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type VARCHAR.

Usage

From source file:Spring.Repaso01.ClienteDAO.java

@Override
public void alta(Cliente c) {
    String inserQuery = "insert into Cliente (idCliente, Nombre, Ape1, Ape2, Saldo) values (?, ?, ?, ?, ?) ";
    Object[] params = new Object[] { c.getIdCliente(), c.getNombre(), c.getApe1(), c.getApe2(), c.getSaldo() };
    int[] types = new int[] { Types.INTEGER, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.DECIMAL };
    jdbcTemplate.update(inserQuery, params, types);
}

From source file:com.home.ln_spring.ch8.dao.jdbc.annotation.InsertContactTelDetail.java

public InsertContactTelDetail(DataSource dataSource) {
    super(dataSource, SQL_INSERT_CONTACT_TEL);
    declareParameter(new SqlParameter("contact_id", Types.INTEGER));
    declareParameter(new SqlParameter("tel_type", Types.VARCHAR));
    declareParameter(new SqlParameter("tel_number", Types.VARCHAR));
    setBatchSize(BATCH_SIZE);//from   ww w  . j a  va2 s . c om
}

From source file:gov.nih.nci.caarray.util.URIUserType.java

/**
 * {@inheritDoc}
 */
@Override
public int[] sqlTypes() {
    return new int[] { Types.VARCHAR };
}

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);
    }/*from ww  w.j a  va 2 s  . c  om*/

    assertEquals(String.class, SQLTypeMapUtil.sqlTypeToClass(Types.JAVA_OBJECT, "java.lang.String"));
    assertEquals(String.class, SQLTypeMapUtil.sqlTypeToClass(Types.DISTINCT, "java.lang.String"));
}

From source file:org.codehaus.grepo.procedure.config.ScanTestRepository1.java

/**
 * @param p1 Procedure param1./*from  ww w .  j av a2s  .  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:org.osmsurround.ae.dao.NodeValueSearchByKey.java

@Autowired
public NodeValueSearchByKey(DataSource dataSource) {
    setDataSource(dataSource);//from  www  .j av  a 2s  . co m

    setSql("SELECT DISTINCT k, 0 FROM keyvalues WHERE lower(k) LIKE lower(?) ORDER BY k LIMIT 20");
    declareParameter(new SqlParameter(Types.VARCHAR));
}

From source file:net.sourceforge.vulcan.spring.jdbc.DependencyInserter.java

public DependencyInserter(DataSource dataSource) {
    setDataSource(dataSource);//from  w ww  .  j  a v  a 2  s  .  com
    setSql("insert into build_dependencies " + "(build_id, dependency_build_id) " + "values ("
            + "(select id from builds where uuid=?), " + "(select id from builds where uuid=?))");

    declareParameter(new SqlParameter(Types.VARCHAR));
    declareParameter(new SqlParameter(Types.VARCHAR));

    compile();
}

From source file:net.sourceforge.vulcan.spring.jdbc.MetricInserter.java

public MetricInserter(DataSource dataSource) {
    setDataSource(dataSource);//from   w w w  .  ja v a 2 s. co m
    setSql("insert into metrics " + "(build_id, message_key, metric_type, data) " + "values (?, ?, ?, ?)");

    declareParameter(new SqlParameter(Types.NUMERIC));
    declareParameter(new SqlParameter(Types.VARCHAR));
    declareParameter(new SqlParameter(Types.CHAR));
    declareParameter(new SqlParameter(Types.VARCHAR));

    compile();
}

From source file:org.smigo.JdbcTestDao.java

@Override
public void deleteUserConnection(long providerUserId) {
    String deleteRowSql = "DELETE FROM UserConnection WHERE providerUserId = ?";
    jdbcTemplate.update(deleteRowSql, new Object[] { providerUserId }, new int[] { Types.VARCHAR });
}

From source file:net.sourceforge.vulcan.spring.jdbc.BuildMessageInserter.java

public BuildMessageInserter(DataSource dataSource) {
    setDataSource(dataSource);/*from   ww  w . j av a  2s .  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();
}