Package | Description |
---|---|
org.ujorm.tools.jdbc | |
org.ujorm.tools.sql |
Class and Description |
---|
JdbcBuilder
PrepareStatement builder support
How to use a SELECT
JdbcBuilder sql = new JdbcBuilder() .write("SELECT") .column("t.id") .column("t.name") .write("FROM testTable t WHERE") .andCondition("t.name", "=", "Test") .andCondition("t.created", ">=", someDate); for (ResultSet rs : sql.executeSelect(dbConnection)) { int id = rs.getInt(1); String name = rs.getString(2); } How to use a INSERTJdbcBuilder sql = new JdbcBuilder() .write("INSERT INTO testTable (") .columnInsert("id", 10) .columnInsert("name", "Test") .columnInsert("date", someDate) .write(")"); sql.executeUpdate(dbConnection); How to use a UPDATEJdbcBuilder sql = new JdbcBuilder() .write("UPDATE testTable SET") .columnUpdate("name", "Test") .columnUpdate("date", SOME_DATE) .write("WHERE") .andCondition("id", "IN", 10, 20, 30) .andCondition("created BETWEEN ? |
JdbcBuilder.SqlEnvelope
A SQL fragment
|
JdbcFunction
A functional interface
|
ProxySequence
A proxy CharSequence implementation
|
Class and Description |
---|
JdbcBuilder
PrepareStatement builder support
How to use a SELECT
JdbcBuilder sql = new JdbcBuilder() .write("SELECT") .column("t.id") .column("t.name") .write("FROM testTable t WHERE") .andCondition("t.name", "=", "Test") .andCondition("t.created", ">=", someDate); for (ResultSet rs : sql.executeSelect(dbConnection)) { int id = rs.getInt(1); String name = rs.getString(2); } How to use a INSERTJdbcBuilder sql = new JdbcBuilder() .write("INSERT INTO testTable (") .columnInsert("id", 10) .columnInsert("name", "Test") .columnInsert("date", someDate) .write(")"); sql.executeUpdate(dbConnection); How to use a UPDATEJdbcBuilder sql = new JdbcBuilder() .write("UPDATE testTable SET") .columnUpdate("name", "Test") .columnUpdate("date", SOME_DATE) .write("WHERE") .andCondition("id", "IN", 10, 20, 30) .andCondition("created BETWEEN ? |
Copyright 2019-2022, Pavel Ponec