Restored pre-2.0 org.jooq.Field API for backwards-compatibility. This API will be removed later

This commit is contained in:
Lukas Eder 2011-11-27 14:30:53 +00:00
parent cd942db4bb
commit 5d2b412dde
26 changed files with 1770 additions and 68 deletions

View File

@ -30,7 +30,8 @@ Most important changes
<pre>trim(replace(NAME, " ", "_"))</pre>
Using static imports of Factory.*, jOOQ makes SQL look even
more like SQL
more like SQL. The current "postfix notation" is maintained for
backwards compatibility.
- By default, jooq-codegen will now generate a "dynamic" meta
model as opposed to the existing static one. Generated tables
covariantly override the as(String) aliasing method, leading
@ -88,8 +89,9 @@ order to upgrade, please be aware of the following pitfalls:
- The schema needs to be re-generated.
- Much of the post-fix function notation is replaced by static
methods in the Factory. Today's org.jooq.Field API is not
maintained in jOOQ 2.0
methods in the Factory. Today's org.jooq.Field API is
maintained in jOOQ 2.0, for backwards compatibility. It will
be removed, eventually, though.
- Some Factory instance methods (such as val(), literal()) are
now static. They are compatible, but may cause compiler
warnings.

77
jOOQ-test/src/Run.java Normal file
View File

@ -0,0 +1,77 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import org.jooq.impl.Factory;
import org.jooq.util.oracle.OracleFactory;
/**
* Copyright (c) 2009-2011, 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.
*/
public class Run {
/**
* @param args
* @throws SQLException
*/
public static void main(String[] args) throws SQLException {
Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "TEST", "TEST");
Factory create = new OracleFactory(connection);
System.out.println(create.fetch("with data as ("+
" select 'Lukas' as employee,"+
" 'SoftSkills' as company, "+
" 80000 as salary, "+
" 2007 as year "+
" from dual"+
" union all select 'Lukas', 'SoftSkills', 80000, 2008 from dual"+
" union all select 'Lukas', 'SmartSoft', 90000, 2009 from dual"+
" union all select 'Lukas', 'SmartSoft', 95000, 2010 from dual"+
" union all select 'Lukas', 'jOOQ', 200000, 2011 from dual"+
" union all select 'Lukas', 'jOOQ', 250000, 2012 from dual"+
" union all select 'Tom', 'SoftSkills', 89000, 2007 from dual"+
" union all select 'Tom', 'SoftSkills', 90000, 2008 from dual"+
" union all select 'Tom', 'SoftSkills', 91000, 2009 from dual"+
" union all select 'Tom', 'SmartSoft', 92000, 2010 from dual"+
" union all select 'Tom', 'SmartSoft', 93000, 2011 from dual"+
" union all select 'Tom', 'SmartSoft', 94000, 2012 from dual"+
" )"+
" select grouping_id(employee, company) id, company, employee, avg(salary)"+
" from data"+
" group by cube(employee, company)"));
}
}

View File

