Search in sources :

Example 11 with QueryFlag

use of com.querydsl.core.QueryFlag in project querydsl by querydsl.

the class SQLServer2005Templates method serializeDelete.

@Override
public void serializeDelete(QueryMetadata metadata, RelationalPath<?> entity, SQLSerializer context) {
    // limit
    QueryModifiers mod = metadata.getModifiers();
    if (mod.isRestricting()) {
        metadata = metadata.clone();
        metadata.addFlag(new QueryFlag(QueryFlag.Position.AFTER_SELECT, Expressions.template(Integer.class, topTemplate, mod.getLimit())));
    }
    context.serializeForDelete(metadata, entity);
    if (!metadata.getFlags().isEmpty()) {
        context.serialize(Position.END, metadata.getFlags());
    }
}
Also used : QueryModifiers(com.querydsl.core.QueryModifiers) QueryFlag(com.querydsl.core.QueryFlag)

Example 12 with QueryFlag

use of com.querydsl.core.QueryFlag in project querydsl by querydsl.

the class OracleTemplatesTest method modifiers2.

@Test
public void modifiers2() {
    query.from(survey1).limit(5).offset(3);
    query.getMetadata().setProjection(survey1.id);
    query.getMetadata().addFlag(new QueryFlag(QueryFlag.Position.AFTER_PROJECTION, ", count(*) over() "));
    assertEquals("select * from (  " + "select a.*, rownum rn from (   " + "select survey1.ID, count(*) over()  from SURVEY survey1  ) " + "a) " + "where rn > 3 and rownum <= 5", query.toString());
}
Also used : QueryFlag(com.querydsl.core.QueryFlag) Test(org.junit.Test)

Aggregations

QueryFlag (com.querydsl.core.QueryFlag)12 QueryModifiers (com.querydsl.core.QueryModifiers)7 JoinExpression (com.querydsl.core.JoinExpression)1 SQLInsertBatch (com.querydsl.sql.dml.SQLInsertBatch)1 Test (org.junit.Test)1