Search in sources :

Example 1 with TestFrom

use of org.springframework.data.relational.core.sql.TestFrom in project spring-data-jdbc by spring-projects.

the class FromClauseVisitorUnitTests method testRendering.

static List<Fixture> testRendering() {
    Table tabOne = Table.create("tabOne");
    Table tabTwo = Table.create("tabTwo");
    Select selectOne = Select.builder().select(Column.create("oneId", tabOne)).from(tabOne).build();
    Select selectTwo = Select.builder().select(Column.create("twoId", tabTwo)).from(tabTwo).build();
    return Arrays.asList(fixture("single table", new TestFrom(Table.create("one")), "one"), fixture("single table with alias", new TestFrom(Table.aliased("one", "one_alias")), "one one_alias"), fixture("multiple tables", new TestFrom(Table.create("one"), Table.create("two")), "one, two"), fixture("multiple tables with alias", new TestFrom(Table.aliased("one", "one_alias"), Table.aliased("two", "two_alias")), "one one_alias, two two_alias"), fixture("single inline query", new TestFrom(InlineQuery.create(selectOne, "ilAlias")), "(SELECT tabOne.oneId FROM tabOne) ilAlias"), fixture("inline query with table", new TestFrom(InlineQuery.create(selectOne, "ilAlias"), tabTwo), "(SELECT tabOne.oneId FROM tabOne) ilAlias, tabTwo"), fixture("table with inline query", new TestFrom(tabTwo, InlineQuery.create(selectOne, "ilAlias")), "tabTwo, (SELECT tabOne.oneId FROM tabOne) ilAlias"), fixture("two inline queries", new TestFrom(InlineQuery.create(selectOne, "aliasOne"), InlineQuery.create(selectTwo, "aliasTwo")), "(SELECT tabOne.oneId FROM tabOne) aliasOne, (SELECT tabTwo.twoId FROM tabTwo) aliasTwo"));
}
Also used : Table(org.springframework.data.relational.core.sql.Table) TestFrom(org.springframework.data.relational.core.sql.TestFrom) Select(org.springframework.data.relational.core.sql.Select)

Aggregations

Select (org.springframework.data.relational.core.sql.Select)1 Table (org.springframework.data.relational.core.sql.Table)1 TestFrom (org.springframework.data.relational.core.sql.TestFrom)1