@ -1136,7 +1136,7 @@ public abstract class jOOQAbstractTest<
// [#610] Collision-prone entities are only available in HSQLDB
else if (getDialect() == HSQLDB) {
assertEquals(tables + 8, schema.getTables().size());
assertEquals(tables + 9, schema.getTables().size());
}
else {

View File

@ -30,7 +30,8 @@ Most important changes
<pre>trim(replace(NAME, " ", "_"))</pre>
Using static imports of Factory.*, jOOQ makes SQL look even
more like SQL
more like SQL. The current "postfix notation" is maintained for
backwards compatibility.
- By default, jooq-codegen will now generate a "dynamic" meta
model as opposed to the existing static one. Generated tables
covariantly override the as(String) aliasing method, leading
@ -76,7 +77,8 @@ sum(AMOUNT).over().partitionBy(ACCOUNT)
- Sequences now also have a <T> type
- Unsigned number types are now supported in those databases that
use them. Unsigned numbers are implemented in jOOU, a spin-off
open source project:
open source project. For convenience, this library is
"internalised" into jOOQ, to avoid adding a dependency
http://code.google.com/p/joou/
@ -87,8 +89,9 @@ order to upgrade, please be aware of the following pitfalls:
- The schema needs to be re-generated.
- Much of the post-fix function notation is replaced by static
methods in the Factory. Today's org.jooq.Field API is not
maintained in jOOQ 2.0
methods in the Factory. Today's org.jooq.Field API is
maintained in jOOQ 2.0, for backwards compatibility. It will
be removed, eventually, though.
- Some Factory instance methods (such as val(), literal()) are
now static. They are compatible, but may cause compiler
warnings.

View File

@ -36,9 +36,12 @@
package org.jooq;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Map;
import org.jooq.impl.Factory;
/**
* A field used in tables and conditions
*
@ -606,4 +609,974 @@ public interface Field<T> extends NamedTypeProviderQueryPart<T>, AliasProvider<F
*/
Condition greaterOrEqualAll(Select<?> query);
// ------------------------------------------------------------------------
// Pre-2.0 API. This API is maintained for backwards-compatibility. It will
// be removed in the future. Consider using equivalent methods from
// org.jooq.Factory
// ------------------------------------------------------------------------
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#sign(Field)
*/
Field<Integer> sign();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#abs(Field)
*/
Field<T> abs();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#round(Field)
*/
Field<T> round();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#round(Field, int)
*/
Field<T> round(int decimals);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#floor(Field)
*/
Field<T> floor();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#ceil(Field)
*/
Field<T> ceil();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#sqrt(Field)
*/
Field<BigDecimal> sqrt();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#exp(Field)
*/
Field<BigDecimal> exp();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#ln(Field)
*/
Field<BigDecimal> ln();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#log(Field, int)
*/
Field<BigDecimal> log(int base);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#power(Field, Number)
*/
Field<BigDecimal> power(Number exponent);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#acos(Field)
*/
Field<BigDecimal> acos();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#asin(Field)
*/
Field<BigDecimal> asin();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#atan(Field)
*/
Field<BigDecimal> atan();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#atan2(Field, Number)
*/
Field<BigDecimal> atan2(Number y);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#atan2(Field, Field)
*/
Field<BigDecimal> atan2(Field<? extends Number> y);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#cos(Field)
*/
Field<BigDecimal> cos();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#sin(Field)
*/
Field<BigDecimal> sin();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#tan(Field)
*/
Field<BigDecimal> tan();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#cot(Field)
*/
Field<BigDecimal> cot();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#sinh(Field)
*/
Field<BigDecimal> sinh();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#cosh(Field)
*/
Field<BigDecimal> cosh();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#tanh(Field)
*/
Field<BigDecimal> tanh();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#coth(Field)
*/
Field<BigDecimal> coth();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#deg(Field)
*/
Field<BigDecimal> deg();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#rad(Field)
*/
Field<BigDecimal> rad();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#count(Field)
*/
Field<Integer> count();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#countDistinct(Field)
*/
Field<Integer> countDistinct();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#max(Field)
*/
Field<T> max();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#min(Field)
*/
Field<T> min();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#sum(Field)
*/
Field<BigDecimal> sum();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#avg(Field)
*/
Field<BigDecimal> avg();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#median(Field)
*/
Field<BigDecimal> median();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#stddevPop(Field)
*/
Field<BigDecimal> stddevPop();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#stddevSamp(Field)
*/
Field<BigDecimal> stddevSamp();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#varPop(Field)
*/
Field<BigDecimal> varPop();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#varSamp(Field)
*/
Field<BigDecimal> varSamp();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#count(Field)
* @see AggregateFunction#over()
*/
WindowPartitionByStep<Integer> countOver();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#max(Field)
* @see AggregateFunction#over()
*/
WindowPartitionByStep<T> maxOver();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#min(Field)
* @see AggregateFunction#over()
*/
WindowPartitionByStep<T> minOver();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#sum(Field)
* @see AggregateFunction#over()
*/
WindowPartitionByStep<BigDecimal> sumOver();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#avg(Field)
* @see AggregateFunction#over()
*/
WindowPartitionByStep<BigDecimal> avgOver();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#firstValue(Field)
* @see AggregateFunction#over()
*/
WindowIgnoreNullsStep<T> firstValue();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#lastValue(Field)
* @see AggregateFunction#over()
*/
WindowIgnoreNullsStep<T> lastValue();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#lead(Field)
* @see AggregateFunction#over()
*/
WindowIgnoreNullsStep<T> lead();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#lead(Field, int)
* @see AggregateFunction#over()
*/
WindowIgnoreNullsStep<T> lead(int offset);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#lead(Field, int, Object)
* @see AggregateFunction#over()
*/
WindowIgnoreNullsStep<T> lead(int offset, T defaultValue);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#lead(Field, int, Field)
* @see AggregateFunction#over()
*/
WindowIgnoreNullsStep<T> lead(int offset, Field<T> defaultValue);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#lag(Field)
* @see AggregateFunction#over()
*/
WindowIgnoreNullsStep<T> lag();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#lag(Field, int)
* @see AggregateFunction#over()
*/
WindowIgnoreNullsStep<T> lag(int offset);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#lag(Field, int, Object)
* @see AggregateFunction#over()
*/
WindowIgnoreNullsStep<T> lag(int offset, T defaultValue);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#lag(Field, int, Field)
* @see AggregateFunction#over()
*/
WindowIgnoreNullsStep<T> lag(int offset, Field<T> defaultValue);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#stddevPop(Field)
* @see AggregateFunction#over()
*/
WindowPartitionByStep<BigDecimal> stddevPopOver();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#stddevSamp(Field)
* @see AggregateFunction#over()
*/
WindowPartitionByStep<BigDecimal> stddevSampOver();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#varPop(Field)
* @see AggregateFunction#over()
*/
WindowPartitionByStep<BigDecimal> varPopOver();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#varSamp(Field)
* @see AggregateFunction#over()
*/
WindowPartitionByStep<BigDecimal> varSampOver();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#upper(Field)
*/
Field<String> upper();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#lower(Field)
*/
Field<String> lower();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#trim(Field)
*/
Field<String> trim();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#rtrim(Field)
*/
Field<String> rtrim();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#ltrim(Field)
*/
Field<String> ltrim();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#rpad(Field, Field)
*/
Field<String> rpad(Field<? extends Number> length);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#rpad(Field, int)
*/
Field<String> rpad(int length);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#rpad(Field, Field, Field)
*/
Field<String> rpad(Field<? extends Number> length, Field<String> character);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#rpad(Field, int, char)
*/
Field<String> rpad(int length, char character);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#lpad(Field, Field)
*/
Field<String> lpad(Field<? extends Number> length);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#lpad(Field, int)
*/
Field<String> lpad(int length);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#lpad(Field, Field, Field)
*/
Field<String> lpad(Field<? extends Number> length, Field<String> character);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#lpad(Field, int, char)
*/
Field<String> lpad(int length, char character);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#repeat(Field, int)
*/
Field<String> repeat(Number count);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#repeat(Field, Field)
*/
Field<String> repeat(Field<? extends Number> count);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#replace(Field, Field)
*/
Field<String> replace(Field<String> search);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#replace(Field, String)
*/
Field<String> replace(String search);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#replace(Field, Field, Field)
*/
Field<String> replace(Field<String> search, Field<String> replace);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#replace(Field, String, String)
*/
Field<String> replace(String search, String replace);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#position(Field, String)
*/
Field<Integer> position(String search);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#position(Field, Field)
*/
Field<Integer> position(Field<String> search);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#ascii(Field)
*/
Field<Integer> ascii();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#concat(Field...)
*/
Field<String> concat(Field<?>... fields);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#concat(String...)
*/
Field<String> concat(String... values);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#substring(Field, int)
*/
Field<String> substring(int startingPosition);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#substring(Field, Field)
*/
Field<String> substring(Field<? extends Number> startingPosition);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#substring(Field, int, int)
*/
Field<String> substring(int startingPosition, int length);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#substring(Field, Field, Field)
*/
Field<String> substring(Field<? extends Number> startingPosition, Field<? extends Number> length);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#length(Field)
*/
Field<Integer> length();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#charLength(Field)
*/
Field<Integer> charLength();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#bitLength(Field)
*/
Field<Integer> bitLength();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#octetLength(Field)
*/
Field<Integer> octetLength();
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#extract(Field, DatePart)
*/
Field<Integer> extract(DatePart datePart);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#greatest(Field, Field...)
*/
Field<T> greatest(T... others);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#greatest(Field, Field...)
*/
Field<T> greatest(Field<?>... others);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#least(Field, Field...)
*/
Field<T> least(T... others);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#least(Field, Field...)
*/
Field<T> least(Field<?>... others);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#nvl(Field, Object)
*/
Field<T> nvl(T defaultValue);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#nvl(Field, Field)
*/
Field<T> nvl(Field<T> defaultValue);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#nvl2(Field, Object, Object)
*/
<Z> Field<Z> nvl2(Z valueIfNotNull, Z valueIfNull);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#nvl2(Field, Field, Field)
*/
<Z> Field<Z> nvl2(Field<Z> valueIfNotNull, Field<Z> valueIfNull);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#nullif(Field, Object)
*/
Field<T> nullif(T other);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#nullif(Field, Field)
*/
Field<T> nullif(Field<T> other);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#decode(Object, Object, Object)
*/
<Z> Field<Z> decode(T search, Z result);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#decode(Object, Object, Object, Object...)
*/
<Z> Field<Z> decode(T search, Z result, Object... more);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#decode(Field, Field, Field)
*/
<Z> Field<Z> decode(Field<T> search, Field<Z> result);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#decode(Field, Field, Field, Field...)
*/
<Z> Field<Z> decode(Field<T> search, Field<Z> result, Field<?>... more);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#coalesce(Object, Object...)
*/
Field<T> coalesce(T option, T... options);
/**
* This method is part of the pre-2.0 API. This API is maintained for
* backwards-compatibility. It may be removed in the future. Consider using
* equivalent methods from {@link Factory}
*
* @see Factory#coalesce(Field, Field...)
*/
Field<T> coalesce(Field<T> option, Field<?>... options);
}

