Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* 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 extends T> 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 super T, U> 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 extends T> 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, U> 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 extends T> 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, U> 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.
*
*
* @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.
*
*
* @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