Search in sources :

Example 1 with StatementInsert

use of com.github.fabriciofx.cactoos.jdbc.statement.StatementInsert in project cactoos-jdbc by fabriciofx.

the class PhonebookSql method contact.

@Override
public Contact contact(final Map<String, String> properties) throws Exception {
    final UUID id = UUID.randomUUID();
    new StatementInsert(this.session, new QuerySimple("INSERT INTO contact (id, name) VALUES (:id, :name)", new ParamUuid("id", id), new ParamText("name", properties.get("name")))).result();
    return new ContactSql(this.session, id);
}
Also used : ParamUuid(com.github.fabriciofx.cactoos.jdbc.param.ParamUuid) ParamText(com.github.fabriciofx.cactoos.jdbc.param.ParamText) StatementInsert(com.github.fabriciofx.cactoos.jdbc.statement.StatementInsert) QuerySimple(com.github.fabriciofx.cactoos.jdbc.query.QuerySimple) UUID(java.util.UUID)

Aggregations

ParamText (com.github.fabriciofx.cactoos.jdbc.param.ParamText)1 ParamUuid (com.github.fabriciofx.cactoos.jdbc.param.ParamUuid)1 QuerySimple (com.github.fabriciofx.cactoos.jdbc.query.QuerySimple)1 StatementInsert (com.github.fabriciofx.cactoos.jdbc.statement.StatementInsert)1 UUID (java.util.UUID)1