All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jooq.Result Maven / Gradle / Ivy

There is a newer version: 0.10.0
Show newest version
/**
 * Copyright (c) 2009-2014, Data Geekery GmbH (http://www.datageekery.com)
 * All rights reserved.
 *
 * This work is dual-licensed
 * - under the Apache Software License 2.0 (the "ASL")
 * - under the jOOQ License and Maintenance Agreement (the "jOOQ License")
 * =============================================================================
 * You may choose which license applies to you:
 *
 * - If you're using this work with Open Source databases, you may choose
 *   either ASL or jOOQ License.
 * - If you're using this work with at least one commercial database, you must
 *   choose jOOQ License
 *
 * For more information, please visit http://www.jooq.org/licenses
 *
 * Apache Software License 2.0:
 * -----------------------------------------------------------------------------
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * jOOQ License and Maintenance Agreement:
 * -----------------------------------------------------------------------------
 * Data Geekery grants the Customer the non-exclusive, timely limited and
 * non-transferable license to install and use the Software under the terms of
 * the jOOQ License and Maintenance Agreement.
 *
 * This library is distributed with a LIMITED WARRANTY. See the jOOQ License
 * and Maintenance Agreement for more details: http://www.jooq.org/licensing
 */

package org.jooq;

import java.io.OutputStream;
import java.io.Writer;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.annotation.Generated;

import org.jooq.exception.DataTypeException;
import org.jooq.exception.IOException;
import org.jooq.exception.InvalidResultException;
import org.jooq.exception.MappingException;
import org.jooq.impl.DefaultRecordMapper;
import org.jooq.tools.Convert;

import org.w3c.dom.Document;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;

/**
 * A wrapper for database results returned by {@link SelectQuery}
 *
 * @param  The record type contained in this result
 * @author Lukas Eder
 * @see SelectQuery#getResult()
 */
public interface Result extends List, Attachable {

    /**
     * Get this result's record type.
     */
    RecordType recordType();

    /**
     * Get this result's fields as a {@link Row}.
     */
    Row fieldsRow();

    /**
     * Get a specific field from this Result.
     *
     * @see Row#field(Field)
     */
     Field field(Field field);

    /**
     * Get a specific field from this Result.
     *
     * @see Row#field(String)
     */
    Field field(String name);

    /**
     * Get a specific field from this Result.
     *
     * @see Row#field(int)
     */
    Field field(int index);

    /**
     * Get all fields from this Result.
     *
     * @see Row#fields()
     */
    Field[] fields();

    /**
     * Convenience method to fetch a value at a given position in the result.
     *
     * @param  The value's field's generic type parameter
     * @param index The record's index
     * @param field The value's field
     * @return The value
     * @throws IndexOutOfBoundsException if the index is out of range (
     *             index < 0 || index >= size())
     * @throws IllegalArgumentException If the argument field is not contained
     *             in {@link #fieldsRow()}
     */
     T getValue(int index, Field field) throws IndexOutOfBoundsException, IllegalArgumentException;

    /**
     * Convenience method to fetch a value at a given position in the result.
     *
     * @param  The value's field's generic type parameter
     * @param index The record's index
     * @param field The value's field
     * @param defaultValue The default value if the value was null
     * @return The value
     * @throws IndexOutOfBoundsException if the index is out of range (
     *             index < 0 || index >= size())
     * @throws IllegalArgumentException If the argument field is not contained
     *             in {@link #fieldsRow()}
     * @deprecated - 3.3.0 - [#2878] - This method will be removed in jOOQ 4.0
     */
    @Deprecated
     T getValue(int index, Field field, T defaultValue) throws IndexOutOfBoundsException,
        IllegalArgumentException;

    /**
     * Convenience method to fetch a value at a given position in the result.
     *
     * @param index The record's index
     * @param fieldIndex The value's field index
     * @return The value
     * @throws IndexOutOfBoundsException if the index is out of range (
     *             index < 0 || index >= size())
     * @throws IllegalArgumentException If the argument fieldIndex is not
     *             contained in {@link #fieldsRow()}
     */
    Object getValue(int index, int fieldIndex) throws IndexOutOfBoundsException, IllegalArgumentException;

    /**
     * Convenience method to fetch a value at a given position in the result.
     *
     * @param index The record's index
     * @param fieldIndex The value's field index
     * @param defaultValue The default value if the value was null
     * @return The value
     * @throws IndexOutOfBoundsException if the index is out of range (
     *             index < 0 || index >= size())
     * @throws IllegalArgumentException If the argument fieldIndex is not
     *             contained in {@link #fieldsRow()}
     * @deprecated - 3.3.0 - [#2878] - This method will be removed in jOOQ 4.0
     */
    @Deprecated
    Object getValue(int index, int fieldIndex, Object defaultValue) throws IndexOutOfBoundsException,
        IllegalArgumentException;

    /**
     * Convenience method to fetch a value at a given position in the result.
     *
     * @param index The record's index
     * @param fieldName The value's field name
     * @return The value
     * @throws IndexOutOfBoundsException if the index is out of range (
     *             index < 0 || index >= size())
     * @throws IllegalArgumentException If the argument fieldName is not
     *             contained in {@link #fieldsRow()}
     */
    Object getValue(int index, String fieldName) throws IndexOutOfBoundsException, IllegalArgumentException;

    /**
     * Convenience method to fetch a value at a given position in the result.
     *
     * @param index The record's index
     * @param fieldName The value's field name
     * @param defaultValue The default value if the value was null
     * @return The value
     * @throws IndexOutOfBoundsException if the index is out of range (
     *             index < 0 || index >= size())
     * @throws IllegalArgumentException If the argument fieldName is not
     *             contained in {@link #fieldsRow()}
     * @deprecated - 3.3.0 - [#2878] - This method will be removed in jOOQ 4.0
     */
    @Deprecated
    Object getValue(int index, String fieldName, Object defaultValue) throws IndexOutOfBoundsException,
        IllegalArgumentException;

    /**
     * Convenience method to fetch all values for a given field. This is
     * especially useful, when selecting only a single field.
     *
     * @param  The values' field's generic type parameter
     * @param field The values' field
     * @return The values
     * @throws IllegalArgumentException If the argument field is not contained
     *             in {@link #fieldsRow()}
     */
     List getValues(Field field) throws IllegalArgumentException;

    /**
     * Convenience method to fetch all values for a given field. This is
     * especially useful, when selecting only a single field.
     *
     * @param field The values' field
     * @param type The type used for type conversion
     * @return The values
     * @see Record#getValue(Field, Class)
     * @see Convert#convert(Object, Class)
     * @throws IllegalArgumentException If the argument field is not contained
     *             in {@link #fieldsRow()}
     */
     List getValues(Field field, Class type) throws IllegalArgumentException;

