Skip to content

Commit

Permalink
Fix precedence mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
timowest committed Mar 13, 2016
1 parent 0cfeeb5 commit 605de62
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Expand Up @@ -78,8 +78,8 @@ protected SQLServerTemplates(Set<String> keywords, char escape, boolean quote) {
setPrecedence(Precedence.ARITH_LOW, Ops.NEGATE);
setPrecedence(Precedence.COMPARISON, Ops.EQ, Ops.EQ_IGNORE_CASE, Ops.NE);
setPrecedence(Precedence.OR, Ops.BETWEEN, Ops.IN, Ops.NOT_IN, Ops.LIKE, Ops.LIKE_ESCAPE);

setPrecedence(Precedence.OR, OTHER_LIKE_CASES);
setPrecedence(Precedence.OR + 1, Ops.LIST, Ops.SINGLETON);

add(SQLOps.WITH_REPEATABLE_READ, "\nwith (repeatableread)");

Expand Down
Expand Up @@ -16,13 +16,12 @@
import static com.querydsl.sql.SQLExpressions.select;
import static org.junit.Assert.assertEquals;

import java.util.Collection;

import org.junit.Before;
import org.junit.Test;

import com.querydsl.core.types.Expression;
import com.querydsl.core.types.Operator;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.TemplatesTestUtils;
import com.querydsl.core.types.*;
import com.querydsl.core.types.dsl.Expressions;
import com.querydsl.core.types.dsl.NumberExpression;
import com.querydsl.sql.domain.QSurvey;
Expand Down Expand Up @@ -147,5 +146,15 @@ protected void assertSerialized(Expression<?> expr, String serialized) {
assertEquals(serialized, serializer.toString());
}

@Test
public void in() {
CollectionExpression<Collection<Integer>, Integer> ints = Expressions.collectionOperation(Integer.class, Ops.LIST,
Expressions.collectionOperation(Integer.class, Ops.LIST, Expressions.ONE, Expressions.TWO),
Expressions.THREE);
query.from(survey1).where(survey1.id.in(ints));
query.getMetadata().setProjection(survey1.name);
assertEquals("select survey1.NAME from SURVEY survey1 where survey1.ID in (1, 2, 3)", query.toString());
}


}

0 comments on commit 605de62

Please sign in to comment.