diff --git a/jOOQ/src/main/java/org/jooq/DSLContext.java b/jOOQ/src/main/java/org/jooq/DSLContext.java
index 16890f6b9a..e9b9792b30 100644
--- a/jOOQ/src/main/java/org/jooq/DSLContext.java
+++ b/jOOQ/src/main/java/org/jooq/DSLContext.java
@@ -857,11 +857,97 @@ public interface DSLContext {
* @return The results from the executed query. This may be
* null if the database returned no records
* @throws DataAccessException if something went wrong executing the query
- * @throws InvalidResultException if the query returned more than one record or a record with more than one value.
+ * @throws InvalidResultException if the query returned more than one record
+ * or a record with more than one value.
*/
@Support
Object fetchValue(String sql, QueryPart... parts) throws DataAccessException, InvalidResultException;
+ /**
+ * Execute a new query holding plain SQL.
+ *
+ * Example (Postgres): + *
+ * Example
+ * (SQLite):
+ *
+ * String sql = "FETCH ALL IN \"
+ *
+ *
+ * String sql = "pragma table_info('my_table')";
+ * NOTE: When inserting plain SQL into jOOQ objects, you must
+ * guarantee syntax integrity. You may also create the possibility of
+ * malicious SQL injection. Be sure to properly use bind variables and/or
+ * escape literals when concatenated into SQL clauses!
+ *
+ * @param sql The SQL
+ * @return The result values from the executed query. This is never
+ * null.
+ * @throws DataAccessException if something went wrong executing the query
+ */
+ @Support
+ List> fetchValues(String sql) throws DataAccessException;
+
+ /**
+ * Execute a new query holding plain SQL.
+ *
+ * There must be as many bind variables contained in the SQL, as passed in + * the bindings parameter + *
+ * Example (Postgres): + *
+ * Example
+ * (SQLite):
+ *
+ * String sql = "FETCH ALL IN \"
+ *
+ *
+ * String sql = "pragma table_info('my_table')";
+ * NOTE: When inserting plain SQL into jOOQ objects, you must
+ * guarantee syntax integrity. You may also create the possibility of
+ * malicious SQL injection. Be sure to properly use bind variables and/or
+ * escape literals when concatenated into SQL clauses!
+ *
+ * @param sql The SQL
+ * @param bindings The bindings
+ * @return The results from the executed query. This is never
+ * null.
+ * @throws DataAccessException if something went wrong executing the query
+ */
+ @Support
+ List> fetchValues(String sql, Object... bindings) throws DataAccessException;
+
+ /**
+ * Execute a new query holding plain SQL.
+ *
+ * Unlike {@link #fetchValue(String, Object...)}, the SQL passed to this
+ * method should not contain any bind variables. Instead, you can pass
+ * {@link QueryPart} objects to the method which will be rendered at indexed
+ * locations of your SQL string as such:
+ *
+ * // The following query
+ * fetchOne("select {0}, {1} from {2}", val(1), inline("test"), name("DUAL"));
+ *
+ * // Will execute this SQL on an Oracle database with RenderNameStyle.QUOTED:
+ * select ?, 'test' from "DUAL"
+ *
+ * NOTE: When inserting plain SQL into jOOQ objects, you must
+ * guarantee syntax integrity. You may also create the possibility of
+ * malicious SQL injection. Be sure to properly use bind variables and/or
+ * escape literals when concatenated into SQL clauses! One way to escape
+ * literals is to use {@link DSL#name(String...)} and similar methods
+ *
+ * @param sql The SQL clause, containing {numbered placeholders} where query
+ * parts can be injected
+ * @param parts The {@link QueryPart} objects that are rendered at the
+ * {numbered placeholder} locations
+ * @return The results from the executed query. This is never
+ * null.
+ * @throws DataAccessException if something went wrong executing the query
+ */
+ @Support
+ List> fetchValues(String sql, QueryPart... parts) throws DataAccessException;
+
/**
* Execute a query holding plain SQL.
*
@@ -1277,6 +1363,62 @@ public interface DSLContext {
@Support
+ * The additional
+ * The additional
+ * The additional
@@ -5555,6 +5697,16 @@ public interface DSLContext {
*/
field argument is used by jOOQ to coerce
+ * field names and data types to the desired output
+ *
+ * @param rs The JDBC ResultSet to fetch data from
+ * @param field The field to use in the desired output
+ * @return The resulting values
+ * @throws DataAccessException if something went wrong executing the query
+ */
+ @Support
+ type argument is used by jOOQ to coerce data
+ * types to the desired output
+ *
+ * @param rs The JDBC ResultSet to fetch data from
+ * @param type The data type to use in the desired output
+ * @return The resulting values
+ * @throws DataAccessException if something went wrong executing the query
+ */
+ @Support
+ type argument is used by jOOQ to coerce data
+ * types to the desired output
+ *
+ * @param rs The JDBC ResultSet to fetch data from
+ * @param type The data types to use in the desired output
+ * @return The resulting values
+ * @throws DataAccessException if something went wrong executing the query
+ */
+ @Support
+ DSLContext and return all values for the only column.
+ *
+ * @param query The query to execute
+ * @return The values.
+ * @throws DataAccessException if something went wrong executing the query
+ */
+ DSLContext and return
* a COUNT(*) value.
diff --git a/jOOQ/src/main/java/org/jooq/impl/DefaultDSLContext.java b/jOOQ/src/main/java/org/jooq/impl/DefaultDSLContext.java
index c3a70c14ed..e1f151ab04 100644
--- a/jOOQ/src/main/java/org/jooq/impl/DefaultDSLContext.java
+++ b/jOOQ/src/main/java/org/jooq/impl/DefaultDSLContext.java
@@ -545,6 +545,21 @@ public class DefaultDSLContext implements DSLContext, Serializable {
return fetchValue((ResultQuery) resultQuery(sql, parts));
}
+ @Override
+ public List> fetchValues(String sql) {
+ return fetchValues((ResultQuery) resultQuery(sql));
+ }
+
+ @Override
+ public List> fetchValues(String sql, Object... bindings) {
+ return fetchValues((ResultQuery) resultQuery(sql, bindings));
+ }
+
+ @Override
+ public List> fetchValues(String sql, QueryPart... parts) {
+ return fetchValues((ResultQuery) resultQuery(sql, parts));
+ }
+
@Override
public int execute(String sql) {
return query(sql).execute();
@@ -649,6 +664,26 @@ public class DefaultDSLContext implements DSLContext, Serializable {
return (T) value1((Record1) fetchOne(rs, type));
}
+ @Override
+ public List> fetchValues(ResultSet rs) {
+ return fetch(rs).getValues(0);
+ }
+
+ @Override
+ public