use of com.querydsl.sql.domain.QSurvey in project querydsl by querydsl.
the class DeleteBase method delete_with_subQuery_exists2.
@Test
public void delete_with_subQuery_exists2() {
QSurvey survey1 = new QSurvey("s1");
QEmployee employee = new QEmployee("e");
SQLDeleteClause delete = delete(survey1);
delete.where(survey1.name.eq("XXX"), query().from(employee).where(survey1.name.eq(employee.lastname)).exists());
assertEquals(0, delete.execute());
}
use of com.querydsl.sql.domain.QSurvey in project querydsl by querydsl.
the class SerializationTest method with_complex.
@Test
public void with_complex() {
QSurvey s = new QSurvey("s");
SQLQuery<?> q = new SQLQuery<Void>();
q.with(s, s.id, s.name).as(select(survey.id, survey.name).from(survey)).select(s.id, s.name, survey.id, survey.name).from(s, survey);
assertEquals("with s (ID, NAME) as (select SURVEY.ID, SURVEY.NAME\n" + "from SURVEY SURVEY)\n" + "select s.ID, s.NAME, SURVEY.ID, SURVEY.NAME\n" + "from s s, SURVEY SURVEY", q.toString());
}
use of com.querydsl.sql.domain.QSurvey in project querydsl by querydsl.
the class SerializationTest method rightJoin.
@Test
public void rightJoin() {
SQLQuery<?> query = new SQLQuery<Void>(connection, SQLTemplates.DEFAULT);
query.from(new QSurvey("s1")).rightJoin(new QSurvey("s2"));
assertEquals("from SURVEY s1\nright join SURVEY s2", query.toString());
}
use of com.querydsl.sql.domain.QSurvey in project querydsl by querydsl.
the class SerializationTest method with.
@Test
public void with() {
QSurvey survey2 = new QSurvey("survey2");
SQLQuery<?> q = new SQLQuery<Void>();
q.with(survey, survey.id, survey.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());
}
use of com.querydsl.sql.domain.QSurvey in project querydsl by querydsl.
the class MySQLQueryTest method syntax.
@Test
public void syntax() {
// SELECT
// [ALL | DISTINCT | DISTINCTROW ]
// [HIGH_PRIORITY]
query.highPriority();
// [STRAIGHT_JOIN]
query.straightJoin();
// [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]
query.smallResult();
query.bigResult();
query.bufferResult();
// [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]
query.cache();
query.noCache();
query.calcFoundRows();
// select_expr [, select_expr ...]
// [FROM table_references
query.from(new QSurvey("survey2"));
// [WHERE where_condition]
query.where(survey.id.isNotNull());
// [GROUP BY {col_name | expr | position}
query.groupBy(survey.name);
// [ASC | DESC], ... [WITH ROLLUP]]
query.withRollup();
// [HAVING where_condition]
query.having(survey.name.isNull());
// [ORDER BY {col_name | expr | position}
// [ASC | DESC], ...]
query.orderBy(survey.name.asc());
// [LIMIT {[offset,] row_count | row_count OFFSET offset}]
query.limit(2);
query.offset(3);
// [PROCEDURE procedure_name(argument_list)]
// TODO
// [INTO OUTFILE 'file_name' export_options
// | INTO DUMPFILE 'file_name'
// | INTO var_name [, var_name]]
// [FOR UPDATE | LOCK IN SHARE MODE]]
query.forUpdate();
query.lockInShareMode();
}
Aggregations