Example usage for java.sql Types INTEGER

List of usage examples for java.sql Types INTEGER

Introduction

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

Prototype

int INTEGER

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

Click Source Link

Document

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

Usage

From source file:Main.java

/**
 * Gets the name of the type to be used with the internal dbms
 * /*from   ww w.  j  a  va  2 s.  c o m*/
 * @param type
 *            java.sql.Types constant
 * 
 * @return String
 * 
 * @throws RuntimeException
 *             If the Type is not recognized
 */
public static String getTypeString(int type) {
    switch (type) {
    case Types.BIGINT:
        return "BIGINT";

    case Types.BIT:
    case Types.BOOLEAN:
        return "BOOLEAN";

    case Types.CHAR:
    case Types.VARCHAR:
    case Types.LONGVARCHAR:
        return "VARCHAR";

    case Types.DATE:
        return "DATE";

    case Types.DECIMAL:
    case Types.NUMERIC:
    case Types.FLOAT:
    case Types.DOUBLE:
    case Types.REAL:
        return "DOUBLE";

    case Types.INTEGER:
        return "INTEGER";

    case Types.SMALLINT:
        return "SHORT";

    case Types.TINYINT:
        return "BYTE";

    case Types.BINARY:
    case Types.VARBINARY:
    case Types.LONGVARBINARY:
        return "BINARY";

    case Types.TIMESTAMP:
        return "TIMESTAMP";

    case Types.TIME:
        return "TIME";

    default:
        throw new RuntimeException("Cannot edit the type: " + type);
    }
}

From source file:FacturaDAO.java

@Override
public void alta(Factura f) {
    String inserQuery = "insert into TFacturas (idFactura, idCliente, Fecha, Importe) values (?, ?, ?, ?) ";
    Object[] params = new Object[] { f.getIdFactura(), f.getIdCliente(), f.getFecha(), f.getImporte() };
    int[] types = new int[] { Types.INTEGER, Types.INTEGER, Types.DATE, Types.DECIMAL };
    jdbcTemplate.update(inserQuery, params, types);
}

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:orz.neptune.prospring3.ch8.UpdateContact.java

public UpdateContact(DataSource dataSource) {
    super(dataSource, SQL_UPDATE_CONTACT);
    super.declareParameter(new SqlParameter("first_name", Types.VARCHAR));
    super.declareParameter(new SqlParameter("last_name", Types.VARCHAR));
    super.declareParameter(new SqlParameter("birth_date", Types.DATE));
    super.declareParameter(new SqlParameter("id", Types.INTEGER));
}

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

public UpdateContact(DataSource dataSource) {
    super(dataSource, SQL_UPDATE_CONTACT);
    super.declareParameter(new SqlParameter("first_name", Types.VARCHAR));
    super.declareParameter(new SqlParameter("last_name", Types.VARCHAR));
    super.declareParameter(new SqlParameter("birth_date", Types.DATE));
    super.declareParameter(new SqlParameter("contact_id", Types.INTEGER));
}

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

@Autowired
public NodeDelete(DataSource dataSource) {
    setDataSource(dataSource);//from w  w  w  .  j av  a2  s .c  o m
    setSql("DELETE FROM nodes WHERE node_id=?");
    declareParameter(new SqlParameter(Types.INTEGER));
}

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

@Autowired
public NodeTagDelete(DataSource dataSource) {
    setDataSource(dataSource);//from   w  w  w . j av  a 2s  .c om
    setSql("DELETE FROM node_tags WHERE node_id = ?");
    declareParameter(new SqlParameter(Types.INTEGER));
}

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

@Autowired
public NodeTagInsert(DataSource dataSource) {
    setDataSource(dataSource);/*from   w  w  w.  j  a  v  a2 s.c om*/
    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.NodeUpdate.java

@Autowired
public NodeUpdate(DataSource dataSource) {
    setDataSource(dataSource);/*  w  w w  .j av a  2s .c  om*/
    setSql("UPDATE nodes SET version=?, lon=?, lat=? WHERE node_id=?");
    declareParameter(new SqlParameter(Types.INTEGER));
    declareParameter(new SqlParameter(Types.INTEGER));
    declareParameter(new SqlParameter(Types.INTEGER));
    declareParameter(new SqlParameter(Types.INTEGER));
}

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

@Autowired
public NodeInsert(DataSource dataSource) {
    setDataSource(dataSource);// w  w  w.  j  a  v  a 2s. co m
    setSql("INSERT INTO nodes (node_id, version, lon, lat) VALUES (?,?,?,?)");
    declareParameter(new SqlParameter(Types.INTEGER));
    declareParameter(new SqlParameter(Types.INTEGER));
    declareParameter(new SqlParameter(Types.INTEGER));
    declareParameter(new SqlParameter(Types.INTEGER));
}