use of org.springframework.data.relational.core.sql.Table in project spring-data-jdbc by spring-projects.
the class MySqlDialectRenderingUnitTests method shouldRenderSelectWithLimitWithLockWrite.
// DATAJDBC-498
@Test
public void shouldRenderSelectWithLimitWithLockWrite() {
Table table = Table.create("foo");
LockMode lockMode = LockMode.PESSIMISTIC_WRITE;
Select select = StatementBuilder.select(table.asterisk()).from(table).limit(10).lock(lockMode).build();
String sql = SqlRenderer.create(factory.createRenderContext()).render(select);
assertThat(sql).isEqualTo("SELECT foo.* FROM foo LIMIT 10 FOR UPDATE");
}
use of org.springframework.data.relational.core.sql.Table in project spring-data-jdbc by spring-projects.
the class MySqlDialectRenderingUnitTests method shouldRenderSelectWithLimit.
// DATAJDBC-278
@Test
public void shouldRenderSelectWithLimit() {
Table table = Table.create("foo");
Select select = StatementBuilder.select(table.asterisk()).from(table).limit(10).build();
String sql = SqlRenderer.create(factory.createRenderContext()).render(select);
assertThat(sql).isEqualTo("SELECT foo.* FROM foo LIMIT 10");
}
use of org.springframework.data.relational.core.sql.Table in project spring-data-jdbc by spring-projects.
the class MySqlDialectRenderingUnitTests method shouldRenderSelectWithOffset.
// DATAJDBC-278
@Test
public void shouldRenderSelectWithOffset() {
Table table = Table.create("foo");
Select select = StatementBuilder.select(table.asterisk()).from(table).offset(10).build();
String sql = SqlRenderer.create(factory.createRenderContext()).render(select);
assertThat(sql).isEqualTo("SELECT foo.* FROM foo LIMIT 10, 18446744073709551615");
}
use of org.springframework.data.relational.core.sql.Table in project spring-data-jdbc by spring-projects.
the class MySqlDialectRenderingUnitTests method shouldRenderSelectWithLimitWithLockRead.
// DATAJDBC-498
@Test
public void shouldRenderSelectWithLimitWithLockRead() {
Table table = Table.create("foo");
LockMode lockMode = LockMode.PESSIMISTIC_READ;
Select select = StatementBuilder.select(table.asterisk()).from(table).limit(10).lock(lockMode).build();
String sql = SqlRenderer.create(factory.createRenderContext()).render(select);
assertThat(sql).isEqualTo("SELECT foo.* FROM foo LIMIT 10 LOCK IN SHARE MODE");
}
use of org.springframework.data.relational.core.sql.Table in project spring-data-jdbc by spring-projects.
the class PostgresDialectRenderingUnitTests method shouldRenderSimpleSelect.
// DATAJDBC-278
@Test
public void shouldRenderSimpleSelect() {
Table table = Table.create("foo");
Select select = StatementBuilder.select(table.asterisk()).from(table).build();
String sql = SqlRenderer.create(factory.createRenderContext()).render(select);
assertThat(sql).isEqualTo("SELECT foo.* FROM foo");
}
Aggregations