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:com.adaptris.core.services.jdbc.types.StringColumnTranslatorTest.java

@Test
public void testAsIntegerTranslator() throws Exception {
    JdbcResultRow row = new JdbcResultRow();
    row.setFieldValue("testField", new Integer(111), Types.VARCHAR);

    {//  ww  w  . j a v  a2s. c  o m
        String translated = translator.translate(row, 0);
        assertEquals("111", translated);
    }
    {
        String translated = translator.translate(row, "testField");
        assertEquals("111", translated);
    }
}

From source file:demo.repository.DemoProcedure.java

/**
 * Executes {@code GREPO_DEMO.DEMO_PROCEDURE}.
 *
 * @param param1 The p_string param.//ww  w  .j  av a  2  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:org.osmsurround.ae.dao.NodeTagInsert.java

@Autowired
public NodeTagInsert(DataSource dataSource) {
    setDataSource(dataSource);/*from  w  ww .j a va  2s .co  m*/
    setSql("INSERT INTO node_tags (node_id, k, v) VALUES (?,?,?)");
    declareParameter(new SqlParameter(Types.INTEGER));
    declareParameter(new SqlParameter(Types.VARCHAR));
    declareParameter(new SqlParameter(Types.VARCHAR));
}

From source file:org.osmsurround.ae.dao.NodeValueSearchByKeyAndValue.java

@Autowired
public NodeValueSearchByKeyAndValue(DataSource dataSource) {
    setDataSource(dataSource);/*from  ww  w. jav  a  2  s  .c o  m*/
    setSql("SELECT DISTINCT v, valuecount FROM keyvalues WHERE lower(k) = lower(?) "
            + "AND lower(v) LIKE lower(?) ORDER BY valuecount DESC LIMIT 20");
    declareParameter(new SqlParameter(Types.VARCHAR));
    declareParameter(new SqlParameter(Types.VARCHAR));
}

From source file:com.bluecollarcoder.dao.PageRepository.java

public void persist(Integer crawler, Page page) {
    if (page.getParseData() instanceof HtmlParseData) {
        HtmlParseData htmlData = (HtmlParseData) page.getParseData();
        jdbc.update("INSERT INTO crawled_pages (crawler, url, content) VALUES (?, ?, ?)",
                new Object[] { crawler, page.getWebURL().getURL(), htmlData.getHtml() },
                new int[] { Types.SMALLINT, Types.VARCHAR, Types.VARCHAR });
    }/* www  .ja  v  a2 s . c o  m*/
}

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

public TestFailureInserter(DataSource dataSource) {
    setDataSource(dataSource);/* w ww .j av a2s.  co  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: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:net.sourceforge.vulcan.spring.jdbc.ModifiedPathInserter.java

public ModifiedPathInserter(DataSource dataSource) {
    setDataSource(dataSource);/*from   ww w.j  a v  a2s  .  co 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:Spring.Repaso02.ClienteDAO.java

@Override
public void modificacion(Cliente c) {
    String updateQuery = "update TClientes set Pass = ?, Nombre = ?, Apellidos = ?, Telefono = ?, Email = ? where IdCliente = ?";
    Object[] params = new Object[] { c.getPassword(), c.getNombre(), c.getApellidos(), c.getTelefono(),
            c.getEmail(), c.getIdCliente() };
    int[] types = new int[] { Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
            Types.VARCHAR, Types.VARCHAR };
    jdbcTemplate.update(updateQuery, params, types);
}

From source file:com.mec.DAO.Passport.UserDAO.java

public Usuario getUser(String nombre, String clave) {
    Usuario u = null;/*  ww  w.  jav  a  2s . c o m*/
    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;
}