[#7497] Adaptations after the merge
This commit is contained in:
parent
3146a29a19
commit
6ec1958876
@ -234,9 +234,8 @@ public abstract class AbstractGeneratorStrategy implements GeneratorStrategy {
|
||||
List<? extends Definition> nonNull = nonNull(definitions);
|
||||
List<String> result = new ArrayList<String>(nonNull.size());
|
||||
|
||||
for (Definition definition : nonNull) {
|
||||
for (Definition definition : nonNull)
|
||||
result.add(getJavaIdentifier(definition));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -251,9 +250,8 @@ public abstract class AbstractGeneratorStrategy implements GeneratorStrategy {
|
||||
List<? extends Definition> nonNull = nonNull(definitions);
|
||||
List<String> result = new ArrayList<String>(nonNull.size());
|
||||
|
||||
for (Definition definition : nonNull) {
|
||||
for (Definition definition : nonNull)
|
||||
result.add(getFullJavaIdentifier(definition));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -266,11 +264,9 @@ public abstract class AbstractGeneratorStrategy implements GeneratorStrategy {
|
||||
private static final <T> List<T> nonNull(Collection<? extends T> collection) {
|
||||
List<T> result = new ArrayList<T>();
|
||||
|
||||
for (T t : collection) {
|
||||
if (t != null) {
|
||||
for (T t : collection)
|
||||
if (t != null)
|
||||
result.add(t);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -48,6 +48,7 @@ Authors and contributors of jOOQ or parts of jOOQ in alphabetical order:
|
||||
- Sven Jacobs
|
||||
- Szymon Jachim
|
||||
- Terence Zhang
|
||||
- Timothy Wilson
|
||||
- Timur Shaidullin
|
||||
- Thomas Darimont
|
||||
- Tsukasa Kitachi
|
||||
|
||||
@ -1344,10 +1344,10 @@ public abstract class AbstractDatabase implements Database {
|
||||
String literals = enumType.getLiterals();
|
||||
|
||||
try {
|
||||
@SuppressWarnings("resource")
|
||||
CSVReader reader = new CSVReader(new StringReader(literals));
|
||||
e.addLiterals(reader.readNext());
|
||||
} catch (IOException ignore) {}
|
||||
}
|
||||
catch (IOException ignore) {}
|
||||
|
||||
result.add(e);
|
||||
}
|
||||
|
||||
@ -573,7 +573,7 @@ abstract class AbstractDMLQuery<R extends Record> extends AbstractQuery {
|
||||
|
||||
case HSQLDB:
|
||||
default: {
|
||||
List<String> names = new ArrayList<String>(returningResolvedAsterisks.size());
|
||||
List<String> names = new ArrayList<String>();
|
||||
RenderNameStyle style = configuration().settings().getRenderNameStyle();
|
||||
|
||||
for (Field<?> field : returningResolvedAsterisks) {
|
||||
|
||||
@ -66,11 +66,10 @@ import static org.jooq.tools.Convert.TRUE_VALUES;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.function.Function;
|
||||
@ -947,12 +946,13 @@ abstract class AbstractField<T> extends AbstractNamed implements Field<T> {
|
||||
|
||||
@Override
|
||||
public final Condition in(Collection<?> values) {
|
||||
List<Field<?>> fields = new ArrayList<Field<?>>(values.size());
|
||||
Field<?>[] fields = new Field[values.size()];
|
||||
|
||||
for (Object value : values)
|
||||
fields.add(Tools.field(value, this));
|
||||
Iterator<?> it = values.iterator();
|
||||
for (int i = 0; it.hasNext(); i++)
|
||||
fields[i] = Tools.field(it.next(), this);
|
||||
|
||||
return in(fields.toArray(EMPTY_FIELD));
|
||||
return in(fields);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -987,12 +987,13 @@ abstract class AbstractField<T> extends AbstractNamed implements Field<T> {
|
||||
|
||||
@Override
|
||||
public final Condition notIn(Collection<?> values) {
|
||||
List<Field<?>> fields = new ArrayList<Field<?>>(values.size());
|
||||
Field<?>[] fields = new Field[values.size()];
|
||||
|
||||
for (Object value : values)
|
||||
fields.add(Tools.field(value, this));
|
||||
Iterator<?> it = values.iterator();
|
||||
for (int i = 0; it.hasNext(); i++)
|
||||
fields[i] = Tools.field(it.next(), this);
|
||||
|
||||
return notIn(fields.toArray(EMPTY_FIELD));
|
||||
return notIn(fields);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -75,7 +75,6 @@ import static org.jooq.impl.Keywords.K_TRUE;
|
||||
import static org.jooq.impl.Keywords.K_TYPE;
|
||||
import static org.jooq.impl.Keywords.K_WHEN;
|
||||
import static org.jooq.impl.Keywords.K_XMLTABLE;
|
||||
import static org.jooq.impl.Tools.EMPTY_FIELD;
|
||||
import static org.jooq.impl.Tools.executeStatementAndGetFirstResultSet;
|
||||
import static org.jooq.impl.Tools.settings;
|
||||
|
||||
@ -86,6 +85,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -1606,9 +1606,10 @@ public abstract class AbstractRoutine<T> extends AbstractNamed implements Routin
|
||||
RenderContext local = create(ctx).renderContext();
|
||||
toSQLQualifiedName(local);
|
||||
|
||||
List<Field<?>> fields = new ArrayList<Field<?>>(getInParameters().size());
|
||||
for (Parameter<?> parameter : getInParameters()) {
|
||||
|
||||
Field<?>[] fields = new Field[getInParameters().size()];
|
||||
Iterator<Parameter<?>> it = getInParameters().iterator();
|
||||
for (int i = 0; it.hasNext(); i++) {
|
||||
Parameter<?> parameter = it.next();
|
||||
// [#1183] [#3533] Skip defaulted parameters
|
||||
if (inValuesDefaulted.contains(parameter))
|
||||
continue;
|
||||
@ -1619,19 +1620,19 @@ public abstract class AbstractRoutine<T> extends AbstractNamed implements Routin
|
||||
// [#4920] In case there are any unnamed parameters, we mustn't
|
||||
if (hasUnnamedParameters())
|
||||
if (pgArgNeedsCasting(parameter))
|
||||
fields.add(new Cast(getInValues().get(parameter), parameter.getDataType()));
|
||||
fields[i] = new Cast(getInValues().get(parameter), parameter.getDataType());
|
||||
else
|
||||
fields.add(getInValues().get(parameter));
|
||||
fields[i] = getInValues().get(parameter);
|
||||
else
|
||||
if (pgArgNeedsCasting(parameter))
|
||||
fields.add(DSL.field("{0} := {1}", name(parameter.getName()), new Cast(getInValues().get(parameter), parameter.getDataType())));
|
||||
fields[i] = DSL.field("{0} := {1}", name(parameter.getName()), new Cast(getInValues().get(parameter), parameter.getDataType()));
|
||||
else
|
||||
fields.add(DSL.field("{0} := {1}", name(parameter.getName()), getInValues().get(parameter)));
|
||||
fields[i] = DSL.field("{0} := {1}", name(parameter.getName()), getInValues().get(parameter));
|
||||
else
|
||||
fields.add(getInValues().get(parameter));
|
||||
fields[i] = getInValues().get(parameter);
|
||||
}
|
||||
|
||||
Field<T> result = function(local.render(), getDataType(), fields.toArray(EMPTY_FIELD));
|
||||
Field<T> result = function(local.render(), getDataType(), fields);
|
||||
|
||||
|
||||
// [#3592] Decrease SQL -> PL/SQL context switches with Oracle Scalar Subquery Caching
|
||||
|
||||
@ -39,7 +39,6 @@ package org.jooq.impl;
|
||||
|
||||
import static org.jooq.conf.ParamType.INLINED;
|
||||
import static org.jooq.conf.SettingsTools.executeStaticStatements;
|
||||
import static org.jooq.impl.Tools.EMPTY_FIELD;
|
||||
import static org.jooq.impl.Tools.dataTypes;
|
||||
import static org.jooq.impl.Tools.fields;
|
||||
import static org.jooq.impl.Tools.visitAll;
|
||||
@ -47,6 +46,7 @@ import static org.jooq.impl.Tools.visitAll;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -200,11 +200,12 @@ final class BatchSingle implements BatchBindStep {
|
||||
// [#4062] Make sure we collect also repeated named parameters
|
||||
ParamCollector collector = new ParamCollector(configuration, false);
|
||||
collector.visit(query);
|
||||
List<Param<?>> params = new ArrayList<Param<?>>(collector.resultList.size());
|
||||
for (Entry<String, Param<?>> entry : collector.resultList)
|
||||
params.add(entry.getValue());
|
||||
Param<?>[] params = new Param[collector.resultList.size()];
|
||||
Iterator<Entry<String, Param<?>>> it = collector.resultList.iterator();
|
||||
for (int i = 0; it.hasNext(); i++)
|
||||
params[i] = it.next().getValue();
|
||||
|
||||
DataType<?>[] paramTypes = dataTypes(params.toArray(EMPTY_FIELD));
|
||||
DataType<?>[] paramTypes = dataTypes(params);
|
||||
|
||||
try {
|
||||
listener.renderStart(ctx);
|
||||
@ -266,9 +267,8 @@ final class BatchSingle implements BatchBindStep {
|
||||
List<Query> queries = new ArrayList<Query>(allBindValues.size());
|
||||
|
||||
for (Object[] bindValues : allBindValues) {
|
||||
for (int i = 0; i < bindValues.length; i++) {
|
||||
for (int i = 0; i < bindValues.length; i++)
|
||||
query.bind(i + 1, bindValues[i]);
|
||||
}
|
||||
|
||||
queries.add(create.query(query.getSQL(INLINED)));
|
||||
}
|
||||
|
||||
@ -88,6 +88,7 @@ final class DDL {
|
||||
private final List<Query> alterTableAddConstraints(Table<?> table) {
|
||||
List<Constraint> constraints = constraints(table);
|
||||
List<Query> result = new ArrayList<Query>(constraints.size());
|
||||
|
||||
for (Constraint constraint : constraints)
|
||||
result.add(ctx.alterTable(table).add(constraint));
|
||||
|
||||
|
||||
@ -1460,22 +1460,14 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
|
||||
}
|
||||
else {
|
||||
List<Field<?>> fields = new ArrayList<Field<?>>(strings.get(0).length);
|
||||
int firstRow;
|
||||
int firstRow = header ? 1 : 0;
|
||||
|
||||
if (header) {
|
||||
firstRow = 1;
|
||||
|
||||
for (String name : strings.get(0)) {
|
||||
if (header)
|
||||
for (String name : strings.get(0))
|
||||
fields.add(field(name(name), String.class));
|
||||
}
|
||||
}
|
||||
else {
|
||||
firstRow = 0;
|
||||
|
||||
for (int i = 0; i < strings.get(0).length; i++) {
|
||||
else
|
||||
for (int i = 0; i < strings.get(0).length; i++)
|
||||
fields.add(field(name("COL" + (i + 1)), String.class));
|
||||
}
|
||||
}
|
||||
|
||||
Result<Record> result = new ResultImpl<Record>(configuration(), fields);
|
||||
|
||||
|
||||
@ -639,15 +639,16 @@ final class InsertQueryImpl<R extends Record> extends AbstractStoreQuery<R> impl
|
||||
else if (onConstraintUniqueKey != null)
|
||||
return Collections.singletonList(onConstraintUniqueKey.getFields());
|
||||
|
||||
// [#6462] MySQL ON DUPLICATGE KEY UPDATE clause
|
||||
// [#6462] MySQL ON DUPLICATE KEY UPDATE clause
|
||||
// Flag for backwards compatibility considers only PRIMARY KEY
|
||||
else if (TRUE.equals(Tools.settings(configuration).isEmulateOnDuplicateKeyUpdateOnPrimaryKeyOnly()))
|
||||
return Collections.singletonList(table.getPrimaryKey().getFields());
|
||||
|
||||
// [#6462] MySQL ON DUPLICATGE KEY UPDATE clause
|
||||
// [#6462] MySQL ON DUPLICATE KEY UPDATE clause
|
||||
// All conflicting keys are considered
|
||||
List<List<? extends Field<?>>> result = new ArrayList<List<? extends Field<?>>>(table.getKeys().size());
|
||||
for (UniqueKey<R> key : table.getKeys())
|
||||
List<UniqueKey<R>> keys = table.getKeys();
|
||||
List<List<? extends Field<?>>> result = new ArrayList<List<? extends Field<?>>>(keys.size());
|
||||
for (UniqueKey<R> key : keys)
|
||||
result.add(key.getFields());
|
||||
|
||||
return result;
|
||||
|
||||
@ -103,6 +103,7 @@ final class JSONReader implements Closeable {
|
||||
private final void readRecords(LinkedHashMap<String, LinkedList<?>> jsonRoot) {
|
||||
LinkedList<?> rootRecords = jsonRoot.get("records");
|
||||
records = new ArrayList<String[]>(rootRecords.size());
|
||||
|
||||
for (Object record : rootRecords) {
|
||||
String[] v = new String[fieldNames.length];
|
||||
int i = 0;
|
||||
|
||||
@ -55,7 +55,6 @@ import static org.jooq.impl.DSL.exists;
|
||||
import static org.jooq.impl.DSL.insertInto;
|
||||
import static org.jooq.impl.DSL.notExists;
|
||||
import static org.jooq.impl.DSL.nullSafe;
|
||||
import static org.jooq.impl.DSL.row;
|
||||
import static org.jooq.impl.Keywords.K_AND;
|
||||
import static org.jooq.impl.Keywords.K_AS;
|
||||
import static org.jooq.impl.Keywords.K_DELETE_WHERE;
|
||||
@ -286,25 +285,22 @@ implements
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
QueryPartList<Field<?>> getUpsertFields() {
|
||||
if (upsertFields == null) {
|
||||
if (upsertFields == null)
|
||||
upsertFields = new QueryPartList<Field<?>>(table.fields());
|
||||
}
|
||||
|
||||
return upsertFields;
|
||||
}
|
||||
|
||||
QueryPartList<Field<?>> getUpsertKeys() {
|
||||
if (upsertKeys == null) {
|
||||
if (upsertKeys == null)
|
||||
upsertKeys = new QueryPartList<Field<?>>();
|
||||
}
|
||||
|
||||
return upsertKeys;
|
||||
}
|
||||
|
||||
QueryPartList<Field<?>> getUpsertValues() {
|
||||
if (upsertValues == null) {
|
||||
if (upsertValues == null)
|
||||
upsertValues = new QueryPartList<Field<?>>();
|
||||
}
|
||||
|
||||
return upsertValues;
|
||||
}
|
||||
@ -1213,9 +1209,8 @@ implements
|
||||
Row row = upsertSelect.fieldsRow();
|
||||
List<Field<?>> v = new ArrayList<Field<?>>(row.size());
|
||||
|
||||
for (int i = 0; i < row.size(); i++) {
|
||||
for (int i = 0; i < row.size(); i++)
|
||||
v.add(row.field(i).as("s" + (i + 1)));
|
||||
}
|
||||
|
||||
// [#579] TODO: Currently, this syntax may require aliasing
|
||||
// on the call-site
|
||||
@ -1224,9 +1219,8 @@ implements
|
||||
else {
|
||||
List<Field<?>> v = new ArrayList<Field<?>>(getUpsertValues().size());
|
||||
|
||||
for (int i = 0; i < getUpsertValues().size(); i++) {
|
||||
for (int i = 0; i < getUpsertValues().size(); i++)
|
||||
v.add(getUpsertValues().get(i).as("s" + (i + 1)));
|
||||
}
|
||||
|
||||
src = DSL.select(v).asTable("src");
|
||||
}
|
||||
|
||||
@ -115,11 +115,11 @@ final class RowCondition extends AbstractCondition {
|
||||
// Regular comparison predicate emulation
|
||||
if ((comparator == EQUALS || comparator == NOT_EQUALS) &&
|
||||
EMULATE_EQ_AND_NE.contains(dialect.family())) {
|
||||
List<Condition> conditions = new ArrayList<Condition>(left.fields().length);
|
||||
|
||||
Field<?>[] leftFields = left.fields();
|
||||
Field<?>[] rightFields = right.fields();
|
||||
|
||||
List<Condition> conditions = new ArrayList<Condition>(leftFields.length);
|
||||
for (int i = 0; i < leftFields.length; i++)
|
||||
conditions.add(leftFields[i].equal((Field) rightFields[i]));
|
||||
|
||||
|
||||
@ -109,9 +109,10 @@ final class RowIsNull extends AbstractCondition {
|
||||
// CUBRID 9.0.0 and HSQLDB have buggy implementations of the NULL predicate.
|
||||
// Informix doesn't implement the RVE IS NULL predicate.
|
||||
if (EMULATE_NULL.contains(configuration.family())) {
|
||||
List<Condition> conditions = new ArrayList<Condition>(row.fields().length);
|
||||
Field<?>[] fields = row.fields();
|
||||
List<Condition> conditions = new ArrayList<Condition>(fields.length);
|
||||
|
||||
for (Field<?> field : row.fields())
|
||||
for (Field<?> field : fields)
|
||||
conditions.add(isNull ? field.isNull() : field.isNotNull());
|
||||
|
||||
Condition result = DSL.and(conditions);
|
||||
|
||||
@ -47,7 +47,7 @@ import static org.jooq.Comparator.NOT_IN;
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
import static org.jooq.SQLDialect.HSQLDB;
|
||||
import static org.jooq.SQLDialect.MARIADB;
|
||||
import static org.jooq.SQLDialect.*;
|
||||
import static org.jooq.SQLDialect.MYSQL;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.POSTGRES;
|
||||
// ...
|
||||
@ -57,12 +57,9 @@ import static org.jooq.impl.DSL.name;
|
||||
import static org.jooq.impl.DSL.notExists;
|
||||
import static org.jooq.impl.DSL.row;
|
||||
import static org.jooq.impl.DSL.select;
|
||||
import static org.jooq.impl.Tools.EMPTY_STRING;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_ROW_VALUE_EXPRESSION_PREDICATE_SUBQUERY;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.jooq.Clause;
|
||||
import org.jooq.Comparator;
|
||||
@ -153,13 +150,13 @@ final class RowSubqueryCondition extends AbstractCondition {
|
||||
else {
|
||||
String table = render == null ? "t" : render.nextAlias();
|
||||
|
||||
List<String> names = new ArrayList<String>(left.size());
|
||||
String[] names = new String[left.size()];
|
||||
for (int i = 0; i < left.size(); i++)
|
||||
names.add(table + "_" + i);
|
||||
names[i] = table + "_" + i;
|
||||
|
||||
Field<?>[] fields = new Field[names.size()];
|
||||
Field<?>[] fields = new Field[names.length];
|
||||
for (int i = 0; i < fields.length; i++)
|
||||
fields[i] = field(name(table, names.get(i)));
|
||||
fields[i] = field(name(table, names[i]));
|
||||
|
||||
Condition condition;
|
||||
switch (comparator) {
|
||||
@ -189,7 +186,7 @@ final class RowSubqueryCondition extends AbstractCondition {
|
||||
}
|
||||
|
||||
Select<Record> subselect =
|
||||
select().from(right.asTable(table, names.toArray(EMPTY_STRING)))
|
||||
select().from(right.asTable(table, names))
|
||||
.where(condition);
|
||||
|
||||
switch (comparator) {
|
||||
|
||||
@ -1421,12 +1421,13 @@ final class Tools {
|
||||
* values created from the argument objects.
|
||||
*/
|
||||
static final <T> List<Field<T>> fields(T[] values) {
|
||||
int length = values == null ? 0 : values.length;
|
||||
List<Field<T>> result = new ArrayList<Field<T>>(length);
|
||||
if (values == null)
|
||||
return new ArrayList<Field<T>>();
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
List<Field<T>> result = new ArrayList<Field<T>>(values.length);
|
||||
|
||||
for (int i = 0; i < values.length; i++)
|
||||
result.add(field(values[i]));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1440,12 +1441,13 @@ final class Tools {
|
||||
* values created from the argument objects.
|
||||
*/
|
||||
static final List<Field<?>> fields(Object[] values, Field<?> field) {
|
||||
int length = values == null || field == null ? 0 : values.length;
|
||||
List<Field<?>> result = new ArrayList<Field<?>>(length);
|
||||
if (values == null || field == null)
|
||||
return new ArrayList<Field<?>>();
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
List<Field<?>> result = new ArrayList<Field<?>>(values.length);
|
||||
|
||||
for (int i = 0; i < values.length; i++)
|
||||
result.add(field(values[i], field));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1459,12 +1461,14 @@ final class Tools {
|
||||
* values created from the argument objects.
|
||||
*/
|
||||
static final List<Field<?>> fields(Object[] values, Field<?>[] fields) {
|
||||
int length = values == null || fields == null ? 0 : Math.min(values.length, fields.length);
|
||||
if (values == null || fields == null)
|
||||
return new ArrayList<Field<?>>();
|
||||
|
||||
int length = Math.min(values.length, fields.length);
|
||||
List<Field<?>> result = new ArrayList<Field<?>>(length);
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
for (int i = 0; i < length; i++)
|
||||
result.add(field(values[i], fields[i]));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1478,12 +1482,13 @@ final class Tools {
|
||||
* values created from the argument objects.
|
||||
*/
|
||||
static final List<Field<?>> fields(Object[] values, Class<?> type) {
|
||||
int length = values == null || type == null ? 0 : values.length;
|
||||
List<Field<?>> result = new ArrayList<Field<?>>(length);
|
||||
if (values == null || type == null)
|
||||
return new ArrayList<Field<?>>();
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
List<Field<?>> result = new ArrayList<Field<?>>(values.length);
|
||||
|
||||
for (int i = 0; i < values.length; i++)
|
||||
result.add(field(values[i], type));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1497,12 +1502,14 @@ final class Tools {
|
||||
* values created from the argument objects.
|
||||
*/
|
||||
static final List<Field<?>> fields(Object[] values, Class<?>[] types) {
|
||||
int length = values == null || types == null ? 0 : Math.min(values.length, types.length);
|
||||
if (values == null || types == null)
|
||||
return new ArrayList<Field<?>>();
|
||||
|
||||
int length = Math.min(values.length, types.length);
|
||||
List<Field<?>> result = new ArrayList<Field<?>>(length);
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
for (int i = 0; i < length; i++)
|
||||
result.add(field(values[i], types[i]));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1516,12 +1523,13 @@ final class Tools {
|
||||
* values created from the argument objects.
|
||||
*/
|
||||
static final List<Field<?>> fields(Object[] values, DataType<?> type) {
|
||||
int length = values == null || type == null ? 0 : values.length;
|
||||
List<Field<?>> result = new ArrayList<Field<?>>(length);
|
||||
if (values == null || type == null)
|
||||
return new ArrayList<Field<?>>();
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
List<Field<?>> result = new ArrayList<Field<?>>(values.length);
|
||||
|
||||
for (int i = 0; i < values.length; i++)
|
||||
result.add(field(values[i], type));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1535,23 +1543,26 @@ final class Tools {
|
||||
* values created from the argument objects.
|
||||
*/
|
||||
static final List<Field<?>> fields(Object[] values, DataType<?>[] types) {
|
||||
int length = values == null || types == null ? 0 : Math.min(values.length, types.length);
|
||||
if (values == null || types == null)
|
||||
return new ArrayList<Field<?>>();
|
||||
|
||||
int length = Math.min(values.length, types.length);
|
||||
List<Field<?>> result = new ArrayList<Field<?>>(length);
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
for (int i = 0; i < length; i++)
|
||||
result.add(field(values[i], types[i]));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static final <T> List<Field<T>> inline(T[] values) {
|
||||
int length = values == null ? 0 : values.length;
|
||||
List<Field<T>> result = new ArrayList<Field<T>>(length);
|
||||
if (values == null)
|
||||
return new ArrayList<Field<T>>();
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
List<Field<T>> result = new ArrayList<Field<T>>(values.length);
|
||||
|
||||
for (int i = 0; i < values.length; i++)
|
||||
result.add(DSL.inline(values[i]));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user