View File

@ -45,6 +45,8 @@ import static org.jooq.impl.Factory.trueCondition;
import static org.jooq.impl.Factory.val;
import static org.jooq.impl.Factory.vals;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@ -59,11 +61,14 @@ import org.jooq.CaseWhenStep;
import org.jooq.Comparator;
import org.jooq.Condition;
import org.jooq.DataType;
import org.jooq.DatePart;
import org.jooq.Field;
import org.jooq.RenderContext;
import org.jooq.Select;
import org.jooq.SortField;
import org.jooq.SortOrder;
import org.jooq.WindowIgnoreNullsStep;
import org.jooq.WindowPartitionByStep;
import org.jooq.tools.Convert;
abstract class AbstractField<T> extends AbstractNamedTypeProviderQueryPart<T> implements Field<T> {
@ -605,4 +610,675 @@ abstract class AbstractField<T> extends AbstractNamedTypeProviderQueryPart<T> im
public final Condition greaterOrEqualAll(Select<?> query) {
return new SelectQueryAsSubQueryCondition(query, this, SubQueryOperator.GREATER_OR_EQUAL_ALL);
}
// ------------------------------------------------------------------------
// Pre-2.0 API. This API is maintained for backwards-compatibility. It will
// be removed in the future. Consider using equivalent methods from
// org.jooq.Factory
// ------------------------------------------------------------------------
@SuppressWarnings("unchecked")
private final <Z extends Number> Field<Z> numeric() {
if (getDataType().isNumeric()) {
return (Field<Z>) this;
}
else {
return (Field<Z>) cast(BigDecimal.class);
}
}
@SuppressWarnings("unchecked")
private final Field<String> varchar() {
if (getDataType().isString()) {
return (Field<String>) this;
}
else {
return cast(String.class);
}
}
@SuppressWarnings("unchecked")
private final <Z extends java.util.Date> Field<Z> date() {
if (getDataType().isTemporal()) {
return (Field<Z>) this;
}
else {
return (Field<Z>) cast(Timestamp.class);
}
}
@Override
@Deprecated
public final Field<Integer> sign() {
return Factory.sign(numeric());
}
@SuppressWarnings("unchecked")
@Override
@Deprecated
public final Field<T> abs() {
return (Field<T>) Factory.abs(numeric());
}
@SuppressWarnings("unchecked")
@Override
@Deprecated
public final Field<T> round() {
return (Field<T>) Factory.round(numeric());
}
@SuppressWarnings("unchecked")
@Override
@Deprecated
public final Field<T> round(int decimals) {
return (Field<T>) Factory.round(numeric(), decimals);
}
@SuppressWarnings("unchecked")
@Override
@Deprecated
public final Field<T> floor() {
return (Field<T>) Factory.floor(numeric());
}
@SuppressWarnings("unchecked")
@Override
@Deprecated
public final Field<T> ceil() {
return (Field<T>) Factory.ceil(numeric());
}
@Override
@Deprecated
public final Field<BigDecimal> sqrt() {
return Factory.sqrt(numeric());
}
@Override
@Deprecated
public final Field<BigDecimal> exp() {
return Factory.exp(numeric());
}
@Override
@Deprecated
public final Field<BigDecimal> ln() {
return Factory.ln(numeric());
}
@Override
@Deprecated
public final Field<BigDecimal> log(int base) {
return Factory.log(numeric(), base);
}
@Override
@Deprecated
public final Field<BigDecimal> power(Number exponent) {
return Factory.power(numeric(), exponent);
}
@Override
@Deprecated
public final Field<BigDecimal> acos() {
return Factory.acos(numeric());
}
@Override
@Deprecated
public final Field<BigDecimal> asin() {
return Factory.asin(numeric());
}
@Override
@Deprecated
public final Field<BigDecimal> atan() {
return Factory.atan(numeric());
}
@Override
@Deprecated
public final Field<BigDecimal> atan2(Number y) {
return Factory.atan2(numeric(), y);
}
@Override
@Deprecated
public final Field<BigDecimal> atan2(Field<? extends Number> y) {
return Factory.atan2(numeric(), y);
}
@Override
@Deprecated
public final Field<BigDecimal> cos() {
return Factory.cos(numeric());
}
@Override
@Deprecated
public final Field<BigDecimal> sin() {
return Factory.sin(numeric());
}
@Override
@Deprecated
public final Field<BigDecimal> tan() {
return Factory.tan(numeric());
}
@Override
@Deprecated
public final Field<BigDecimal> cot() {
return Factory.cot(numeric());
}
@Override
@Deprecated
public final Field<BigDecimal> sinh() {
return Factory.sinh(numeric());
}
@Override
@Deprecated
public final Field<BigDecimal> cosh() {
return Factory.cosh(numeric());
}
@Override
@Deprecated
public final Field<BigDecimal> tanh() {
return Factory.tanh(numeric());
}
@Override
@Deprecated
public final Field<BigDecimal> coth() {
return Factory.coth(numeric());
}
@Override
@Deprecated
public final Field<BigDecimal> deg() {
return Factory.deg(numeric());
}
@Override
@Deprecated
public final Field<BigDecimal> rad() {
return Factory.rad(numeric());
}
@Override
@Deprecated
public final Field<Integer> count() {
return Factory.count(this);
}
@Override
@Deprecated
public final Field<Integer> countDistinct() {
return Factory.countDistinct(this);
}
@Override
@Deprecated
public final Field<T> max() {
return Factory.max(this);
}
@Override
@Deprecated
public final Field<T> min() {
return Factory.min(this);
}
@Override
@Deprecated
public final Field<BigDecimal> sum() {
return Factory.sum(numeric());
}
@Override
@Deprecated
public final Field<BigDecimal> avg() {
return Factory.avg(numeric());
}
@Override
@Deprecated
public final Field<BigDecimal> median() {
return Factory.median(numeric());
}
@Override
@Deprecated
public final Field<BigDecimal> stddevPop() {
return Factory.stddevPop(numeric());
}
@Override
@Deprecated
public final Field<BigDecimal> stddevSamp() {
return Factory.stddevSamp(numeric());
}
@Override
@Deprecated
public final Field<BigDecimal> varPop() {
return Factory.varPop(numeric());
}
@Override
@Deprecated
public final Field<BigDecimal> varSamp() {
return Factory.varSamp(numeric());
}
@Override
@Deprecated
public final WindowPartitionByStep<Integer> countOver() {
return Factory.count(this).over();
}
@Override
@Deprecated
public final WindowPartitionByStep<T> maxOver() {
return Factory.max(this).over();
}
@Override
@Deprecated
public final WindowPartitionByStep<T> minOver() {
return Factory.min(this).over();
}
@Override
@Deprecated
public final WindowPartitionByStep<BigDecimal> sumOver() {
return Factory.sum(numeric()).over();
}
@Override
@Deprecated
public final WindowPartitionByStep<BigDecimal> avgOver() {
return Factory.avg(numeric()).over();
}
@Override
@Deprecated
public final WindowIgnoreNullsStep<T> firstValue() {
return Factory.firstValue(this);
}
@Override
@Deprecated
public final WindowIgnoreNullsStep<T> lastValue() {
return Factory.lastValue(this);
}
@Override
@Deprecated
public final WindowIgnoreNullsStep<T> lead() {
return Factory.lead(this);
}
@Override
@Deprecated
public final WindowIgnoreNullsStep<T> lead(int offset) {
return Factory.lead(this, offset);
}
@Override
@Deprecated
public final WindowIgnoreNullsStep<T> lead(int offset, T defaultValue) {
return Factory.lead(this, offset, defaultValue);
}
@Override
@Deprecated
public final WindowIgnoreNullsStep<T> lead(int offset, Field<T> defaultValue) {
return Factory.lead(this, offset, defaultValue);
}
@Override
@Deprecated
public final WindowIgnoreNullsStep<T> lag() {
return Factory.lag(this);
}
@Override
@Deprecated
public final WindowIgnoreNullsStep<T> lag(int offset) {
return Factory.lag(this, offset);
}
@Override
@Deprecated
public final WindowIgnoreNullsStep<T> lag(int offset, T defaultValue) {
return Factory.lag(this, offset, defaultValue);
}
@Override
@Deprecated
public final WindowIgnoreNullsStep<T> lag(int offset, Field<T> defaultValue) {
return Factory.lag(this, offset, defaultValue);
}
@Override
@Deprecated
public final WindowPartitionByStep<BigDecimal> stddevPopOver() {
return Factory.stddevPop(numeric()).over();
}
@Override
@Deprecated
public final WindowPartitionByStep<BigDecimal> stddevSampOver() {
return Factory.stddevSamp(numeric()).over();
}
@Override
@Deprecated
public final WindowPartitionByStep<BigDecimal> varPopOver() {
return Factory.varPop(numeric()).over();
}
@Override
@Deprecated
public final WindowPartitionByStep<BigDecimal> varSampOver() {
return Factory.varSamp(numeric()).over();
}
@Override
@Deprecated
public final Field<String> upper() {
return Factory.upper(varchar());
}
@Override
@Deprecated
public final Field<String> lower() {
return Factory.lower(varchar());
}
@Override
@Deprecated
public final Field<String> trim() {
return Factory.trim(varchar());
}
@Override
@Deprecated
public final Field<String> rtrim() {
return Factory.rtrim(varchar());
}
@Override
@Deprecated
public final Field<String> ltrim() {
return Factory.ltrim(varchar());
}
@Override
@Deprecated
public final Field<String> rpad(Field<? extends Number> length) {
return Factory.rpad(varchar(), length);
}
@Override
@Deprecated
public final Field<String> rpad(int length) {
return Factory.rpad(varchar(), length);
}
@Override
@Deprecated
public final Field<String> rpad(Field<? extends Number> length, Field<String> character) {
return Factory.rpad(varchar(), length, character);
}
@Override
@Deprecated
public final Field<String> rpad(int length, char character) {
return Factory.rpad(varchar(), length, character);
}
@Override
@Deprecated
public final Field<String> lpad(Field<? extends Number> length) {
return Factory.lpad(varchar(), length);
}
@Override
@Deprecated
public final Field<String> lpad(int length) {
return Factory.lpad(varchar(), length);
}
@Override
@Deprecated
public final Field<String> lpad(Field<? extends Number> length, Field<String> character) {
return Factory.lpad(varchar(), length, character);
}
@Override
@Deprecated
public final Field<String> lpad(int length, char character) {
return Factory.lpad(varchar(), length, character);
}
@Override
@Deprecated
public final Field<String> repeat(Number count) {
return Factory.repeat(varchar(), count == null ? 0 : count.intValue());
}
@Override
@Deprecated
public final Field<String> repeat(Field<? extends Number> count) {
return Factory.repeat(varchar(), count);
}
@Override
@Deprecated
public final Field<String> replace(Field<String> search) {
return Factory.replace(varchar(), search);
}
@Override
@Deprecated
public final Field<String> replace(String search) {
return Factory.replace(varchar(), search);
}
@Override
@Deprecated
public final Field<String> replace(Field<String> search, Field<String> replace) {
return Factory.replace(varchar(), search, replace);
}
@Override
@Deprecated
public final Field<String> replace(String search, String replace) {
return Factory.replace(varchar(), search, replace);
}
@Override
@Deprecated
public final Field<Integer> position(String search) {
return Factory.position(varchar(), search);
}
@Override
@Deprecated
public final Field<Integer> position(Field<String> search) {
return Factory.position(varchar(), search);
}
@Override
@Deprecated
public final Field<Integer> ascii() {
return Factory.ascii(varchar());
}
@Override
@Deprecated
public final Field<String> concat(Field<?>... fields) {
return Factory.concat(Util.combine(this, fields));
}
@Override
@Deprecated
public final Field<String> concat(String... values) {
return Factory.concat(Util.combine(this, vals((Object[]) values).toArray(new Field[0])));
}
@Override
@Deprecated
public final Field<String> substring(int startingPosition) {
return Factory.substring(varchar(), startingPosition);
}
@Override
@Deprecated
public final Field<String> substring(Field<? extends Number> startingPosition) {
return Factory.substring(varchar(), startingPosition);
}
@Override
@Deprecated
public final Field<String> substring(int startingPosition, int length) {
return Factory.substring(varchar(), startingPosition, length);
}
@Override
@Deprecated
public final Field<String> substring(Field<? extends Number> startingPosition, Field<? extends Number> length) {
return Factory.substring(varchar(), startingPosition, length);
}
@Override
@Deprecated
public final Field<Integer> length() {
return Factory.length(varchar());
}
@Override
@Deprecated
public final Field<Integer> charLength() {
return Factory.charLength(varchar());
}
@Override
@Deprecated
public final Field<Integer> bitLength() {
return Factory.bitLength(varchar());
}
@Override
@Deprecated
public final Field<Integer> octetLength() {
return Factory.octetLength(varchar());
}
@Override
@Deprecated
public final Field<Integer> extract(DatePart datePart) {
return Factory.extract(date(), datePart);
}
@Override
@Deprecated
public final Field<T> greatest(T... others) {
return Factory.greatest(this, vals(others).toArray(new Field[0]));
}
@Override
@Deprecated
public final Field<T> greatest(Field<?>... others) {
return Factory.greatest(this, others);
}
@Override
@Deprecated
public final Field<T> least(T... others) {
return Factory.least(this, vals(others).toArray(new Field[0]));
}
@Override
@Deprecated
public final Field<T> least(Field<?>... others) {
return Factory.least(this, others);
}
@Override
@Deprecated
public final Field<T> nvl(T defaultValue) {
return Factory.nvl(this, defaultValue);
}
@Override
@Deprecated
public final Field<T> nvl(Field<T> defaultValue) {
return Factory.nvl(this, defaultValue);
}
@Override
@Deprecated
public final <Z> Field<Z> nvl2(Z valueIfNotNull, Z valueIfNull) {
return Factory.nvl2(this, valueIfNotNull, valueIfNull);
}
@Override
@Deprecated
public final <Z> Field<Z> nvl2(Field<Z> valueIfNotNull, Field<Z> valueIfNull) {
return Factory.nvl2(this, valueIfNotNull, valueIfNull);
}
@Override
@Deprecated
public final Field<T> nullif(T other) {
return Factory.nullif(this, other);
}
@Override
@Deprecated
public final Field<T> nullif(Field<T> other) {
return Factory.nullif(this, other);
}
@Override
@Deprecated
public final <Z> Field<Z> decode(T search, Z result) {
return Factory.decode(this, search, result);
}
@Override
@Deprecated
public final <Z> Field<Z> decode(T search, Z result, Object... more) {
return Factory.decode(this, search, result, more);
}
@Override
@Deprecated
public final <Z> Field<Z> decode(Field<T> search, Field<Z> result) {
return Factory.decode(this, search, result);
}
@Override
@Deprecated
public final <Z> Field<Z> decode(Field<T> search, Field<Z> result, Field<?>... more) {
return Factory.decode(this, search, result, more);
}
@Override
@Deprecated
public final Field<T> coalesce(T option, T... options) {
return Factory.coalesce(this, Util.combine(val(option), vals(options).toArray(new Field[0])));
}
@Override
@Deprecated
public final Field<T> coalesce(Field<T> option, Field<?>... options) {
return Factory.coalesce(this, Util.combine(option, options));
}
}

