use of com.querydsl.core.testutil.IncludeIn in project querydsl by querydsl.
the class InsertBase method uuids.
@Test
@IncludeIn({ H2, POSTGRESQL })
@SkipForQuoted
public void uuids() {
delete(QUuids.uuids).execute();
QUuids uuids = QUuids.uuids;
UUID uuid = UUID.randomUUID();
insert(uuids).set(uuids.field, uuid).execute();
assertEquals(uuid, query().from(uuids).select(uuids.field).fetchFirst());
}
use of com.querydsl.core.testutil.IncludeIn in project querydsl by querydsl.
the class InsertBase method insert_with_special_options.
@Test
@IncludeIn(MYSQL)
@SkipForQuoted
public void insert_with_special_options() {
SQLInsertClause clause = insert(survey).columns(survey.id, survey.name).values(3, "Hello");
clause.addFlag(Position.START_OVERRIDE, "insert ignore into ");
assertEquals("insert ignore into SURVEY (ID, NAME) values (?, ?)", clause.toString());
assertEquals(1, clause.execute());
}
use of com.querydsl.core.testutil.IncludeIn in project querydsl by querydsl.
the class TargetRule method isExecuted.
private boolean isExecuted(Description description, Target target) {
ExcludeIn ex = description.getAnnotation(ExcludeIn.class);
// excluded in given targets
if (ex != null && Arrays.asList(ex.value()).contains(target)) {
return false;
}
// included only in given targets
IncludeIn in = description.getAnnotation(IncludeIn.class);
if (in != null && !Arrays.asList(in.value()).contains(target)) {
return false;
}
return true;
}
use of com.querydsl.core.testutil.IncludeIn in project querydsl by querydsl.
the class SelectOracleBase method sumOver.
@Test
@IncludeIn(ORACLE)
@SkipForQuoted
public void sumOver() throws SQLException {
// SQL> select deptno,
// 2 ename,
// 3 sal,
// 4 sum(sal) over (partition by deptno
// 5 order by sal,ename) CumDeptTot,
// 6 sum(sal) over (partition by deptno) SalByDept,
// 7 sum(sal) over (order by deptno, sal) CumTot,
// 8 sum(sal) over () TotSal
// 9 from emp
// 10 order by deptno, sal;
expectedQuery = "select e.LASTNAME, e.SALARY, " + "sum(e.SALARY) over (partition by e.SUPERIOR_ID order by e.LASTNAME asc, e.SALARY asc), " + "sum(e.SALARY) over (order by e.SUPERIOR_ID asc, e.SALARY asc), " + "sum(e.SALARY) over () from EMPLOYEE e order by e.SALARY asc, e.SUPERIOR_ID asc";
oracleQuery().from(employee).orderBy(employee.salary.asc(), employee.superiorId.asc()).select(employee.lastname, employee.salary, SQLExpressions.sum(employee.salary).over().partitionBy(employee.superiorId).orderBy(employee.lastname, employee.salary), SQLExpressions.sum(employee.salary).over().orderBy(employee.superiorId, employee.salary), SQLExpressions.sum(employee.salary).over()).fetch();
// shorter version
QEmployee e = employee;
oracleQuery().from(e).orderBy(e.salary.asc(), e.superiorId.asc()).select(e.lastname, e.salary, SQLExpressions.sum(e.salary).over().partitionBy(e.superiorId).orderBy(e.lastname, e.salary), SQLExpressions.sum(e.salary).over().orderBy(e.superiorId, e.salary), SQLExpressions.sum(e.salary).over()).fetch();
}
use of com.querydsl.core.testutil.IncludeIn in project querydsl by querydsl.
the class MergeBase method mergeBatch_templates.
@Test
@IncludeIn(H2)
public void mergeBatch_templates() {
SQLMergeClause merge = merge(survey).keys(survey.id).set(survey.id, 5).set(survey.name, Expressions.stringTemplate("'5'")).addBatch();
merge.keys(survey.id).set(survey.id, 6).set(survey.name, Expressions.stringTemplate("'6'")).addBatch();
assertEquals(2, merge.execute());
assertEquals(1L, query().from(survey).where(survey.name.eq("5")).fetchCount());
assertEquals(1L, query().from(survey).where(survey.name.eq("6")).fetchCount());
}
Aggregations