[#93] Add Field.equalIgnoreCase(), Field.notEqualIgnoreCase()
This commit is contained in:
parent
7a4fb0a9ac
commit
8acde3b97a
@ -487,4 +487,19 @@ extends BaseTest<A, B, S, B2S, BS, L, X, DATE, D, T, U, I, IPK, T658, T725, T639
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIgnoreCase() {
|
||||
A author =
|
||||
create().selectFrom(TAuthor())
|
||||
.where(TAuthor_FIRST_NAME().equalIgnoreCase(TAuthor_FIRST_NAME()))
|
||||
.and(upper(TAuthor_FIRST_NAME()).equalIgnoreCase(lower(TAuthor_FIRST_NAME())))
|
||||
.and(TAuthor_FIRST_NAME().equalIgnoreCase("george"))
|
||||
.and(TAuthor_FIRST_NAME().equalIgnoreCase("geORge"))
|
||||
.and(TAuthor_FIRST_NAME().equalIgnoreCase("GEORGE"))
|
||||
.and(TAuthor_FIRST_NAME().notEqualIgnoreCase("paulo"))
|
||||
.fetchOne();
|
||||
|
||||
assertEquals("George", author.getValue(TAuthor_FIRST_NAME()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -811,6 +811,11 @@ public abstract class jOOQAbstractTest<
|
||||
new PredicateTests(this).testConditions();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIgnoreCase() throws Exception {
|
||||
new PredicateTests(this).testIgnoreCase();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLargeINCondition() throws Exception {
|
||||
new PredicateTests(this).testLargeINCondition();
|
||||
|
||||
@ -701,6 +701,18 @@ public interface Field<T> extends NamedTypeProviderQueryPart<T>, AliasProvider<F
|
||||
@Support
|
||||
Condition equal(Field<T> field);
|
||||
|
||||
/**
|
||||
* <code>lower(this) = lower(value)</code>
|
||||
*/
|
||||
@Support
|
||||
Condition equalIgnoreCase(String value);
|
||||
|
||||
/**
|
||||
* <code>lower(this) = lower(value)</code>
|
||||
*/
|
||||
@Support
|
||||
Condition equalIgnoreCase(Field<String> value);
|
||||
|
||||
/**
|
||||
* <code>this = (Select<?> ...)</code>
|
||||
*/
|
||||
@ -780,6 +792,18 @@ public interface Field<T> extends NamedTypeProviderQueryPart<T>, AliasProvider<F
|
||||
@Support
|
||||
Condition notEqual(Field<T> field);
|
||||
|
||||
/**
|
||||
* <code>lower(this) != lower(value)</code>
|
||||
*/
|
||||
@Support
|
||||
Condition notEqualIgnoreCase(String value);
|
||||
|
||||
/**
|
||||
* <code>lower(this) != lower(value)</code>
|
||||
*/
|
||||
@Support
|
||||
Condition notEqualIgnoreCase(Field<String> value);
|
||||
|
||||
/**
|
||||
* <code>this != (Select<?> ...)</code>
|
||||
*/
|
||||
|
||||
@ -535,6 +535,16 @@ abstract class AbstractField<T> extends AbstractNamedTypeProviderQueryPart<T> im
|
||||
return new CompareCondition(this, nullSafe(field), Comparator.EQUALS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition equalIgnoreCase(String value) {
|
||||
return equalIgnoreCase(val(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition equalIgnoreCase(Field<String> value) {
|
||||
return Factory.lower(cast(String.class)).equal(Factory.lower(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition equal(Select<?> query) {
|
||||
return new SelectQueryAsSubQueryCondition(query, this, SubQueryOperator.EQUALS);
|
||||
@ -586,6 +596,16 @@ abstract class AbstractField<T> extends AbstractNamedTypeProviderQueryPart<T> im
|
||||
return new CompareCondition(this, nullSafe(field), Comparator.NOT_EQUALS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition notEqualIgnoreCase(String value) {
|
||||
return notEqualIgnoreCase(val(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition notEqualIgnoreCase(Field<String> value) {
|
||||
return Factory.lower(cast(String.class)).notEqual(Factory.lower(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition notEqual(Select<?> query) {
|
||||
return new SelectQueryAsSubQueryCondition(query, this, SubQueryOperator.NOT_EQUALS);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user