    /**
     * Convenience method to fetch all values for a given field. This is
     * especially useful, when selecting only a single field.
     *
     * @param field The values' field
     * @param converter The data type converter used for type conversion
     * @return The values
     * @see Record#getValue(Field, Converter)
     * @see Convert#convert(Object, Converter)
     * @throws IllegalArgumentException If the argument field is not contained
     *             in {@link #fieldsRow()}
     */
     List getValues(Field field, Converter converter) throws IllegalArgumentException;

    /**
     * Convenience method to fetch all values for a given field. This is
     * especially useful, when selecting only a single field.
     *
     * @param fieldIndex The values' field index
     * @return The values
     * @throws IllegalArgumentException If the argument fieldIndex is not
     *             contained in {@link #fieldsRow()}
     */
    List getValues(int fieldIndex) throws IllegalArgumentException;

    /**
     * Convenience method to fetch all values for a given field. This is
     * especially useful, when selecting only a single field.
     *
     * @param fieldIndex The values' field index
     * @param type The type used for type conversion
     * @return The values
     * @see Record#getValue(int, Class)
     * @see Convert#convert(Object, Class)
     * @throws IllegalArgumentException If the argument fieldIndex is not
     *             contained in {@link #fieldsRow()}
     * @throws DataTypeException wrapping any data type conversion exception
     *             that might have occurred
     */
     List getValues(int fieldIndex, Class type) throws IllegalArgumentException, DataTypeException;

    /**
     * Convenience method to fetch all values for a given field. This is
     * especially useful, when selecting only a single field.
     *
     * @param fieldIndex The values' field index
     * @param converter The data type converter used for type conversion
     * @return The values
     * @see Record#getValue(int, Converter)
     * @see Convert#convert(Object, Converter)
     * @throws IllegalArgumentException If the argument fieldIndex is not
     *             contained in {@link #fieldsRow()}
     * @throws DataTypeException wrapping any data type conversion exception
     *             that might have occurred
     */
     List getValues(int fieldIndex, Converter converter) throws IllegalArgumentException, DataTypeException;

    /**
     * Convenience method to fetch all values for a given field. This is
     * especially useful, when selecting only a single field.
     *
     * @param fieldName The values' field name
     * @return The values
     * @throws IllegalArgumentException If the argument fieldName is not
     *             contained in {@link #fieldsRow()}
     */
    List getValues(String fieldName) throws IllegalArgumentException;

    /**
     * Convenience method to fetch all values for a given field. This is
     * especially useful, when selecting only a single field.
     *
     * @param fieldName The values' field name
     * @param type The type used for type conversion
     * @return The values
     * @see Record#getValue(String, Class)
     * @see Convert#convert(Object, Class)
     * @throws IllegalArgumentException If the argument fieldName is not
     *             contained in {@link #fieldsRow()}
     * @throws DataTypeException wrapping any data type conversion exception
     *             that might have occurred
     */
     List getValues(String fieldName, Class type) throws IllegalArgumentException, DataTypeException;

    /**
     * Convenience method to fetch all values for a given field. This is
     * especially useful, when selecting only a single field.
     *
     * @param fieldName The values' field name
     * @param converter The data type converter used for type conversion
     * @return The values
     * @see Record#getValue(String, Converter)
     * @see Convert#convert(Object, Converter)
     * @throws IllegalArgumentException If the argument fieldName is not
     *             contained in {@link #fieldsRow()}
     * @throws DataTypeException wrapping any data type conversion exception
     *             that might have occurred
     */
     List getValues(String fieldName, Converter converter) throws IllegalArgumentException,
        DataTypeException;

    /**
     * Whether there are any records contained in this Result.
     */
    @Override
    boolean isEmpty();

    /**
     * Whether there are any records contained in this Result.
     */
    boolean isNotEmpty();

