use of org.springframework.data.relational.core.sql.Insert 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.Insert 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.Insert 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.Insert in project spring-data-jdbc by spring-projects.
the class InsertRendererUnitTests method shouldRenderInsert.
// DATAJDBC-335
@Test
public void shouldRenderInsert() {
Table bar = SQL.table("bar");
Insert insert = Insert.builder().into(bar).values(SQL.bindMarker()).build();
assertThat(SqlRenderer.toString(insert)).isEqualTo("INSERT INTO bar VALUES (?)");
}