use of org.springframework.data.relational.core.sql.Table in project spring-data-jdbc by spring-projects.
the class InsertRendererUnitTests method shouldRenderInsertWithZeroColumns.
// DATAJDBC-340
@Test
public void shouldRenderInsertWithZeroColumns() {
Table bar = SQL.table("bar");
Insert insert = Insert.builder().into(bar).build();
assertThat(SqlRenderer.toString(insert)).isEqualTo("INSERT INTO bar VALUES (DEFAULT)");
}
use of org.springframework.data.relational.core.sql.Table in project spring-data-jdbc by spring-projects.
the class InsertRendererUnitTests method shouldRenderInsertColumn.
// DATAJDBC-335
@Test
public void shouldRenderInsertColumn() {
Table bar = SQL.table("bar");
Insert insert = Insert.builder().into(bar).column(bar.column("foo")).values(SQL.bindMarker()).build();
assertThat(SqlRenderer.toString(insert)).isEqualTo("INSERT INTO bar (foo) VALUES (?)");
}
use of org.springframework.data.relational.core.sql.Table in project spring-data-jdbc by spring-projects.
the class InsertRendererUnitTests method shouldRenderInsertMultipleColumns.
// DATAJDBC-335
@Test
public void shouldRenderInsertMultipleColumns() {
Table bar = SQL.table("bar");
Insert insert = Insert.builder().into(bar).columns(bar.columns("foo", "baz")).value(SQL.bindMarker()).value(SQL.literalOf("foo")).build();
assertThat(SqlRenderer.toString(insert)).isEqualTo("INSERT INTO bar (foo, baz) VALUES (?, 'foo')");
}
use of org.springframework.data.relational.core.sql.Table in project spring-data-jdbc by spring-projects.
the class UpdateRendererUnitTests method shouldRenderUpdateWithLiteral.
// DATAJDBC-335
@Test
public void shouldRenderUpdateWithLiteral() {
Table table = SQL.table("mytable");
Column column = table.column("foo");
Update update = StatementBuilder.update(table).set(column.set(SQL.literalOf(20))).build();
assertThat(SqlRenderer.toString(update)).isEqualTo("UPDATE mytable SET foo = 20");
}
use of org.springframework.data.relational.core.sql.Table in project spring-data-jdbc by spring-projects.
the class UpdateRendererUnitTests method shouldRenderSimpleUpdate.
// DATAJDBC-335
@Test
public void shouldRenderSimpleUpdate() {
Table table = SQL.table("mytable");
Column column = table.column("foo");
Update update = StatementBuilder.update(table).set(column.set(SQL.bindMarker())).build();
assertThat(SqlRenderer.toString(update)).isEqualTo("UPDATE mytable SET foo = ?");
}
Aggregations