View File

@ -37,7 +37,6 @@ package org.jooq.impl;
import static java.util.Arrays.asList;
import static org.jooq.impl.Factory.literal;
import static org.jooq.impl.Factory.lower;
import static org.jooq.impl.SQLDataType.BOOLEAN;
import static org.jooq.impl.SQLDataType.DOUBLE;
import static org.jooq.impl.SQLDataType.FLOAT;
@ -153,8 +152,8 @@ class Cast<T> extends AbstractField<T> {
// [#859] '0', 'f', 'false' => false, null => null, all else is true
return Factory.decode().when(s.equal(literal("'0'")), literal(false))
.when(lower(s).equal(literal("'false'")), literal(false))
.when(lower(s).equal(literal("'f'")), literal(false))
.when(Factory.lower(s).equal(literal("'false'")), literal(false))
.when(Factory.lower(s).equal(literal("'f'")), literal(false))
.when(s.isNull(), literal((Boolean) null))
.otherwise(literal(true));
}

View File

@ -36,7 +36,6 @@
package org.jooq.impl;
import static org.jooq.impl.Factory.function;
import static org.jooq.impl.Factory.round;
import org.jooq.Configuration;
import org.jooq.Field;
@ -65,7 +64,7 @@ class Ceil<T extends Number> extends AbstractFunction<T> {
// evaluate "ceil" if unavailable
case SQLITE:
return round(argument.add(0.499999999999999));
return Factory.round(argument.add(0.499999999999999));
case ASE:
case H2:

View File

@ -35,7 +35,6 @@
*/
package org.jooq.impl;
import static org.jooq.impl.Factory.exp;
import static org.jooq.impl.Factory.function;
import static org.jooq.impl.Factory.one;
import static org.jooq.impl.Factory.two;
@ -73,7 +72,7 @@ class Cosh extends AbstractFunction<BigDecimal> {
case POSTGRES:
case SQLSERVER:
case SYBASE:
return exp(argument.mul(two())).add(one()).div(exp(argument).mul(two()));
return Factory.exp(argument.mul(two())).add(one()).div(Factory.exp(argument).mul(two()));
default:
return function("cosh", SQLDataType.NUMERIC, argument);

View File

@ -35,9 +35,7 @@
*/
package org.jooq.impl;
import static org.jooq.impl.Factory.cos;
import static org.jooq.impl.Factory.function;
import static org.jooq.impl.Factory.sin;
import java.math.BigDecimal;
@ -67,7 +65,7 @@ class Cot extends AbstractFunction<BigDecimal> {
switch (configuration.getDialect()) {
case INGRES:
case ORACLE:
return cos(argument).div(sin(argument));
return Factory.cos(argument).div(Factory.sin(argument));
default:
return function("cot", SQLDataType.NUMERIC, argument);

View File

@ -35,7 +35,6 @@
*/
package org.jooq.impl;
import static org.jooq.impl.Factory.exp;
import static org.jooq.impl.Factory.function;
import static org.jooq.impl.Factory.literal;
import static org.jooq.impl.Factory.one;
@ -73,7 +72,7 @@ class Euler extends AbstractFunction<BigDecimal> {
case POSTGRES:
case SQLSERVER:
case SYBASE:
return exp(one());
return Factory.exp(one());
case SQLITE:
return literal(Math.E, BigDecimal.class);

View File

@ -60,7 +60,6 @@ import static org.jooq.impl.Factory.bitOr;
import static org.jooq.impl.Factory.bitXor;
import static org.jooq.impl.Factory.function;
import static org.jooq.impl.Factory.literal;
import static org.jooq.impl.Factory.power;
import java.util.Arrays;
import java.util.List;
@ -142,10 +141,10 @@ class Expression<T> extends AbstractFunction<T> {
// Many dialects don't support shifts. Use multiplication/division instead
else if (SHL == operator && asList(ASE, DB2, H2, HSQLDB, INGRES, ORACLE, SQLSERVER, SYBASE).contains(dialect)) {
return lhs.mul(power(literal(2), rhsAsNumber()));
return lhs.mul(Factory.power(literal(2), rhsAsNumber()));
}
else if (SHR == operator && asList(ASE, DB2, H2, HSQLDB, INGRES, ORACLE, SQLSERVER, SYBASE).contains(dialect)) {
return lhs.div(power(literal(2), rhsAsNumber()));
return lhs.div(Factory.power(literal(2), rhsAsNumber()));
}
// These operators are not supported in any dialect

View File

@ -36,7 +36,6 @@
package org.jooq.impl;
import static org.jooq.impl.Factory.function;
import static org.jooq.impl.Factory.round;
import org.jooq.Configuration;
import org.jooq.Field;
@ -65,7 +64,7 @@ class Floor<T extends Number> extends AbstractFunction<T> {
// evaluate "floor" if unavailable
case SQLITE:
return round(argument.sub(0.499999999999999));
return Factory.round(argument.sub(0.499999999999999));
default:
return function("floor", getDataType(), argument);

View File

@ -36,7 +36,6 @@
package org.jooq.impl;
import static org.jooq.impl.Factory.function;
import static org.jooq.impl.Factory.greatest;
import org.jooq.Configuration;
import org.jooq.DataType;
@ -81,8 +80,8 @@ class Greatest<T> extends AbstractFunction<T> {
System.arraycopy(getArguments(), 2, remaining, 0, remaining.length);
return Factory.decode()
.when(first.greaterThan(other), greatest(first, remaining))
.otherwise(greatest(other, remaining));
.when(first.greaterThan(other), Factory.greatest(first, remaining))
.otherwise(Factory.greatest(other, remaining));
}
else {
return Factory.decode()

View File

@ -36,7 +36,6 @@
package org.jooq.impl;
import static org.jooq.impl.Factory.function;
import static org.jooq.impl.Factory.least;
import org.jooq.Configuration;
import org.jooq.DataType;
@ -81,8 +80,8 @@ class Least<T> extends AbstractFunction<T> {
System.arraycopy(getArguments(), 2, remaining, 0, remaining.length);
return Factory.decode()
.when(first.lessThan(other), least(first, remaining))
.otherwise(least(other, remaining));
.when(first.lessThan(other), Factory.least(first, remaining))
.otherwise(Factory.least(other, remaining));
}
else {
return Factory.decode()

View File

@ -37,7 +37,6 @@ package org.jooq.impl;
import static org.jooq.impl.Factory.function;
import static org.jooq.impl.Factory.literal;
import static org.jooq.impl.Factory.ln;
import java.math.BigDecimal;
@ -91,7 +90,7 @@ class Ln extends AbstractFunction<BigDecimal> {
case INGRES:
case SQLSERVER:
case SYBASE:
return ln(argument).div(ln(literal(base)));
return Factory.ln(argument).div(Factory.ln(literal(base)));
default:
return function("log", SQLDataType.NUMERIC, literal(base), argument);

View File

@ -35,10 +35,7 @@
*/
package org.jooq.impl;
import static org.jooq.impl.Factory.concat;
import static org.jooq.impl.Factory.function;
import static org.jooq.impl.Factory.length;
import static org.jooq.impl.Factory.repeat;
import static org.jooq.impl.Factory.val;
import org.jooq.Configuration;
@ -78,10 +75,10 @@ class Lpad extends AbstractFunction<String> {
case SQLSERVER:
case SYBASE: {
if (character == null) {
return concat(repeat(" ", length.sub(length(field))), field);
return Factory.concat(Factory.repeat(" ", length.sub(Factory.length(field))), field);
}
else {
return concat(repeat(character, length.sub(length(field))), field);
return Factory.concat(Factory.repeat(character, length.sub(Factory.length(field))), field);
}
}

View File

@ -35,7 +35,6 @@
*/
package org.jooq.impl;
import static org.jooq.impl.Factory.asin;
import static org.jooq.impl.Factory.function;
import static org.jooq.impl.Factory.literal;
import static org.jooq.impl.Factory.one;
@ -65,7 +64,7 @@ class Pi extends AbstractFunction<BigDecimal> {
switch (configuration.getDialect()) {
case DB2:
case ORACLE:
return asin(one()).mul(two());
return Factory.asin(one()).mul(two());
case SQLITE:
return literal(Math.PI, BigDecimal.class);

View File

@ -35,9 +35,7 @@
*/
package org.jooq.impl;
import static org.jooq.impl.Factory.exp;
import static org.jooq.impl.Factory.function;
import static org.jooq.impl.Factory.ln;
import java.math.BigDecimal;
@ -69,7 +67,7 @@ class Power extends AbstractFunction<BigDecimal> {
switch (configuration.getDialect()) {
case DERBY:
case SQLITE:
return exp(ln(arg1).mul(arg2));
return Factory.exp(Factory.ln(arg1).mul(arg2));
default:
return function("power", SQLDataType.NUMERIC, getArguments());

View File

@ -36,8 +36,6 @@
package org.jooq.impl;
import static org.jooq.impl.Factory.function;
import static org.jooq.impl.Factory.length;
import static org.jooq.impl.Factory.rpad;
import org.jooq.Configuration;
import org.jooq.Field;
@ -67,7 +65,7 @@ class Repeat extends AbstractFunction<String> {
switch (configuration.getDialect()) {
case INGRES:
case ORACLE:
return rpad(string, length(string).mul(count), string);
return Factory.rpad(string, Factory.length(string).mul(count), string);
case ASE:
case SQLSERVER:

View File

@ -35,8 +35,6 @@
*/
package org.jooq.impl;
import static org.jooq.impl.Factory.ceil;
import static org.jooq.impl.Factory.floor;
import static org.jooq.impl.Factory.function;
import static org.jooq.impl.Factory.val;
@ -78,18 +76,18 @@ class Round<T extends Number> extends AbstractFunction<T> {
case DERBY: {
if (decimals == 0) {
return Factory.decode()
.when(argument.sub(floor(argument))
.lessThan((T) Double.valueOf(0.5)), floor(argument))
.otherwise(ceil(argument));
.when(argument.sub(Factory.floor(argument))
.lessThan((T) Double.valueOf(0.5)), Factory.floor(argument))
.otherwise(Factory.ceil(argument));
}
else {
Field<BigDecimal> factor = Factory.val(BigDecimal.ONE.movePointRight(decimals));
Field<T> mul = argument.mul(factor);
return Factory.decode()
.when(mul.sub(floor(mul))
.lessThan((T) Double.valueOf(0.5)), floor(mul).div(factor))
.otherwise(ceil(mul).div(factor));
.when(mul.sub(Factory.floor(mul))
.lessThan((T) Double.valueOf(0.5)), Factory.floor(mul).div(factor))
.otherwise(Factory.ceil(mul).div(factor));
}
}

View File

@ -35,10 +35,7 @@
*/
package org.jooq.impl;
import static org.jooq.impl.Factory.concat;
import static org.jooq.impl.Factory.function;
import static org.jooq.impl.Factory.length;
import static org.jooq.impl.Factory.repeat;
import static org.jooq.impl.Factory.val;
import org.jooq.Configuration;
@ -78,10 +75,10 @@ class Rpad extends AbstractFunction<String> {
case SQLSERVER:
case SYBASE: {
if (character == null) {
return concat(field, repeat(" ", length.sub(length(field))));
return Factory.concat(field, Factory.repeat(" ", length.sub(Factory.length(field))));
}
else {
return concat(field, repeat(character, length.sub(length(field))));
return Factory.concat(field, Factory.repeat(character, length.sub(Factory.length(field))));
}
}

View File

@ -35,7 +35,6 @@
*/
package org.jooq.impl;
import static org.jooq.impl.Factory.exp;
import static org.jooq.impl.Factory.function;
import static org.jooq.impl.Factory.one;
import static org.jooq.impl.Factory.two;
@ -73,7 +72,7 @@ class Sinh extends AbstractFunction<BigDecimal> {
case POSTGRES:
case SQLSERVER:
case SYBASE:
return exp(argument.mul(two())).sub(one()).div(exp(argument).mul(two()));
return Factory.exp(argument.mul(two())).sub(one()).div(Factory.exp(argument).mul(two()));
default:
return function("sinh", SQLDataType.NUMERIC, argument);

View File

@ -36,7 +36,6 @@
package org.jooq.impl;
import static org.jooq.impl.Factory.function;
import static org.jooq.impl.Factory.power;
import java.math.BigDecimal;
@ -65,7 +64,7 @@ class Sqrt extends AbstractFunction<BigDecimal> {
final Field<BigDecimal> getFunction0(Configuration configuration) {
switch (configuration.getDialect()) {
case SQLITE:
return power(argument, 0.5);
return Factory.power(argument, 0.5);
default:
return function("sqrt", SQLDataType.NUMERIC, argument);

View File

@ -35,7 +35,6 @@
*/
package org.jooq.impl;
import static org.jooq.impl.Factory.exp;
import static org.jooq.impl.Factory.function;
import static org.jooq.impl.Factory.one;
import static org.jooq.impl.Factory.two;
@ -73,7 +72,7 @@ class Tanh extends AbstractFunction<BigDecimal> {
case POSTGRES:
case SQLSERVER:
case SYBASE:
return exp(argument.mul(two())).sub(one()).div(exp(argument.mul(two())).add(one()));
return Factory.exp(argument.mul(two())).sub(one()).div(Factory.exp(argument.mul(two())).add(one()));
default:
return function("tanh", SQLDataType.NUMERIC, argument);

View File

@ -36,8 +36,6 @@
package org.jooq.impl;
import static org.jooq.impl.Factory.function;
import static org.jooq.impl.Factory.ltrim;
import static org.jooq.impl.Factory.rtrim;
import org.jooq.Configuration;
import org.jooq.Field;
@ -66,7 +64,7 @@ class Trim extends AbstractFunction<String> {
case ASE:
case INGRES:
case SQLSERVER:
return ltrim(rtrim(argument));
return Factory.ltrim(Factory.rtrim(argument));
default:
return function("trim", SQLDataType.VARCHAR, argument);