Search in sources :

Example 26 with QSurvey

use of com.querydsl.sql.domain.QSurvey in project querydsl by querydsl.

the class SerializationTest method with_singleColumn.

@Test
public void with_singleColumn() {
    QSurvey survey2 = new QSurvey("survey2");
    SQLQuery<?> q = new SQLQuery<Void>();
    q.with(survey, new Path<?>[] { survey.id }).as(select(survey2.id).from(survey2));
    assertEquals("with SURVEY (ID) as (select survey2.ID\n" + "from SURVEY survey2)\n\n" + "from dual", q.toString());
}
Also used : Path(com.querydsl.core.types.Path) QSurvey(com.querydsl.sql.domain.QSurvey) Test(org.junit.Test)

Example 27 with QSurvey

use of com.querydsl.sql.domain.QSurvey in project querydsl by querydsl.

the class ListSubQueryTest method hashCode1.

@Test
public void hashCode1() {
    QSurvey survey = QSurvey.survey;
    QSurvey survey2 = new QSurvey("survey2");
    SubQueryExpression<Tuple> query1 = select(survey.all()).from(survey);
    SubQueryExpression<Tuple> query2 = select(survey2.all()).from(survey2);
    Set<SubQueryExpression<Tuple>> queries = Sets.newHashSet();
    queries.add(query1);
    queries.add(query2);
    assertEquals(2, queries.size());
}
Also used : SubQueryExpression(com.querydsl.core.types.SubQueryExpression) QSurvey(com.querydsl.sql.domain.QSurvey) Tuple(com.querydsl.core.Tuple) Test(org.junit.Test)

Example 28 with QSurvey

use of com.querydsl.sql.domain.QSurvey in project querydsl by querydsl.

the class MergeBase method merge_with_keys_and_subQuery.

@Test
@IncludeIn(H2)
public void merge_with_keys_and_subQuery() {
    assertEquals(1, insert(survey).set(survey.id, 6).set(survey.name, "H").execute());
    // keys + subquery
    QSurvey survey2 = new QSurvey("survey2");
    assertEquals(2, merge(survey).keys(survey.id).select(query().from(survey2).select(survey2.id.add(1), survey2.name, survey2.name2)).execute());
}
Also used : QSurvey(com.querydsl.sql.domain.QSurvey) Test(org.junit.Test) IncludeIn(com.querydsl.core.testutil.IncludeIn)

Example 29 with QSurvey

use of com.querydsl.sql.domain.QSurvey in project querydsl by querydsl.

the class SQLSerializerTest method startsWith.

@Test
public void startsWith() {
    SQLSerializer serializer = new SQLSerializer(Configuration.DEFAULT);
    QSurvey s1 = new QSurvey("s1");
    serializer.handle(s1.name.startsWith("X"));
    assertEquals("s1.NAME like ? escape '\\'", serializer.toString());
    assertEquals(Arrays.asList("X%"), serializer.getConstants());
}
Also used : QSurvey(com.querydsl.sql.domain.QSurvey) Test(org.junit.Test)

Example 30 with QSurvey

use of com.querydsl.sql.domain.QSurvey in project querydsl by querydsl.

the class SQLSerializerTest method boolean_.

@Test
public void boolean_() {
    QSurvey s = new QSurvey("s");
    BooleanBuilder bb1 = new BooleanBuilder();
    bb1.and(s.name.eq(s.name));
    BooleanBuilder bb2 = new BooleanBuilder();
    bb2.or(s.name.eq(s.name));
    bb2.or(s.name.eq(s.name));
    String str = new SQLSerializer(Configuration.DEFAULT).handle(bb1.and(bb2)).toString();
    assertEquals("s.NAME = s.NAME and (s.NAME = s.NAME or s.NAME = s.NAME)", str);
}
Also used : BooleanBuilder(com.querydsl.core.BooleanBuilder) QSurvey(com.querydsl.sql.domain.QSurvey) Test(org.junit.Test)

Aggregations

QSurvey (com.querydsl.sql.domain.QSurvey)34 Test (org.junit.Test)33 QEmployee (com.querydsl.sql.domain.QEmployee)10 SQLDeleteClause (com.querydsl.sql.dml.SQLDeleteClause)4 SQLUpdateClause (com.querydsl.sql.dml.SQLUpdateClause)4 SubQueryExpression (com.querydsl.core.types.SubQueryExpression)2 Param (com.querydsl.core.types.dsl.Param)2 BooleanBuilder (com.querydsl.core.BooleanBuilder)1 Tuple (com.querydsl.core.Tuple)1 IncludeIn (com.querydsl.core.testutil.IncludeIn)1 Path (com.querydsl.core.types.Path)1 QTuple (com.querydsl.core.types.QTuple)1 PathBuilder (com.querydsl.core.types.dsl.PathBuilder)1 SQLServerTemplates (com.querydsl.sql.SQLServerTemplates)1 Before (org.junit.Before)1 Ignore (org.junit.Ignore)1