    /**
     * Get a simple formatted representation of this result.
     * 

* This is the same as calling {@link #format(int)} with * maxRows = 50 * * @return The formatted result */ String format(); /** * Get a simple formatted representation of this result. * * @param maxRecords The maximum number of records to include in the * formatted result * @return The formatted result */ String format(int maxRecords); /** * Get a simple formatted representation of this result as HTML. *

* The HTML code is formatted as follows:

     * <table>
     *   <thead>
     *     <tr>
     *       <th>field-1</th>
     *       <th>field-2</th>
     *       ...
     *       <th>field-n</th>
     *     </tr>
     *   </thead>
     *   <tbody>
     *     <tr>
     *       <th>value-1-1</th>
     *       <th>value-1-2</th>
     *       ...
     *       <th>value-1-n</th>
     *     </tr>
     *     <tr>
     *       <th>value-2-1</th>
     *       <th>value-2-2</th>
     *       ...
     *       <th>value-2-n</th>
     *     </tr>
     *     ...
     *   </tbody>
     * </table>
     * 
* * @return The formatted result */ String formatHTML(); /** * Get a simple formatted representation of this result as CSV. *

* This is the same as calling formatCSV(',', "") * * @return The formatted result */ String formatCSV(); /** * Get a simple formatted representation of this result as CSV. *

* This is the same as calling formatCSV(delimiter, "") * * @param delimiter The delimiter to use between records * @return The formatted result */ String formatCSV(char delimiter); /** * Get a simple formatted representation of this result as CSV. * * @param delimiter The delimiter to use between records * @param nullString A special string for encoding NULL values. * @return The formatted result */ String formatCSV(char delimiter, String nullString); /** * Get a simple formatted representation of this result as a JSON array of * array. *

* The format is the following:

     * {"fields":[{"name":"field-1","type":"type-1"},
     *            {"name":"field-2","type":"type-2"},
     *            ...,
     *            {"name":"field-n","type":"type-n"}],
     *  "records":[[value-1-1,value-1-2,...,value-1-n],
     *             [value-2-1,value-2-2,...,value-2-n]]}
     * 
* * @return The formatted result */ String formatJSON(); /** * Get this result formatted as XML. * * @see http://www.jooq.org/xsd/jooq-export-2.6.0.xsd */ String formatXML(); /** * Get this result as a set of INSERT statements. *

* This uses the the first record's {@link TableRecord#getTable()}, if the * first record is a {@link TableRecord}. Otherwise, this generates * INSERT statements into an "UNKNOWN_TABLE". In * both cases, the {@link Result#fields()} are used for column names. */ String formatInsert(); /** * Get this result as a set of INSERT statements. *

* This explicitly specifies the table (and optionally the fields) to insert * into. If the fields argument is left empty, the * {@link Result#fields()} are used, instead. */ String formatInsert(Table table, Field... fields); /** * Like {@link #format()}, but the data is output onto an {@link OutputStream}. * * @throws IOException - an unchecked wrapper for {@link java.io.IOException}, if anything goes wrong. */ void format(OutputStream stream) throws IOException; /** * Like {@link #format(int)}, but the data is output onto an {@link OutputStream}. * * @throws IOException - an unchecked wrapper for {@link java.io.IOException}, if anything goes wrong. */ void format(OutputStream stream, int maxRecords) throws IOException; /** * Like {@link #formatHTML()}, but the data is output onto an {@link OutputStream}. * * @throws IOException - an unchecked wrapper for {@link java.io.IOException}, if anything goes wrong. */ void formatHTML(OutputStream stream) throws IOException; /** * Like {@link #formatCSV()}, but the data is output onto an {@link OutputStream}. * * @throws IOException - an unchecked wrapper for {@link java.io.IOException}, if anything goes wrong. */ void formatCSV(OutputStream stream) throws IOException; /** * Like {@link #formatCSV(char)}, but the data is output onto an {@link OutputStream}. * * @throws IOException - an unchecked wrapper for {@link java.io.IOException}, if anything goes wrong. */ void formatCSV(OutputStream stream, char delimiter) throws IOException; /** * Like {@link #formatCSV(char, String)}, but the data is output onto an {@link OutputStream}. * * @throws IOException - an unchecked wrapper for {@link java.io.IOException}, if anything goes wrong. */ void formatCSV(OutputStream stream, char delimiter, String nullString) throws IOException; /** * Like {@link #formatJSON()}, but the data is output onto an {@link OutputStream}. * * @throws IOException - an unchecked wrapper for {@link java.io.IOException}, if anything goes wrong. */ void formatJSON(OutputStream stream) throws IOException; /** * Like {@link #formatXML()}, but the data is output onto an {@link OutputStream}. * * @throws IOException - an unchecked wrapper for {@link java.io.IOException}, if anything goes wrong. */ void formatXML(OutputStream stream) throws IOException; /** * Like {@link #formatInsert()}, but the data is output onto an {@link OutputStream}. * * @throws IOException - an unchecked wrapper for {@link java.io.IOException}, if anything goes wrong. */ void formatInsert(OutputStream stream) throws IOException; /** * Like {@link #formatInsert(Table, Field...)}, but the data is output onto an {@link OutputStream}. * * @throws IOException - an unchecked wrapper for {@link java.io.IOException}, if anything goes wrong. */ void formatInsert(OutputStream stream, Table table, Field... fields) throws IOException; /** * Like {@link #format()}, but the data is output onto a {@link Writer}. * * @throws IOException - an unchecked wrapper for {@link java.io.IOException}, if anything goes wrong. */ void format(Writer writer) throws IOException; /** * Like {@link #format(int)}, but the data is output onto a {@link Writer}. * * @throws IOException - an unchecked wrapper for {@link java.io.IOException}, if anything goes wrong. */ void format(Writer writer, int maxRecords) throws IOException; /** * Like {@link #formatHTML()}, but the data is output onto a {@link Writer}. * * @throws IOException - an unchecked wrapper for {@link java.io.IOException}, if anything goes wrong. */ void formatHTML(Writer writer) throws IOException; /** * Like {@link #formatCSV()}, but the data is output onto a {@link Writer}. * * @throws IOException - an unchecked wrapper for {@link java.io.IOException}, if anything goes wrong. */ void formatCSV(Writer writer) throws IOException; /** * Like {@link #formatCSV(char)}, but the data is output onto a {@link Writer}. * * @throws IOException - an unchecked wrapper for {@link java.io.IOException}, if anything goes wrong. */ void formatCSV(Writer writer, char delimiter) throws IOException; /** * Like {@link #formatCSV(char, String)}, but the data is output onto a {@link Writer}. * * @throws IOException - an unchecked wrapper for {@link java.io.IOException}, if anything goes wrong. */ void formatCSV(Writer writer, char delimiter, String nullString) throws IOException; /** * Like {@link #formatJSON()}, but the data is output onto a {@link Writer}. * * @throws IOException - an unchecked wrapper for {@link java.io.IOException}, if anything goes wrong. */ void formatJSON(Writer writer) throws IOException; /** * Like {@link #formatXML()}, but the data is output onto a {@link Writer}. * * @throws IOException - an unchecked wrapper for {@link java.io.IOException}, if anything goes wrong. */ void formatXML(Writer writer) throws IOException; /** * Like {@link #formatInsert()}, but the data is output onto a {@link Writer}. * * @throws IOException - an unchecked wrapper for {@link java.io.IOException}, if anything goes wrong. */ void formatInsert(Writer writer) throws IOException; /** * Like {@link #formatInsert(Table, Field...)}, but the data is output onto an {@link Writer}. * * @throws IOException - an unchecked wrapper for {@link java.io.IOException}, if anything goes wrong. */ void formatInsert(Writer writer, Table table, Field... fields) throws IOException; /** * Get this result as XML. * * @see #formatXML() * @see http://www.jooq.org/xsd/jooq-export-2.6.0.xsd */ Document intoXML(); /** * Get this result as XML using a SAX ContentHandler. * * @param handler The custom content handler. * @return The argument content handler is returned for convenience. * @see #formatXML() * @see http://www.jooq.org/xsd/jooq-export-2.6.0.xsd */ H intoXML(H handler) throws SAXException; /** * Return the generated result as a list of name/value maps. * * @return The result. * @see Record#intoMap() */ List> intoMaps(); /** * Return a {@link Map} with one of the result's columns as key and the * corresponding records as value. *

* An {@link InvalidResultException} is thrown, if the key turns out to be * non-unique in the result set. Use {@link #intoGroups(Field)} instead, if * your keys are non-unique * * @param The key's generic field type * @param key The key field. Client code must assure that this field is * unique in the result set. * @return A Map containing the results * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} * @throws InvalidResultException if the key field returned two or more * equal values from the result set. */ Map intoMap(Field key) throws IllegalArgumentException, InvalidResultException; /** * Return a {@link Map} with one of the result's columns as key and another * one of the result's columns as value *

* An {@link InvalidResultException} is thrown, if the key turns out to be * non-unique in the result set. Use {@link #intoGroups(Field, Field)} * instead, if your keys are non-unique * * @param The key's generic field type * @param The value's generic field type * @param key The key field. Client code must assure that this field is * unique in the result set. * @param value The value field * @return A Map containing the results * @throws IllegalArgumentException If any of the argument fields is not * contained in {@link #fieldsRow()} * @throws InvalidResultException if the key field returned two or more * equal values from the result set. */ Map intoMap(Field key, Field value) throws IllegalArgumentException, InvalidResultException; /** * Return a {@link Map} with results grouped by the given key and mapped * into the given entity type. *

* An {@link InvalidResultException} is thrown, if the key is non-unique in * the result set. Use {@link #intoGroups(Field, Class)} instead, if your * key is non-unique. * * @param key The key. Client code must assure that key is unique in the * result set. * @param type The entity type. * @return A Map containing the result. * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} * @throws InvalidResultException if the key is non-unique in the result * set. * @throws MappingException wrapping any reflection or data type conversion * exception that might have occurred while mapping records * @see DefaultRecordMapper */ Map intoMap(Field key, Class type) throws IllegalArgumentException, InvalidResultException, MappingException; /** * Return a {@link Map} with results grouped by the given key and mapped by * the given mapper. *

* An {@link InvalidResultException} is thrown, if the key is non-unique in * the result set. Use {@link #intoGroups(Field, Class)} instead, if your * key is non-unique. * * @param key The key. Client code must assure that key is unique in the * result set. * @param mapper The mapper callback. * @return A Map containing the result. * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} * @throws InvalidResultException if the key is non-unique in the result * set. * @throws MappingException wrapping any reflection or data type conversion * exception that might have occurred while mapping records * @see DefaultRecordMapper */ Map intoMap(Field key, RecordMapper mapper) throws IllegalArgumentException, InvalidResultException, MappingException; /** * Return a {@link Map} with the given keys as a map key and the * corresponding record as value. *

* An {@link InvalidResultException} is thrown, if the keys are non-unique * in the result set. Use {@link #intoGroups(Field[])} instead, if your keys * are non-unique. * * @param keys The keys. Client code must assure that keys are unique in the * result set. If this is null or an empty array, * the resulting map will contain at most one entry. * @return A Map containing the results. * @throws IllegalArgumentException If any of the argument fields is not * contained in {@link #fieldsRow()} * @throws InvalidResultException if the keys are non-unique in the result * set. */ Map intoMap(Field[] keys) throws IllegalArgumentException, InvalidResultException; /** * Return a {@link Map} with results grouped by the given keys and mapped * into the given entity type. *

* An {@link InvalidResultException} is thrown, if the keys are non-unique * in the result set. Use {@link #intoGroups(Field[], Class)} instead, if * your keys are non-unique. * * @param keys The keys. Client code must assure that keys are unique in the * result set. If this is null or an empty array, * the resulting map will contain at most one entry. * @param type The entity type. * @return A Map containing the results. * @throws IllegalArgumentException If any of the argument fields is not * contained in {@link #fieldsRow()} * @throws InvalidResultException if the keys are non-unique in the result * set. * @throws MappingException wrapping any reflection or data type conversion * exception that might have occurred while mapping records * @see DefaultRecordMapper */ Map, E> intoMap(Field[] keys, Class type) throws IllegalArgumentException, InvalidResultException, MappingException; /** * Return a {@link Map} with results grouped by the given keys and mapped by * the given mapper. *

* An {@link InvalidResultException} is thrown, if the keys are non-unique * in the result set. Use {@link #intoGroups(Field[], Class)} instead, if * your keys are non-unique. * * @param keys The keys. Client code must assure that keys are unique in the * result set. If this is null or an empty array, * the resulting map will contain at most one entry. * @param mapper The mapper callback. * @return A Map containing the results. * @throws IllegalArgumentException If any of the argument fields is not * contained in {@link #fieldsRow()} * @throws InvalidResultException if the keys are non-unique in the result * set. * @throws MappingException wrapping any reflection or data type conversion * exception that might have occurred while mapping records * @see DefaultRecordMapper */ Map, E> intoMap(Field[] keys, RecordMapper mapper) throws IllegalArgumentException, InvalidResultException, MappingException; /** * Return a {@link Map} with the given key table as a map key and the * corresponding record as value. *

* An {@link InvalidResultException} is thrown, if the keys are non-unique * in the result set. Use {@link #intoGroups(Table)} instead, if your keys * are non-unique. * * @param table The key table. Client code must assure that keys are unique * in the result set. May not be null. * @return A Map containing the results. * @throws IllegalArgumentException If any of the argument fields is not * contained in {@link #fieldsRow()} * @throws InvalidResultException if the keys are non-unique in the result * set. */ Map intoMap(Table table) throws IllegalArgumentException, InvalidResultException; /** * Return a {@link Map} with results grouped by the given key table and * mapped into the given entity type. *

* An {@link InvalidResultException} is thrown, if the keys are non-unique * in the result set. Use {@link #intoGroups(Table, Class)} instead, if your * keys are non-unique. * * @param table The key table. Client code must assure that keys are unique * in the result set. May not be null. * @param type The entity type. * @return A Map containing the results. * @throws IllegalArgumentException If any of the argument fields is not * contained in {@link #fieldsRow()} * @throws InvalidResultException if the keys are non-unique in the result * set. * @throws MappingException wrapping any reflection or data type conversion * exception that might have occurred while mapping records * @see DefaultRecordMapper */ Map intoMap(Table table, Class type) throws IllegalArgumentException, InvalidResultException, MappingException; /** * Return a {@link Map} with results grouped by the given key table and * mapped by the given mapper. *

* An {@link InvalidResultException} is thrown, if the keys are non-unique * in the result set. Use {@link #intoGroups(Table, Class)} instead, if your * keys are non-unique. * * @param table The key table. Client code must assure that keys are unique * in the result set. May not be null. * @param mapper The mapper callback. * @return A Map containing the results. * @throws IllegalArgumentException If any of the argument fields is not * contained in {@link #fieldsRow()} * @throws InvalidResultException if the keys are non-unique in the result * set. * @throws MappingException wrapping any reflection or data type conversion * exception that might have occurred while mapping records * @see DefaultRecordMapper */ Map intoMap(Table table, RecordMapper mapper) throws IllegalArgumentException, InvalidResultException, MappingException; /** * Return a {@link Map} with one of the result's columns as key and a list * of corresponding records as value. *

* Unlike {@link #intoMap(Field)}, this method allows for non-unique keys in * the result set. * * @param The key's generic field type * @param key The key field. * @return A Map containing the results * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} */ Map> intoGroups(Field key) throws IllegalArgumentException; /** * Return a {@link Map} with one of the result's columns as key and another * one of the result's columns as value. *

* Unlike {@link #intoMap(Field, Field)}, this method allows for non-unique * keys in the result set. * * @param The key's generic field type * @param The value's generic field type * @param key The key field. * @param value The value field * @return A Map containing the results * @throws IllegalArgumentException If any of the argument fields is not * contained in {@link #fieldsRow()} */ Map> intoGroups(Field key, Field value) throws IllegalArgumentException; /** * Return a {@link Map} with results grouped by the given key and mapped * into the given entity type. *

* * @param The key's generic field type * @param The generic entity type. * @param key The key field. * @param type The entity type. * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} * @throws MappingException wrapping any reflection or data type conversion * exception that might have occurred while mapping records * @see DefaultRecordMapper */ Map> intoGroups(Field key, Class type) throws IllegalArgumentException, MappingException; /** * Return a {@link Map} with results grouped by the given key and mapped by * the given mapper. * * @param The key's generic field type * @param The generic entity type. * @param key The key field. * @param mapper The mapper callback. * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} * @throws MappingException wrapping any reflection or data type conversion * exception that might have occurred while mapping records */ Map> intoGroups(Field key, RecordMapper mapper) throws IllegalArgumentException, MappingException; /** * Return a {@link Map} with the result grouped by the given keys. *

* Unlike {@link #intoMap(Field[])}, this method allows for non-unique keys * in the result set. * * @param keys The keys. If this is null or an empty array, the * resulting map will contain at most one entry. * @return A Map containing grouped results * @throws IllegalArgumentException If any of the argument fields is not * contained in {@link #fieldsRow()} */ Map> intoGroups(Field[] keys) throws IllegalArgumentException; /** * Return a {@link Map} with results grouped by the given keys and mapped * into the given entity type. *

* Unlike {@link #intoMap(Field[], Class)}, this method allows for * non-unique keys in the result set. * * @param keys The keys. If this is null or an empty array, the * resulting map will contain at most one entry. * @param type The entity type. * @return A Map containing grouped results * @throws IllegalArgumentException If the any of the argument fields is not * contained in {@link #fieldsRow()} * @throws MappingException wrapping any reflection or data type conversion * exception that might have occurred while mapping records * @see DefaultRecordMapper */ Map> intoGroups(Field[] keys, Class type) throws IllegalArgumentException, MappingException; /** * Return a {@link Map} with results grouped by the given keys and mapped * into the given entity type. *

* Unlike {@link #intoMap(Field[], RecordMapper)}, this method allows for * non-unique keys in the result set. * * @param keys The keys. If this is null or an empty array, the * resulting map will contain at most one entry. * @param mapper The mapper callback. * @return A Map containing grouped results * @throws IllegalArgumentException If the any of the argument fields is not * contained in {@link #fieldsRow()} * @throws MappingException wrapping any reflection or data type conversion * exception that might have occurred while mapping records * @see DefaultRecordMapper */ Map> intoGroups(Field[] keys, RecordMapper mapper) throws IllegalArgumentException, MappingException; /** * Return a {@link Map} with the result grouped by the given key table. *

* Unlike {@link #intoMap(Table)}, this method allows for non-unique keys in * the result set. * * @param table The key table. May not be null. * @return A Map containing grouped results * @throws IllegalArgumentException If any of the argument fields is not * contained in {@link #fieldsRow()} */ Map> intoGroups(Table table) throws IllegalArgumentException; /** * Return a {@link Map} with results grouped by the given key table and * mapped into the given entity type. *

* Unlike {@link #intoMap(Table, Class)}, this method allows for non-unique * keys in the result set. * * @param table The key table. May not be null. * @param type The entity type. * @return A Map containing grouped results * @throws IllegalArgumentException If the any of the argument fields is not * contained in {@link #fieldsRow()} * @throws MappingException wrapping any reflection or data type conversion * exception that might have occurred while mapping records * @see DefaultRecordMapper */ Map> intoGroups(Table table, Class type) throws IllegalArgumentException, MappingException; /** * Return a {@link Map} with results grouped by the given key table and * mapped into the given entity type. *

* Unlike {@link #intoMap(Table, RecordMapper)}, this method allows for * non-unique keys in the result set. * * @param table The key table. May not be null. * @param mapper The mapper callback. * @return A Map containing grouped results * @throws IllegalArgumentException If the any of the argument fields is not * contained in {@link #fieldsRow()} * @throws MappingException wrapping any reflection or data type conversion * exception that might have occurred while mapping records * @see DefaultRecordMapper */ Map> intoGroups(Table table, RecordMapper mapper) throws IllegalArgumentException, MappingException; /** * Convert this result into an array of arrays. *

* The resulting array has the same number of first-dimension elements as * this result has records. It has the same number of second-dimension * elements as this result's records have fields. The resulting array * contains data as such: *

*

     * // For arbitrary values of i, j
     * result.getValue(i, j) == result.intoArray()[i][j]
     * 
*

* This is the same as calling into(Object[].class) * * @return This result as an array of arrays * @see Record#intoArray() */ Object[][] intoArray(); /** * Return all values for a field index from the result. *

* You can access data like this *

result.intoArray(fieldIndex)[recordIndex]
* * @return The resulting values. This may be an array type more concrete * than Object[], depending on whether jOOQ has any * knowledge about fieldIndex's actual type. * @see #getValues(int) * @throws IllegalArgumentException If the argument fieldIndex is not * contained in {@link #fieldsRow()} */ Object[] intoArray(int fieldIndex) throws IllegalArgumentException; /** * Return all values for a field index from the result. *

* You can access data like this *

result.intoArray(fieldIndex)[recordIndex]
* * @return The resulting values. * @see #getValues(int, Class) * @throws IllegalArgumentException If the argument fieldIndex is not * contained in {@link #fieldsRow()} * @throws DataTypeException wrapping any data type conversion exception * that might have occurred */ T[] intoArray(int fieldIndex, Class type) throws IllegalArgumentException, DataTypeException; /** * Return all values for a field index from the result. *

* You can access data like this *

result.intoArray(fieldIndex)[recordIndex]
* * @return The resulting values. * @see #getValues(int, Converter) * @throws IllegalArgumentException If the argument fieldIndex is not * contained in {@link #fieldsRow()} * @throws DataTypeException wrapping any data type conversion exception * that might have occurred */ U[] intoArray(int fieldIndex, Converter converter) throws IllegalArgumentException, DataTypeException; /** * Return all values for a field name from the result. *

* You can access data like this *

result.intoArray(fieldName)[recordIndex]
* * @return The resulting values. This may be an array type more concrete * than Object[], depending on whether jOOQ has any * knowledge about fieldName's actual type. * @see #getValues(String) * @throws IllegalArgumentException If the argument fieldName is not * contained in {@link #fieldsRow()} */ Object[] intoArray(String fieldName) throws IllegalArgumentException; /** * Return all values for a field name from the result. *

* You can access data like this *

result.intoArray(fieldName)[recordIndex]
* * @return The resulting values. * @see #getValues(String, Class) * @throws IllegalArgumentException If the argument fieldName is not * contained in {@link #fieldsRow()} * @throws DataTypeException wrapping any data type conversion exception * that might have occurred */ T[] intoArray(String fieldName, Class type) throws IllegalArgumentException, DataTypeException; /** * Return all values for a field name from the result. *

* You can access data like this *

result.intoArray(fieldName)[recordIndex]
* * @return The resulting values. * @see #getValues(String, Converter) * @throws IllegalArgumentException If the argument fieldName is not * contained in {@link #fieldsRow()} * @throws DataTypeException wrapping any data type conversion exception * that might have occurred */ U[] intoArray(String fieldName, Converter converter) throws IllegalArgumentException, DataTypeException; /** * Return all values for a field from the result. *

* You can access data like this *

result.intoArray(field)[recordIndex]
* * @return The resulting values. * @see #getValues(Field) * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} */ T[] intoArray(Field field) throws IllegalArgumentException; /** * Return all values for a field from the result. *

* You can access data like this *

result.intoArray(field)[recordIndex]
* * @return The resulting values. * @see #getValues(Field, Class) * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} * @throws DataTypeException wrapping any data type conversion exception * that might have occurred */ T[] intoArray(Field field, Class type) throws IllegalArgumentException, DataTypeException; /** * Return all values for a field from the result. *

* You can access data like this *

result.intoArray(field)[recordIndex]
* * @return The resulting values. * @see #getValues(Field, Converter) * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} * @throws DataTypeException wrapping any data type conversion exception * that might have occurred */ U[] intoArray(Field field, Converter converter) throws IllegalArgumentException, DataTypeException; /** * Return all values for a field index from the result. * * @return The resulting values. This may be an array type more concrete * than Object[], depending on whether jOOQ has any * knowledge about fieldIndex's actual type. * @see #getValues(int) * @throws IllegalArgumentException If the argument fieldIndex is not * contained in {@link #fieldsRow()} */ Set intoSet(int fieldIndex) throws IllegalArgumentException; /** * Return all values for a field index from the result. * * @return The resulting values. * @see #getValues(int, Class) * @throws IllegalArgumentException If the argument fieldIndex is not * contained in {@link #fieldsRow()} * @throws DataTypeException wrapping any data type conversion exception * that might have occurred */ Set intoSet(int fieldIndex, Class type) throws IllegalArgumentException, DataTypeException; /** * Return all values for a field index from the result. * * @return The resulting values. * @see #getValues(int, Converter) * @throws IllegalArgumentException If the argument fieldIndex is not * contained in {@link #fieldsRow()} * @throws DataTypeException wrapping any data type conversion exception * that might have occurred */ Set intoSet(int fieldIndex, Converter converter) throws IllegalArgumentException, DataTypeException; /** * Return all values for a field name from the result. * * @return The resulting values. This may be an array type more concrete * than Object[], depending on whether jOOQ has any * knowledge about fieldName's actual type. * @see #getValues(String) * @throws IllegalArgumentException If the argument fieldName is not * contained in {@link #fieldsRow()} */ Set intoSet(String fieldName) throws IllegalArgumentException; /** * Return all values for a field name from the result. * * @return The resulting values. * @see #getValues(String, Class) * @throws IllegalArgumentException If the argument fieldName is not * contained in {@link #fieldsRow()} * @throws DataTypeException wrapping any data type conversion exception * that might have occurred */ Set intoSet(String fieldName, Class type) throws IllegalArgumentException, DataTypeException; /** * Return all values for a field name from the result. * * @return The resulting values. * @see #getValues(String, Converter) * @throws IllegalArgumentException If the argument fieldName is not * contained in {@link #fieldsRow()} * @throws DataTypeException wrapping any data type conversion exception * that might have occurred */ Set intoSet(String fieldName, Converter converter) throws IllegalArgumentException, DataTypeException; /** * Return all values for a field from the result. * * @return The resulting values. * @see #getValues(Field) * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} */ Set intoSet(Field field) throws IllegalArgumentException; /** * Return all values for a field from the result. * * @return The resulting values. * @see #getValues(Field, Class) * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} * @throws DataTypeException wrapping any data type conversion exception * that might have occurred */ Set intoSet(Field field, Class type) throws IllegalArgumentException, DataTypeException; /** * Return all values for a field from the result. * * @return The resulting values. * @see #getValues(Field, Converter) * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} * @throws DataTypeException wrapping any data type conversion exception * that might have occurred */ Set intoSet(Field field, Converter converter) throws IllegalArgumentException, DataTypeException; /** * Copy all records from this result into a new result with new records * holding only a subset of the previous fields. * * @param fields The fields of the new records * @return The new result */ Result into(Field... fields); // [jooq-tools] START [into-fields] /**//** * Copy all records from this result into a new result with new records * holding only a subset of the previous fields. * * @param fields The fields of the new records * @return The new result */ @Generated("This class was generated using jOOQ-tools") Result> into(Field field1); /**//** * Copy all records from this result into a new result with new records * holding only a subset of the previous fields. * * @param fields The fields of the new records * @return The new result */ @Generated("This class was generated using jOOQ-tools") Result> into(Field field1, Field field2); /**//** * Copy all records from this result into a new result with new records * holding only a subset of the previous fields. * * @param fields The fields of the new records * @return The new result */ @Generated("This class was generated using jOOQ-tools") Result> into(Field field1, Field field2, Field field3); /**//** * Copy all records from this result into a new result with new records * holding only a subset of the previous fields. * * @param fields The fields of the new records * @return The new result */ @Generated("This class was generated using jOOQ-tools") Result> into(Field field1, Field field2, Field field3, Field field4); /**//** * Copy all records from this result into a new result with new records * holding only a subset of the previous fields. * * @param fields The fields of the new records * @return The new result */ @Generated("This class was generated using jOOQ-tools") Result> into(Field field1, Field field2, Field field3, Field field4, Field field5); /**//** * Copy all records from this result into a new result with new records * holding only a subset of the previous fields. * * @param fields The fields of the new records * @return The new result */ @Generated("This class was generated using jOOQ-tools") Result> into(Field field1, Field field2, Field field3, Field field4, Field field5, Field field6); /**//** * Copy all records from this result into a new result with new records * holding only a subset of the previous fields. * * @param fields The fields of the new records * @return The new result */ @Generated("This class was generated using jOOQ-tools") Result> into(Field field1, Field field2, Field field3, Field field4, Field field5, Field field6, Field field7); /**//** * Copy all records from this result into a new result with new records * holding only a subset of the previous fields. * * @param fields The fields of the new records * @return The new result */ @Generated("This class was generated using jOOQ-tools") Result> into(Field field1, Field field2, Field field3, Field field4, Field field5, Field field6, Field field7, Field field8); /**//** * Copy all records from this result into a new result with new records * holding only a subset of the previous fields. * * @param fields The fields of the new records * @return The new result */ @Generated("This class was generated using jOOQ-tools") Result> into(Field field1, Field field2, Field field3, Field field4, Field field5, Field field6, Field field7, Field field8, Field field9); /**//** * Copy all records from this result into a new result with new records * holding only a subset of the previous fields. * * @param fields The fields of the new records * @return The new result */ @Generated("This class was generated using jOOQ-tools") Result> into(Field field1, Field field2, Field field3, Field field4, Field field5, Field field6, Field field7, Field field8, Field field9, Field field10); /**//** * Copy all records from this result into a new result with new records * holding only a subset of the previous fields. * * @param fields The fields of the new records * @return The new result */ @Generated("This class was generated using jOOQ-tools") Result> into(Field field1, Field field2, Field field3, Field field4, Field field5, Field field6, Field field7, Field field8, Field field9, Field field10, Field field11); /**//** * Copy all records from this result into a new result with new records * holding only a subset of the previous fields. * * @param fields The fields of the new records * @return The new result */ @Generated("This class was generated using jOOQ-tools") Result> into(Field field1, Field field2, Field field3, Field field4, Field field5, Field field6, Field field7, Field field8, Field field9, Field field10, Field field11, Field field12); /**//** * Copy all records from this result into a new result with new records * holding only a subset of the previous fields. * * @param fields The fields of the new records * @return The new result */ @Generated("This class was generated using jOOQ-tools") Result> into(Field field1, Field field2, Field field3, Field field4, Field field5, Field field6, Field field7, Field field8, Field field9, Field field10, Field field11, Field field12, Field field13); /**//** * Copy all records from this result into a new result with new records * holding only a subset of the previous fields. * * @param fields The fields of the new records * @return The new result */ @Generated("This class was generated using jOOQ-tools") Result> into(Field field1, Field field2, Field field3, Field field4, Field field5, Field field6, Field field7, Field field8, Field field9, Field field10, Field field11, Field field12, Field field13, Field field14); /**//** * Copy all records from this result into a new result with new records * holding only a subset of the previous fields. * * @param fields The fields of the new records * @return The new result */ @Generated("This class was generated using jOOQ-tools") Result> into(Field field1, Field field2, Field field3, Field field4, Field field5, Field field6, Field field7, Field field8, Field field9, Field field10, Field field11, Field field12, Field field13, Field field14, Field field15); /**//** * Copy all records from this result into a new result with new records * holding only a subset of the previous fields. * * @param fields The fields of the new records * @return The new result */ @Generated("This class was generated using jOOQ-tools") Result> into(Field field1, Field field2, Field field3, Field field4, Field field5, Field field6, Field field7, Field field8, Field field9, Field field10, Field field11, Field field12, Field field13, Field field14, Field field15, Field field16); /**//** * Copy all records from this result into a new result with new records * holding only a subset of the previous fields. * * @param fields The fields of the new records * @return The new result */ @Generated("This class was generated using jOOQ-tools") Result> into(Field field1, Field field2, Field field3, Field field4, Field field5, Field field6, Field field7, Field field8, Field field9, Field field10, Field field11, Field field12, Field field13, Field field14, Field field15, Field field16, Field field17); /**//** * Copy all records from this result into a new result with new records * holding only a subset of the previous fields. * * @param fields The fields of the new records * @return The new result */ @Generated("This class was generated using jOOQ-tools") Result> into(Field field1, Field field2, Field field3, Field field4, Field field5, Field field6, Field field7, Field field8, Field field9, Field field10, Field field11, Field field12, Field field13, Field field14, Field field15, Field field16, Field field17, Field field18); /**//** * Copy all records from this result into a new result with new records * holding only a subset of the previous fields. * * @param fields The fields of the new records * @return The new result */ @Generated("This class was generated using jOOQ-tools") Result> into(Field field1, Field field2, Field field3, Field field4, Field field5, Field field6, Field field7, Field field8, Field field9, Field field10, Field field11, Field field12, Field field13, Field field14, Field field15, Field field16, Field field17, Field field18, Field field19); /**//** * Copy all records from this result into a new result with new records * holding only a subset of the previous fields. * * @param fields The fields of the new records * @return The new result */ @Generated("This class was generated using jOOQ-tools") Result> into(Field field1, Field field2, Field field3, Field field4, Field field5, Field field6, Field field7, Field field8, Field field9, Field field10, Field field11, Field field12, Field field13, Field field14, Field field15, Field field16, Field field17, Field field18, Field field19, Field field20); /**//** * Copy all records from this result into a new result with new records * holding only a subset of the previous fields. * * @param fields The fields of the new records * @return The new result */ @Generated("This class was generated using jOOQ-tools") Result> into(Field field1, Field field2, Field field3, Field field4, Field field5, Field field6, Field field7, Field field8, Field field9, Field field10, Field field11, Field field12, Field field13, Field field14, Field field15, Field field16, Field field17, Field field18, Field field19, Field field20, Field field21); /**//** * Copy all records from this result into a new result with new records * holding only a subset of the previous fields. * * @param fields The fields of the new records * @return The new result */ @Generated("This class was generated using jOOQ-tools") Result> into(Field field1, Field field2, Field field3, Field field4, Field field5, Field field6, Field field7, Field field8, Field field9, Field field10, Field field11, Field field12, Field field13, Field field14, Field field15, Field field16, Field field17, Field field18, Field field19, Field field20, Field field21, Field field22); // [jooq-tools] END [into-fields] /** * Map resulting records onto a custom type. *

* This is the same as calling record.into(type) on every * record contained in this Result. See * {@link Record#into(Class)} for more details * * @param The generic entity type. * @param type The entity type. * @throws MappingException wrapping any reflection or data type conversion * exception that might have occurred while mapping records * @see Record#into(Class) * @see DefaultRecordMapper */ List into(Class type) throws MappingException; /** * Map resulting records onto a custom record. *

* This is the same as calling record.into(table) on every * record contained in this Result. See * {@link Record#into(Table)} for more details * * @param The generic table record type. * @param table The table type. * @throws MappingException wrapping any reflection or data type conversion * exception that might have occurred while mapping records * @see Record#into(Table) */ Result into(Table table) throws MappingException; /** * Map results into a custom handler callback. * * @param handler The handler callback * @return Convenience result, returning the parameter handler itself */ > H into(H handler); /** * Generate an in-memory JDBC {@link ResultSet} containing the data of this * Result. *

* Use this as an adapter for JDBC-compliant code that expects a * {@link ResultSet} to operate on, rather than a jOOQ {@link Result}. The * returned ResultSet allows for the following behaviour * according to the JDBC specification: *

    *
  • {@link ResultSet#CLOSE_CURSORS_AT_COMMIT}: The cursors (i.e. * {@link Statement} object) are no longer available
  • *
  • {@link ResultSet#CONCUR_READ_ONLY}: You cannot update the database * through this ResultSet, as the underlying {@link Result} * object does not hold any open database refences anymore
  • *
  • {@link ResultSet#FETCH_FORWARD}: The fetch direction is forward only, * and cannot be changed
  • *
  • {@link ResultSet#TYPE_SCROLL_INSENSITIVE}: You can use any of the * ResultSet's scrolling methods, e.g. {@link ResultSet#next()} * or {@link ResultSet#previous()}, etc.
  • *
*

* You may use {@link DSLContext#fetch(ResultSet)} to unwind this wrapper * again. * * @return A wrapper JDBC ResultSet */ ResultSet intoResultSet(); /** * Map results into a custom mapper callback. * * @param mapper The mapper callback * @return The custom mapped records */ List map(RecordMapper mapper); /** * Sort this result by one of its contained fields. *

* nulls are sorted last by this method. * * @param field The sort field * @return The result itself * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} */ > Result sortAsc(Field field) throws IllegalArgumentException; /** * Reverse-sort this result by one of its contained fields. *

* nulls are sorted last by this method. * * @param field The sort field * @return The result itself * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} */ > Result sortDesc(Field field) throws IllegalArgumentException; /** * Sort this result by one of its contained fields. *

* nulls are sorted last by this method. * * @param fieldIndex The sort field index * @return The result itself * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} */ Result sortAsc(int fieldIndex) throws IllegalArgumentException; /** * Reverse-sort this result by one of its contained fields. *

* nulls are sorted last by this method. * * @param fieldIndex The sort field index * @return The result itself * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} */ Result sortDesc(int fieldIndex) throws IllegalArgumentException; /** * Sort this result by one of its contained fields. *

* nulls are sorted last by this method. * * @param fieldName The sort field name * @return The result itself * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} */ Result sortAsc(String fieldName) throws IllegalArgumentException; /** * Reverse-sort this result by one of its contained fields. *

* nulls are sorted last by this method. * * @param fieldName The sort field name * @return The result itself * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} */ Result sortDesc(String fieldName) throws IllegalArgumentException; /** * Sort this result by one of its contained fields using a comparator. *

* null sorting must be handled by the supplied * comparator. * * @param field The sort field * @param comparator The comparator used to sort this result. * @return The result itself * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} */ Result sortAsc(Field field, java.util.Comparator comparator) throws IllegalArgumentException; /** * Reverse-sort this result by one of its contained fields using a * comparator. *

* null sorting must be handled by the supplied * comparator. * * @param field The sort field * @param comparator The comparator used to sort this result. * @return The result itself * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} */ Result sortDesc(Field field, java.util.Comparator comparator) throws IllegalArgumentException; /** * Sort this result by one of its contained fields using a comparator. *

* null sorting must be handled by the supplied * comparator. * * @param fieldIndex The sort field index * @param comparator The comparator used to sort this result. * @return The result itself * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} */ Result sortAsc(int fieldIndex, java.util.Comparator comparator) throws IllegalArgumentException; /** * Reverse-sort this result by one of its contained fields using a * comparator. *

* null sorting must be handled by the supplied * comparator. * * @param fieldIndex The sort field index * @param comparator The comparator used to sort this result. * @return The result itself * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} */ Result sortDesc(int fieldIndex, java.util.Comparator comparator) throws IllegalArgumentException; /** * Sort this result by one of its contained fields using a comparator. *

* null sorting must be handled by the supplied * comparator. * * @param fieldName The sort field name * @param comparator The comparator used to sort this result. * @return The result itself * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} */ Result sortAsc(String fieldName, java.util.Comparator comparator) throws IllegalArgumentException; /** * Reverse-sort this result by one of its contained fields using a * comparator. *

* null sorting must be handled by the supplied * comparator. * * @param fieldName The sort field name * @param comparator The comparator used to sort this result. * @return The result itself * @throws IllegalArgumentException If the argument field is not contained * in {@link #fieldsRow()} */ Result sortDesc(String fieldName, java.util.Comparator comparator) throws IllegalArgumentException; /** * Sort this result using a comparator that can compare records. * * @param comparator The comparator used to sort this result. * @return The result itself */ Result sortAsc(java.util.Comparator comparator); /** * Reverse-sort this result using a comparator that can compare records. * * @param comparator The comparator used to sort this result. * @return The result itself */ Result sortDesc(java.util.Comparator comparator); /** * Specify a set of fields whose values should be interned. *

* See {@link Result#intern(int...)} for more details. * * @param fields The fields whose values should be interned * @return The same result * @see Result#intern(Field...) * @see String#intern() */ Result intern(Field... fields); /** * Specify a set of field indexes whose values should be interned. *

* This traverses all records and interns String values for a * given set of field indexes. Use this method to save memory when a large * result set contains many identical string literals. *

* Please refer to {@link String#intern()} and to publicly available * literature to learn more about potential side-effects of string * interning. *

* Future versions of jOOQ may also "intern" other data types, such as * {@link Integer}, {@link Long}, within a Result object. * * @param fieldIndexes The field indexes whose values should be interned * @return The same result * @see Result#intern(Field...) * @see String#intern() */ Result intern(int... fieldIndexes); /** * Specify a set of field names whose values should be interned. *

* See {@link Result#intern(int...)} for more details. * * @param fieldNames The field names whose values should be interned * @return The same result * @see Result#intern(Field...) * @see String#intern() */ Result intern(String... fieldNames); // ------------------------------------------------------------------------ // Specialisations of Attachable methods // ------------------------------------------------------------------------ /** * Attach this result and all of its contained records to a new * {@link Configuration}. * * @param configuration A configuration or null, if you wish to * detach this Attachable from its previous * configuration. */ @Override void attach(Configuration configuration); /** * Detach this result and all of its contained records from their current * {@link Configuration}. *

* This is the same as calling attach(null). */ @Override void detach(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy