[#3586] Context.paramType() is initially null instead of INDEXED

This commit is contained in:
Lukas Eder 2014-08-22 15:24:28 +02:00
parent a557297532
commit 754328b80b
2 changed files with 17 additions and 4 deletions

View File

@ -41,6 +41,7 @@
package org.jooq.impl;
import static java.util.Arrays.asList;
import static org.jooq.conf.ParamType.INDEXED;
import static org.jooq.impl.Utils.DATA_OMIT_CLAUSE_EVENT_EMISSION;
import java.sql.PreparedStatement;
@ -89,9 +90,9 @@ abstract class AbstractContext<C extends Context<C>> implements Context<C> {
private final Deque<QueryPart> visitParts;
// [#2694] Unified RenderContext and BindContext traversal
ParamType paramType;
boolean qualify = true;
CastMode castMode = CastMode.DEFAULT;
ParamType paramType = ParamType.INDEXED;
boolean qualify = true;
CastMode castMode = CastMode.DEFAULT;
SQLDialect[] castDialects;
AbstractContext(Configuration configuration, PreparedStatement stmt) {
@ -474,7 +475,7 @@ abstract class AbstractContext<C extends Context<C>> implements Context<C> {
@Override
public final C paramType(ParamType p) {
paramType = p;
paramType = (p == null ? INDEXED : p);
return (C) this;
}

View File

@ -40,6 +40,10 @@
*/
package org.jooq.test;
import static org.jooq.conf.ParamType.INDEXED;
import static org.jooq.conf.ParamType.INLINED;
import static org.jooq.conf.ParamType.NAMED;
import org.jooq.Context;
import org.jooq.RenderContext;
import org.jooq.impl.CustomCondition;
@ -53,6 +57,14 @@ import org.junit.Test;
*/
public class RenderContextTest extends AbstractTest {
@Test
public void testParamType() {
assertEquals(INDEXED, create.renderContext().paramType());
assertEquals(INDEXED, r_ref().paramType());
assertEquals(INLINED, r_refI().paramType());
assertEquals(NAMED, r_refP().paramType());
}
@Test
public void testData() {
RenderContext ctx = create.renderContext();