Removed unneeded InOperator (which is redundant with SubqueryOperator)

This commit is contained in:
Lukas Eder 2012-10-29 21:36:45 +01:00
parent 6543cb0f42
commit 3c25759f62
6 changed files with 32 additions and 97 deletions

View File

@ -524,7 +524,7 @@ abstract class AbstractField<T> extends AbstractQueryPart implements Field<T> {
return falseCondition();
}
else {
return new InCondition<T>(this, nullSafe(values), InOperator.IN);
return new InCondition<T>(this, nullSafe(values), SubqueryOperator.IN);
}
}
@ -541,7 +541,7 @@ abstract class AbstractField<T> extends AbstractQueryPart implements Field<T> {
@Override
public final Condition in(Select<? extends Record1<T>> query) {
return new SelectQueryAsSubQueryCondition(query, this, SubQueryOperator.IN);
return new SelectQueryAsSubQueryCondition(query, this, SubqueryOperator.IN);
}
@Override
@ -556,7 +556,7 @@ abstract class AbstractField<T> extends AbstractQueryPart implements Field<T> {
@Override
public final Condition notIn(Field<?>... values) {
return new InCondition<T>(this, nullSafe(values), InOperator.NOT_IN);
return new InCondition<T>(this, nullSafe(values), SubqueryOperator.NOT_IN);
}
@Override
@ -572,8 +572,7 @@ abstract class AbstractField<T> extends AbstractQueryPart implements Field<T> {
@Override
public final Condition notIn(Select<? extends Record1<T>> query) {
return new SelectQueryAsSubQueryCondition(
query, this, SubQueryOperator.NOT_IN);
return new SelectQueryAsSubQueryCondition(query, this, SubqueryOperator.NOT_IN);
}
@Override
@ -798,7 +797,7 @@ abstract class AbstractField<T> extends AbstractQueryPart implements Field<T> {
@Override
public final Condition equal(Select<? extends Record1<T>> query) {
return new SelectQueryAsSubQueryCondition(query, this, SubQueryOperator.EQUALS);
return new SelectQueryAsSubQueryCondition(query, this, SubqueryOperator.EQUALS);
}
@Override
@ -828,7 +827,7 @@ abstract class AbstractField<T> extends AbstractQueryPart implements Field<T> {
@Override
public final Condition notEqual(Select<? extends Record1<T>> query) {
return new SelectQueryAsSubQueryCondition(query, this, SubQueryOperator.NOT_EQUALS);
return new SelectQueryAsSubQueryCondition(query, this, SubqueryOperator.NOT_EQUALS);
}
@Override
@ -848,7 +847,7 @@ abstract class AbstractField<T> extends AbstractQueryPart implements Field<T> {
@Override
public final Condition lessThan(Select<? extends Record1<T>> query) {
return new SelectQueryAsSubQueryCondition(query, this, SubQueryOperator.LESS);
return new SelectQueryAsSubQueryCondition(query, this, SubqueryOperator.LESS);
}
@Override
@ -868,7 +867,7 @@ abstract class AbstractField<T> extends AbstractQueryPart implements Field<T> {
@Override
public final Condition lessOrEqual(Select<? extends Record1<T>> query) {
return new SelectQueryAsSubQueryCondition(query, this, SubQueryOperator.LESS_OR_EQUAL);
return new SelectQueryAsSubQueryCondition(query, this, SubqueryOperator.LESS_OR_EQUAL);
}
@Override
@ -888,7 +887,7 @@ abstract class AbstractField<T> extends AbstractQueryPart implements Field<T> {
@Override
public final Condition greaterThan(Select<? extends Record1<T>> query) {
return new SelectQueryAsSubQueryCondition(query, this, SubQueryOperator.GREATER);
return new SelectQueryAsSubQueryCondition(query, this, SubqueryOperator.GREATER);
}
@Override
@ -908,7 +907,7 @@ abstract class AbstractField<T> extends AbstractQueryPart implements Field<T> {
@Override
public final Condition greaterOrEqual(Select<? extends Record1<T>> query) {
return new SelectQueryAsSubQueryCondition(query, this, SubQueryOperator.GREATER_OR_EQUAL);
return new SelectQueryAsSubQueryCondition(query, this, SubqueryOperator.GREATER_OR_EQUAL);
}
@Override

View File

@ -48,14 +48,14 @@ import org.jooq.RenderContext;
*/
class InCondition<T> extends AbstractCondition {
private static final long serialVersionUID = -1653924248576930761L;
private static final int IN_LIMIT = 1000;
private static final long serialVersionUID = -1653924248576930761L;
private static final int IN_LIMIT = 1000;
private final Field<T> field;
private final Field<?>[] values;
private final InOperator operator;
private final Field<T> field;
private final Field<?>[] values;
private final SubqueryOperator operator;
InCondition(Field<T> field, Field<?>[] values, InOperator operator) {
InCondition(Field<T> field, Field<?>[] values, SubqueryOperator operator) {
this.field = field;
this.values = values;
this.operator = operator;
@ -87,7 +87,7 @@ class InCondition<T> extends AbstractCondition {
// [#1515] The connector depends on the IN / NOT IN
// operator
if (operator == InOperator.IN) {
if (operator == SubqueryOperator.IN) {
context.formatSeparator()
.keyword("or ");
}

View File

@ -1,64 +0,0 @@
/**
* Copyright (c) 2009-2012, Lukas Eder, lukas.eder@gmail.com
* All rights reserved.
*
* This software is licensed to you under the Apache License, Version 2.0
* (the "License"); You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* . Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* . Neither the name "jOOQ" nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq.impl;
/**
* A comparator to be used in in conditions
*
* @author Lukas Eder
*/
enum InOperator {
/**
* IN
*/
IN("in"),
/**
* NOT IN
*/
NOT_IN("not in");
private final String sql;
private InOperator(String sql) {
this.sql = sql;
}
public String toSQL() {
return sql;
}
}

View File

@ -52,7 +52,7 @@ import static org.jooq.SQLDialect.SQLITE;
import static org.jooq.SQLDialect.SQLSERVER;
import static org.jooq.SQLDialect.SYBASE;
import static org.jooq.impl.Factory.row;
import static org.jooq.impl.InOperator.NOT_IN;
import static org.jooq.impl.SubqueryOperator.NOT_IN;
import java.util.ArrayList;
import java.util.Arrays;
@ -846,20 +846,20 @@ implements
@Override
public final Condition in(Collection rows) {
QueryPartList<RowImpl<T1, T2, T3, T4, T5, T6, T7, T8>> list = new QueryPartList<RowImpl<T1, T2, T3, T4, T5, T6, T7, T8>>(rows);
return new InRows(list, InOperator.IN);
return new InRows(list, SubqueryOperator.IN);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public final Condition notIn(Collection rows) {
QueryPartList<RowImpl<T1, T2, T3, T4, T5, T6, T7, T8>> list = new QueryPartList<RowImpl<T1, T2, T3, T4, T5, T6, T7, T8>>(rows);
return new InRows(list, InOperator.NOT_IN);
return new InRows(list, SubqueryOperator.NOT_IN);
}
@SuppressWarnings("rawtypes")
@Override
public final Condition equal(Select select) {
return new Subquery(select, SubQueryOperator.EQUALS);
return new Subquery(select, SubqueryOperator.EQUALS);
}
@SuppressWarnings("rawtypes")
@ -871,7 +871,7 @@ implements
@SuppressWarnings("rawtypes")
@Override
public final Condition notEqual(Select select) {
return new Subquery(select, SubQueryOperator.NOT_EQUALS);
return new Subquery(select, SubqueryOperator.NOT_EQUALS);
}
@SuppressWarnings("rawtypes")
@ -883,13 +883,13 @@ implements
@SuppressWarnings("rawtypes")
@Override
public final Condition in(Select select) {
return new Subquery(select, SubQueryOperator.IN);
return new Subquery(select, SubqueryOperator.IN);
}
@SuppressWarnings("rawtypes")
@Override
public final Condition notIn(Select select) {
return new Subquery(select, SubQueryOperator.NOT_IN);
return new Subquery(select, SubqueryOperator.NOT_IN);
}
// ------------------------------------------------------------------------
@ -1099,9 +1099,9 @@ implements
private static final long serialVersionUID = -1806139685201770706L;
private final QueryPartList<RowImpl<T1, T2, T3, T4, T5, T6, T7, T8>> other;
private final InOperator operator;
private final SubqueryOperator operator;
InRows(QueryPartList<RowImpl<T1, T2, T3, T4, T5, T6, T7, T8>> other, InOperator operator) {
InRows(QueryPartList<RowImpl<T1, T2, T3, T4, T5, T6, T7, T8>> other, SubqueryOperator operator) {
this.other = other;
this.operator = operator;
}
@ -1169,9 +1169,9 @@ implements
private static final long serialVersionUID = -1806139685201770706L;
private final Select<?> other;
private final SubQueryOperator operator;
private final SubqueryOperator operator;
Subquery(Select<?> other, SubQueryOperator operator) {
Subquery(Select<?> other, SubqueryOperator operator) {
this.other = other;
this.operator = operator;
}

View File

@ -50,9 +50,9 @@ class SelectQueryAsSubQueryCondition extends AbstractCondition {
private final Select<?> query;
private final Field<?> field;
private final SubQueryOperator operator;
private final SubqueryOperator operator;
SelectQueryAsSubQueryCondition(Select<?> query, Field<?> field, SubQueryOperator operator) {
SelectQueryAsSubQueryCondition(Select<?> query, Field<?> field, SubqueryOperator operator) {
this.query = query;
this.field = field;
this.operator = operator;

View File

@ -41,7 +41,7 @@ package org.jooq.impl;
*
* @author Lukas Eder
*/
enum SubQueryOperator {
enum SubqueryOperator {
IN("in"),
NOT_IN("not in"),
@ -56,7 +56,7 @@ enum SubQueryOperator {
private final String sql;
private SubQueryOperator(String sql) {
private SubqueryOperator(String sql) {
this.sql = sql;
}