[#2784] Add DSL.row(Collection<?>) to allow for interacting with collections of values or Fields

This commit is contained in:
Lukas Eder 2013-10-17 13:43:41 +02:00
parent c23b615a76
commit fa7bc6942a

View File

@ -67,6 +67,7 @@ import java.sql.Date;
import java.sql.ResultSetMetaData;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@ -11803,6 +11804,23 @@ public class DSL {
return new RowImpl(values);
}
/**
* Create a row value expression of degree <code>N > 22</code>.
* <p>
* Note: Not all databases support row value expressions, but many row value
* expression operations can be simulated on all databases. See relevant row
* value expression method Javadocs for details.
*/
@Support
public static RowN row(Collection<?> values) {
Collection<Field<?>> fields = new ArrayList<Field<?>>();
for (Object o : values)
fields.add(o instanceof Field<?> ? (Field<?>) o : val(o));
return new RowImpl(fields);
}
// -------------------------------------------------------------------------
// [#915] TODO: These are experimental VALUES() table constructors
// -------------------------------------------------------------------------