Search in sources :

Example 21 with QSurvey

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

the class UpdateBase method update_with_subQuery_exists_Params.

@Test
public void update_with_subQuery_exists_Params() {
    QSurvey survey1 = new QSurvey("s1");
    QEmployee employee = new QEmployee("e");
    Param<Integer> param = new Param<Integer>(Integer.class, "param");
    SQLQuery<?> sq = query().from(employee).where(employee.id.eq(param));
    sq.set(param, -12478923);
    SQLUpdateClause update = update(survey1);
    update.set(survey1.name, "AA");
    update.where(sq.exists());
    assertEquals(0, update.execute());
}
Also used : SQLUpdateClause(com.querydsl.sql.dml.SQLUpdateClause) Param(com.querydsl.core.types.dsl.Param) QSurvey(com.querydsl.sql.domain.QSurvey) QEmployee(com.querydsl.sql.domain.QEmployee) Test(org.junit.Test)

Example 22 with QSurvey

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

the class UpdateBase method update_with_subQuery_exists.

@Test
public void update_with_subQuery_exists() {
    QSurvey survey1 = new QSurvey("s1");
    QEmployee employee = new QEmployee("e");
    SQLUpdateClause update = update(survey1);
    update.set(survey1.name, "AA");
    update.where(selectOne().from(employee).where(survey1.id.eq(employee.id)).exists());
    assertEquals(1, update.execute());
}
Also used : SQLUpdateClause(com.querydsl.sql.dml.SQLUpdateClause) QSurvey(com.querydsl.sql.domain.QSurvey) QEmployee(com.querydsl.sql.domain.QEmployee) Test(org.junit.Test)

Example 23 with QSurvey

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

the class UpdateBase method update_with_subQuery_notExists.

@Test
public void update_with_subQuery_notExists() {
    QSurvey survey1 = new QSurvey("s1");
    QEmployee employee = new QEmployee("e");
    SQLUpdateClause update = update(survey1);
    update.set(survey1.name, "AA");
    update.where(query().from(employee).where(survey1.id.eq(employee.id)).notExists());
    assertEquals(0, update.execute());
}
Also used : SQLUpdateClause(com.querydsl.sql.dml.SQLUpdateClause) QSurvey(com.querydsl.sql.domain.QSurvey) QEmployee(com.querydsl.sql.domain.QEmployee) Test(org.junit.Test)

Example 24 with QSurvey

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

the class SerializationTest method with_tuple.

@Test
public void with_tuple() {
    PathBuilder<Survey> survey = new PathBuilder<Survey>(Survey.class, "SURVEY");
    QSurvey survey2 = new QSurvey("survey2");
    SQLQuery<?> q = new SQLQuery<Void>();
    q.with(survey, survey.get(survey2.id), survey.get(survey2.name)).as(select(survey2.id, survey2.name).from(survey2));
    assertEquals("with SURVEY (ID, NAME) as (select survey2.ID, survey2.NAME\n" + "from SURVEY survey2)\n\n" + "from dual", q.toString());
}
Also used : PathBuilder(com.querydsl.core.types.dsl.PathBuilder) QSurvey(com.querydsl.sql.domain.QSurvey) QSurvey(com.querydsl.sql.domain.QSurvey) Test(org.junit.Test)

Example 25 with QSurvey

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

the class SerializationTest method fullJoin.

@Test
public void fullJoin() {
    SQLQuery<?> query = new SQLQuery<Void>(connection, SQLTemplates.DEFAULT);
    query.from(new QSurvey("s1")).fullJoin(new QSurvey("s2"));
    assertEquals("from SURVEY s1\nfull join SURVEY s2", query.toString());
}
Also used : 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