[#1887] Remove all deprecated code

This commit is contained in:
Lukas Eder 2012-10-27 21:15:46 +02:00
parent 857c8e6f79
commit 95b8db9cce
12 changed files with 274 additions and 578 deletions

View File

@ -35,7 +35,6 @@
*/
package org.jooq;
import java.util.List;
/**
* Base functionality declaration for all {@link Attachable}s
@ -46,17 +45,6 @@ import java.util.List;
*/
public interface AttachableInternal extends Attachable {
/**
* Get the list of dependent <code>Attachables</code>
* <p>
* This method is for JOOQ INTERNAL USE only. Do not reference directly
*
* @deprecated - 2.5.0 [#1544] - This internal method will be removed soon.
* Do not reuse.
*/
@Deprecated
List<Attachable> getAttachables();
/**
* Get the underlying configuration
*/

View File

@ -1,266 +0,0 @@
/**
* Copyright (c) 2009-2012, Lukas Eder, lukas.eder@gmail.com
* All rights reserved.
*
* This software is licensed to you under the Apache License, Version 2.0
* (the "License"); You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* . Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* . Neither the name "jOOQ" nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq;
import static org.jooq.SQLDialect.ASE;
import static org.jooq.SQLDialect.CUBRID;
import static org.jooq.SQLDialect.DB2;
import static org.jooq.SQLDialect.DERBY;
import static org.jooq.SQLDialect.FIREBIRD;
import static org.jooq.SQLDialect.H2;
import static org.jooq.SQLDialect.HSQLDB;
import static org.jooq.SQLDialect.INGRES;
import static org.jooq.SQLDialect.MYSQL;
import static org.jooq.SQLDialect.ORACLE;
import static org.jooq.SQLDialect.POSTGRES;
import static org.jooq.SQLDialect.SQLSERVER;
import static org.jooq.SQLDialect.SYBASE;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Collection;
/**
* A query part (mostly a {@link Select} statement) providing the possibility of
* locking tables, rows using a <code>FOR UPDATE</code> clause
*
* @author Lukas Eder
* @deprecated - 2.6.0 [#1881] - This type will be removed from the public API,
* soon. Its methods will be pushed down into extending interfaces.
* Do not reference this type directly.
*/
@Deprecated
public interface LockProvider {
/**
* Sets the "FOR UPDATE" flag onto the query
* <p>
* <h3>Native implementation</h3> This has been observed to be supported by
* any of these dialects:
* <ul>
* <li><a href=
* "http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=/com.ibm.db2.luw.sql.ref.doc/doc/r0000879.html"
* >DB2 FOR UPDATE and similar clauses</a></li>
* <li><a
* href="http://db.apache.org/derby/docs/10.7/ref/rrefsqlj31783.html">
* Derby's FOR UPDATE clause</a></li>
* <li><a href="http://www.h2database.com/html/grammar.html#select">H2's FOR
* UPDATE clause</a></li>
* <li><a
* href="http://www.hsqldb.org/doc/2.0/guide/dataaccess-chapt.html#N11DA9"
* >HSQLDB's FOR UPDATE clause</a></li>
* <li><a
* href="http://dev.mysql.com/doc/refman/5.5/en/innodb-locking-reads.html"
* >MySQL's InnoDB locking reads</a></li>
* <li><a
* href="http://www.techonthenet.com/oracle/cursors/for_update.php">Oracle's
* PL/SQL FOR UPDATE clause</a></li>
* <li><a href=
* "http://www.postgresql.org/docs/9.0/static/sql-select.html#SQL-FOR-UPDATE-SHARE"
* >Postgres FOR UPDATE / FOR SHARE</a></li>
* </ul>
* <h3>Simulation</h3> These dialects can simulate the
* <code>FOR UPDATE</code> clause using a cursor. The cursor is handled by
* the JDBC driver, at {@link PreparedStatement} construction time, when
* calling {@link Connection#prepareStatement(String, int, int)} with
* {@link ResultSet#CONCUR_UPDATABLE}. jOOQ handles simulation of a
* <code>FOR UPDATE</code> clause using <code>CONCUR_UPDATABLE</code> for
* these dialects:
* <ul>
* <li> {@link SQLDialect#CUBRID}</li>
* <li> {@link SQLDialect#SQLSERVER}</li>
* </ul>
* <p>
* Note: This simulation may not be efficient for large result sets!
* <h3>Not supported</h3> These dialects are known not to support the
* <code>FOR UPDATE</code> clause in regular SQL:
* <ul>
* <li> {@link SQLDialect#SQLITE}</li>
* </ul>
* <p>
* If your dialect does not support this clause, jOOQ will still render it,
* if you apply it to your query. This might then cause syntax errors
* reported either by your database or your JDBC driver.
* <p>
* You shouldn't combine this with {@link #setForShare(boolean)}
*
* @param forUpdate The flag's value
*/
@Support({ ASE, CUBRID, DB2, DERBY, FIREBIRD, H2, HSQLDB, INGRES, MYSQL, ORACLE, POSTGRES, SQLSERVER, SYBASE })
void setForUpdate(boolean forUpdate);
/**
* Some RDBMS allow for specifying the fields that should be locked by the
* <code>FOR UPDATE</code> clause, instead of the full row.
* <p>
* This automatically sets the {@link #setForUpdate(boolean)} flag, and
* unsets the {@link #setForShare(boolean)} flag, if it was previously set.
* <p>
* This has been observed to be natively supported by any of these dialects:
* <ul>
* <li>DB2</li>
* <li>Derby</li>
* <li>H2</li>
* <li>HSQLDB</li>
* <li>Ingres</li>
* <li>Oracle</li>
* <li>Sybase</li>
* </ul>
* <p>
* Note, that {@link SQLDialect#DB2} has some stricter requirements
* regarding the updatability of fields. Refer to the DB2 documentation for
* further details
*
* @param fields The fields that should be locked
*/
@Support({ DB2, DERBY, FIREBIRD, H2, HSQLDB, INGRES, ORACLE, SYBASE })
void setForUpdateOf(Field<?>... fields);
/**
* Some RDBMS allow for specifying the fields that should be locked by the
* <code>FOR UPDATE</code> clause, instead of the full row.
* <p>
*
* @see #setForUpdateOf(Field...)
*/
@Support({ DB2, DERBY, FIREBIRD, H2, HSQLDB, INGRES, ORACLE, SYBASE })
void setForUpdateOf(Collection<? extends Field<?>> fields);
/**
* Some RDBMS allow for specifying the tables that should be locked by the
* <code>FOR UPDATE</code> clause, instead of the full row.
* <p>
* This automatically sets the {@link #setForUpdate(boolean)} flag, and
* unsets the {@link #setForShare(boolean)} flag, if it was previously set.
* <p>
* This has been observed to be natively supported by any of these dialects:
* <ul>
* <li>Postgres</li>
* <li>H2</li>
* <li>HSQLDB</li>
* <li>Sybase</li>
* </ul>
* <p>
* jOOQ simulates this by locking all known fields of [<code>tables</code>]
* for any of these dialects:
* <ul>
* <li>DB2</li>
* <li>Derby</li>
* <li>Ingres</li>
* <li>Oracle</li>
* </ul>
*
* @param tables The tables that should be locked
*/
@Support({ DB2, DERBY, FIREBIRD, H2, HSQLDB, INGRES, POSTGRES, ORACLE, SYBASE })
void setForUpdateOf(Table<?>... tables);
/**
* Some RDBMS allow for specifying the locking mode for the applied
* <code>FOR UPDATE</code> clause. In this case, the session will wait for
* some <code>seconds</code>, before aborting the lock acquirement if the
* lock is not available.
* <p>
* This automatically sets the {@link #setForUpdate(boolean)} flag, and
* unsets the {@link #setForShare(boolean)} flag, if it was previously set.
* <p>
* This has been observed to be supported by any of these dialects:
* <ul>
* <li>Oracle</li>
* </ul>
*
* @param seconds The number of seconds to wait for a lock
*/
@Support(ORACLE)
void setForUpdateWait(int seconds);
/**
* Some RDBMS allow for specifying the locking mode for the applied
* <code>FOR UPDATE</code> clause. In this case, the session will not wait
* before aborting the lock acquirement if the lock is not available.
* <p>
* This automatically sets the {@link #setForUpdate(boolean)} flag, and
* unsets the {@link #setForShare(boolean)} flag, if it was previously set.
* <p>
* This has been observed to be supported by any of these dialects:
* <ul>
* <li>Oracle</li>
* </ul>
*/
@Support(ORACLE)
void setForUpdateNoWait();
/**
* Some RDBMS allow for specifying the locking mode for the applied
* <code>FOR UPDATE</code> clause. In this case, the session will skip all
* locked rows from the select statement, whose lock is not available.
* <p>
* This automatically sets the {@link #setForUpdate(boolean)} flag, and
* unsets the {@link #setForShare(boolean)} flag, if it was previously set.
* <p>
* This has been observed to be supported by any of these dialects:
* <ul>
* <li>Oracle</li>
* </ul>
*/
@Support(ORACLE)
void setForUpdateSkipLocked();
/**
* Sets the "FOR SHARE" flag onto the query
* <p>
* This has been observed to be supported by any of these dialects:
* <ul>
* <li><a
* href="http://dev.mysql.com/doc/refman/5.5/en/innodb-locking-reads.html"
* >MySQL's InnoDB locking reads</a></li>
* <li><a href=
* "http://www.postgresql.org/docs/9.0/static/sql-select.html#SQL-FOR-UPDATE-SHARE"
* >Postgres FOR UPDATE / FOR SHARE</a></li>
* </ul>
* <p>
* If your dialect does not support this clause, jOOQ will still render it,
* if you apply it to your query. This might then cause syntax errors
* reported either by your database or your JDBC driver.
* <p>
* You shouldn't combine this with {@link #setForUpdate(boolean)}
*
* @param forShare The flag's value
*/
@Support({ MYSQL, POSTGRES })
void setForShare(boolean forShare);
}

View File

@ -1,217 +0,0 @@
/**
* Copyright (c) 2009-2012, Lukas Eder, lukas.eder@gmail.com
* All rights reserved.
*
* This software is licensed to you under the Apache License, Version 2.0
* (the "License"); You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* . Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* . Neither the name "jOOQ" nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq;
import static org.jooq.SQLDialect.CUBRID;
import static org.jooq.SQLDialect.DB2;
import static org.jooq.SQLDialect.DERBY;
import static org.jooq.SQLDialect.FIREBIRD;
import static org.jooq.SQLDialect.H2;
import static org.jooq.SQLDialect.HSQLDB;
import static org.jooq.SQLDialect.INGRES;
import static org.jooq.SQLDialect.MYSQL;
import static org.jooq.SQLDialect.ORACLE;
import static org.jooq.SQLDialect.POSTGRES;
import static org.jooq.SQLDialect.SQLITE;
import static org.jooq.SQLDialect.SQLSERVER;
import static org.jooq.SQLDialect.SYBASE;
import java.util.Collection;
/**
* A query that can be ordered and limited
*
* @author Lukas Eder
* @deprecated - 2.6.0 [#1881] - This type will be removed from the public API,
* soon. Its methods will be pushed down into extending interfaces.
* Do not reference this type directly.
*/
@Deprecated
public interface OrderProvider {
/**
* Adds ordering fields, ordering by the default sort order
*
* @param fields The ordering fields
*/
@Support
void addOrderBy(Field<?>... fields);
/**
* Adds ordering fields
*
* @param fields The ordering fields
*/
@Support
void addOrderBy(SortField<?>... fields);
/**
* Adds ordering fields
*
* @param fields The ordering fields
*/
@Support
void addOrderBy(Collection<SortField<?>> fields);
/**
* Adds ordering fields
* <p>
* Indexes start at <code>1</code> in SQL!
* <p>
* Note, you can use <code>addOrderBy(Factory.val(1).desc())</code> or
* <code>addOrderBy(Factory.literal(1).desc())</code> to apply descending
* ordering
*
* @param fieldIndexes The ordering fields
*/
@Support
void addOrderBy(int... fieldIndexes);
/**
* Indicate whether the <code>SIBLINGS</code> keyword should be used in an
* <code>ORDER BY</code> clause to form an <code>ORDER SIBLINGS BY</code>
* clause.
* <p>
* This clause can be used only along with Oracle's <code>CONNECT BY</code>
* clause, to indicate that the hierarchical ordering should be preserved
* and elements of each hierarchy should be ordered among themselves.
*
* @param orderBySiblings
*/
@Support({ CUBRID, ORACLE })
void setOrderBySiblings(boolean orderBySiblings);
/**
* Limit the results of this select
* <p>
* This is the same as calling {@link #addLimit(int, int)} with offset = 0
*
* @param numberOfRows The number of rows to return
*/
@Support
void addLimit(int numberOfRows);
/**
* Limit the results of this select using named parameters
* <p>
* Note that some dialects do not support bind values at all in
* <code>LIMIT</code> or <code>TOP</code> clauses!
* <p>
* If there is no <code>LIMIT</code> or <code>TOP</code> clause in your
* RDBMS, or the <code>LIMIT</code> or <code>TOP</code> clause does not
* support bind values, this may be simulated with a
* <code>ROW_NUMBER()</code> window function and nested <code>SELECT</code>
* statements.
* <p>
* This is the same as calling {@link #addLimit(int, int)} with offset = 0
*
* @param numberOfRows The number of rows to return
*/
@Support({ CUBRID, DB2, DERBY, FIREBIRD, H2, HSQLDB, MYSQL, ORACLE, POSTGRES, SQLITE, SQLSERVER, SYBASE })
void addLimit(Param<Integer> numberOfRows);
/**
* Limit the results of this select
* <p>
* Note that some dialects do not support bind values at all in
* <code>LIMIT</code> or <code>TOP</code> clauses!
* <p>
* If there is no <code>LIMIT</code> or <code>TOP</code> clause in your
* RDBMS, or if your RDBMS does not natively support offsets, this is
* simulated with a <code>ROW_NUMBER()</code> window function and nested
* <code>SELECT</code> statements.
*
* @param offset The lowest offset starting at 0
* @param numberOfRows The number of rows to return
*/
@Support({ CUBRID, DB2, DERBY, FIREBIRD, H2, HSQLDB, INGRES, MYSQL, ORACLE, POSTGRES, SQLITE, SQLSERVER, SYBASE })
void addLimit(int offset, int numberOfRows);
/**
* Limit the results of this select
* <p>
* Note that some dialects do not support bind values at all in
* <code>LIMIT</code> or <code>TOP</code> clauses!
* <p>
* If there is no <code>LIMIT</code> or <code>TOP</code> clause in your
* RDBMS, or the <code>LIMIT</code> or <code>TOP</code> clause does not
* support bind values, or if your RDBMS does not natively support offsets,
* this may be simulated with a <code>ROW_NUMBER()</code> window function
* and nested <code>SELECT</code> statements.
*
* @param offset The lowest offset starting at 0
* @param numberOfRows The number of rows to return
*/
@Support({ CUBRID, DB2, DERBY, FIREBIRD, H2, HSQLDB, MYSQL, ORACLE, POSTGRES, SQLITE, SQLSERVER, SYBASE })
void addLimit(Param<Integer> offset, int numberOfRows);
/**
* Limit the results of this select using named parameters
* <p>
* Note that some dialects do not support bind values at all in
* <code>LIMIT</code> or <code>TOP</code> clauses!
* <p>
* If there is no <code>LIMIT</code> or <code>TOP</code> clause in your
* RDBMS, or the <code>LIMIT</code> or <code>TOP</code> clause does not
* support bind values, or if your RDBMS does not natively support offsets,
* this may be simulated with a <code>ROW_NUMBER()</code> window function
* and nested <code>SELECT</code> statements.
*
* @param offset The lowest offset starting at 0
* @param numberOfRows The number of rows to return
*/
@Support({ CUBRID, DB2, DERBY, FIREBIRD, H2, HSQLDB, MYSQL, ORACLE, POSTGRES, SQLITE, SQLSERVER, SYBASE })
void addLimit(int offset, Param<Integer> numberOfRows);
/**
* Limit the results of this select using named parameters
* <p>
* Note that some dialects do not support bind values at all in
* <code>LIMIT</code> or <code>TOP</code> clauses!
* <p>
* If there is no <code>LIMIT</code> or <code>TOP</code> clause in your
* RDBMS, or the <code>LIMIT</code> or <code>TOP</code> clause does not
* support bind values, or if your RDBMS does not natively support offsets,
* this may be simulated with a <code>ROW_NUMBER()</code> window function
* and nested <code>SELECT</code> statements.
*
* @param offset The lowest offset starting at 0
* @param numberOfRows The number of rows to return
*/
@Support({ CUBRID, DB2, DERBY, FIREBIRD, H2, HSQLDB, MYSQL, ORACLE, POSTGRES, SQLITE, SQLSERVER, SYBASE })
void addLimit(Param<Integer> offset, Param<Integer> numberOfRows);
}

View File

@ -50,6 +50,9 @@ import static org.jooq.SQLDialect.SQLITE;
import static org.jooq.SQLDialect.SQLSERVER;
import static org.jooq.SQLDialect.SYBASE;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Collection;
/**
@ -67,7 +70,7 @@ import java.util.Collection;
* @see SelectQuery
*/
@SuppressWarnings("deprecation")
public interface SimpleSelectQuery<R extends Record> extends Select<R>, ConditionProvider, OrderProvider, LockProvider {
public interface SimpleSelectQuery<R extends Record> extends Select<R>, ConditionProvider {
// ------------------------------------------------------------------------
// Methods from ConditionProvider, OrderProvider, LockProvider
@ -102,135 +105,353 @@ public interface SimpleSelectQuery<R extends Record> extends Select<R>, Conditio
void addConditions(Operator operator, Collection<Condition> conditions);
/**
* {@inheritDoc}
* Adds ordering fields, ordering by the default sort order
*
* @param fields The ordering fields
*/
@Override
@Support
void addOrderBy(Field<?>... fields);
/**
* {@inheritDoc}
* Adds ordering fields
*
* @param fields The ordering fields
*/
@Override
@Support
void addOrderBy(SortField<?>... fields);
/**
* {@inheritDoc}
* Adds ordering fields
*
* @param fields The ordering fields
*/
@Override
@Support
void addOrderBy(Collection<SortField<?>> fields);
/**
* {@inheritDoc}
* Adds ordering fields
* <p>
* Indexes start at <code>1</code> in SQL!
* <p>
* Note, you can use <code>addOrderBy(Factory.val(1).desc())</code> or
* <code>addOrderBy(Factory.literal(1).desc())</code> to apply descending
* ordering
*
* @param fieldIndexes The ordering fields
*/
@Override
@Support
void addOrderBy(int... fieldIndexes);
/**
* {@inheritDoc}
* Indicate whether the <code>SIBLINGS</code> keyword should be used in an
* <code>ORDER BY</code> clause to form an <code>ORDER SIBLINGS BY</code>
* clause.
* <p>
* This clause can be used only along with Oracle's <code>CONNECT BY</code>
* clause, to indicate that the hierarchical ordering should be preserved
* and elements of each hierarchy should be ordered among themselves.
*
* @param orderBySiblings
*/
@Override
@Support({ CUBRID, ORACLE })
void setOrderBySiblings(boolean orderBySiblings);
/**
* {@inheritDoc}
* Limit the results of this select
* <p>
* This is the same as calling {@link #addLimit(int, int)} with offset = 0
*
* @param numberOfRows The number of rows to return
*/
@Override
@Support
void addLimit(int numberOfRows);
/**
* {@inheritDoc}
* Limit the results of this select using named parameters
* <p>
* Note that some dialects do not support bind values at all in
* <code>LIMIT</code> or <code>TOP</code> clauses!
* <p>
* If there is no <code>LIMIT</code> or <code>TOP</code> clause in your
* RDBMS, or the <code>LIMIT</code> or <code>TOP</code> clause does not
* support bind values, this may be simulated with a
* <code>ROW_NUMBER()</code> window function and nested <code>SELECT</code>
* statements.
* <p>
* This is the same as calling {@link #addLimit(int, int)} with offset = 0
*
* @param numberOfRows The number of rows to return
*/
@Override
@Support({ CUBRID, DB2, DERBY, FIREBIRD, H2, HSQLDB, MYSQL, ORACLE, POSTGRES, SQLITE, SQLSERVER, SYBASE })
void addLimit(Param<Integer> numberOfRows);
/**
* {@inheritDoc}
* Limit the results of this select
* <p>
* Note that some dialects do not support bind values at all in
* <code>LIMIT</code> or <code>TOP</code> clauses!
* <p>
* If there is no <code>LIMIT</code> or <code>TOP</code> clause in your
* RDBMS, or if your RDBMS does not natively support offsets, this is
* simulated with a <code>ROW_NUMBER()</code> window function and nested
* <code>SELECT</code> statements.
*
* @param offset The lowest offset starting at 0
* @param numberOfRows The number of rows to return
*/
@Override
@Support({ CUBRID, DB2, DERBY, FIREBIRD, H2, HSQLDB, INGRES, MYSQL, ORACLE, POSTGRES, SQLITE, SQLSERVER, SYBASE })
void addLimit(int offset, int numberOfRows);
/**
* {@inheritDoc}
* Limit the results of this select
* <p>
* Note that some dialects do not support bind values at all in
* <code>LIMIT</code> or <code>TOP</code> clauses!
* <p>
* If there is no <code>LIMIT</code> or <code>TOP</code> clause in your
* RDBMS, or the <code>LIMIT</code> or <code>TOP</code> clause does not
* support bind values, or if your RDBMS does not natively support offsets,
* this may be simulated with a <code>ROW_NUMBER()</code> window function
* and nested <code>SELECT</code> statements.
*
* @param offset The lowest offset starting at 0
* @param numberOfRows The number of rows to return
*/
@Override
@Support({ CUBRID, DB2, DERBY, FIREBIRD, H2, HSQLDB, MYSQL, ORACLE, POSTGRES, SQLITE, SQLSERVER, SYBASE })
void addLimit(Param<Integer> offset, int numberOfRows);
/**
* {@inheritDoc}
* Limit the results of this select using named parameters
* <p>
* Note that some dialects do not support bind values at all in
* <code>LIMIT</code> or <code>TOP</code> clauses!
* <p>
* If there is no <code>LIMIT</code> or <code>TOP</code> clause in your
* RDBMS, or the <code>LIMIT</code> or <code>TOP</code> clause does not
* support bind values, or if your RDBMS does not natively support offsets,
* this may be simulated with a <code>ROW_NUMBER()</code> window function
* and nested <code>SELECT</code> statements.
*
* @param offset The lowest offset starting at 0
* @param numberOfRows The number of rows to return
*/
@Override
@Support({ CUBRID, DB2, DERBY, FIREBIRD, H2, HSQLDB, MYSQL, ORACLE, POSTGRES, SQLITE, SQLSERVER, SYBASE })
void addLimit(int offset, Param<Integer> numberOfRows);
/**
* {@inheritDoc}
* Limit the results of this select using named parameters
* <p>
* Note that some dialects do not support bind values at all in
* <code>LIMIT</code> or <code>TOP</code> clauses!
* <p>
* If there is no <code>LIMIT</code> or <code>TOP</code> clause in your
* RDBMS, or the <code>LIMIT</code> or <code>TOP</code> clause does not
* support bind values, or if your RDBMS does not natively support offsets,
* this may be simulated with a <code>ROW_NUMBER()</code> window function
* and nested <code>SELECT</code> statements.
*
* @param offset The lowest offset starting at 0
* @param numberOfRows The number of rows to return
*/
@Override
@Support({ CUBRID, DB2, DERBY, FIREBIRD, H2, HSQLDB, MYSQL, ORACLE, POSTGRES, SQLITE, SQLSERVER, SYBASE })
void addLimit(Param<Integer> offset, Param<Integer> numberOfRows);
/**
* {@inheritDoc}
* Sets the "FOR UPDATE" flag onto the query
* <p>
* <h3>Native implementation</h3> This has been observed to be supported by
* any of these dialects:
* <ul>
* <li><a href=
* "http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=/com.ibm.db2.luw.sql.ref.doc/doc/r0000879.html"
* >DB2 FOR UPDATE and similar clauses</a></li>
* <li><a
* href="http://db.apache.org/derby/docs/10.7/ref/rrefsqlj31783.html">
* Derby's FOR UPDATE clause</a></li>
* <li><a href="http://www.h2database.com/html/grammar.html#select">H2's FOR
* UPDATE clause</a></li>
* <li><a
* href="http://www.hsqldb.org/doc/2.0/guide/dataaccess-chapt.html#N11DA9"
* >HSQLDB's FOR UPDATE clause</a></li>
* <li><a
* href="http://dev.mysql.com/doc/refman/5.5/en/innodb-locking-reads.html"
* >MySQL's InnoDB locking reads</a></li>
* <li><a
* href="http://www.techonthenet.com/oracle/cursors/for_update.php">Oracle's
* PL/SQL FOR UPDATE clause</a></li>
* <li><a href=
* "http://www.postgresql.org/docs/9.0/static/sql-select.html#SQL-FOR-UPDATE-SHARE"
* >Postgres FOR UPDATE / FOR SHARE</a></li>
* </ul>
* <h3>Simulation</h3> These dialects can simulate the
* <code>FOR UPDATE</code> clause using a cursor. The cursor is handled by
* the JDBC driver, at {@link PreparedStatement} construction time, when
* calling {@link Connection#prepareStatement(String, int, int)} with
* {@link ResultSet#CONCUR_UPDATABLE}. jOOQ handles simulation of a
* <code>FOR UPDATE</code> clause using <code>CONCUR_UPDATABLE</code> for
* these dialects:
* <ul>
* <li> {@link SQLDialect#CUBRID}</li>
* <li> {@link SQLDialect#SQLSERVER}</li>
* </ul>
* <p>
* Note: This simulation may not be efficient for large result sets!
* <h3>Not supported</h3> These dialects are known not to support the
* <code>FOR UPDATE</code> clause in regular SQL:
* <ul>
* <li> {@link SQLDialect#SQLITE}</li>
* </ul>
* <p>
* If your dialect does not support this clause, jOOQ will still render it,
* if you apply it to your query. This might then cause syntax errors
* reported either by your database or your JDBC driver.
* <p>
* You shouldn't combine this with {@link #setForShare(boolean)}
*
* @param forUpdate The flag's value
*/
@Override
@Support({ ASE, CUBRID, DB2, DERBY, FIREBIRD, H2, HSQLDB, INGRES, MYSQL, ORACLE, POSTGRES, SQLSERVER, SYBASE })
void setForUpdate(boolean forUpdate);
/**
* {@inheritDoc}
* Some RDBMS allow for specifying the fields that should be locked by the
* <code>FOR UPDATE</code> clause, instead of the full row.
* <p>
* This automatically sets the {@link #setForUpdate(boolean)} flag, and
* unsets the {@link #setForShare(boolean)} flag, if it was previously set.
* <p>
* This has been observed to be natively supported by any of these dialects:
* <ul>
* <li>DB2</li>
* <li>Derby</li>
* <li>H2</li>
* <li>HSQLDB</li>
* <li>Ingres</li>
* <li>Oracle</li>
* <li>Sybase</li>
* </ul>
* <p>
* Note, that {@link SQLDialect#DB2} has some stricter requirements
* regarding the updatability of fields. Refer to the DB2 documentation for
* further details
*
* @param fields The fields that should be locked
*/
@Override
@Support({ DB2, DERBY, FIREBIRD, H2, HSQLDB, INGRES, ORACLE, SYBASE })
void setForUpdateOf(Field<?>... fields);
/**
* {@inheritDoc}
* Some RDBMS allow for specifying the fields that should be locked by the
* <code>FOR UPDATE</code> clause, instead of the full row.
* <p>
*
* @see #setForUpdateOf(Field...)
*/
@Override
@Support({ DB2, DERBY, FIREBIRD, H2, HSQLDB, INGRES, ORACLE, SYBASE })
void setForUpdateOf(Collection<? extends Field<?>> fields);
/**
* {@inheritDoc}
* Some RDBMS allow for specifying the tables that should be locked by the
* <code>FOR UPDATE</code> clause, instead of the full row.
* <p>
* This automatically sets the {@link #setForUpdate(boolean)} flag, and
* unsets the {@link #setForShare(boolean)} flag, if it was previously set.
* <p>
* This has been observed to be natively supported by any of these dialects:
* <ul>
* <li>Postgres</li>
* <li>H2</li>
* <li>HSQLDB</li>
* <li>Sybase</li>
* </ul>
* <p>
* jOOQ simulates this by locking all known fields of [<code>tables</code>]
* for any of these dialects:
* <ul>
* <li>DB2</li>
* <li>Derby</li>
* <li>Ingres</li>
* <li>Oracle</li>
* </ul>
*
* @param tables The tables that should be locked
*/
@Override
@Support({ DB2, DERBY, FIREBIRD, H2, HSQLDB, INGRES, POSTGRES, ORACLE, SYBASE })
void setForUpdateOf(Table<?>... tables);
/**
* {@inheritDoc}
* Some RDBMS allow for specifying the locking mode for the applied
* <code>FOR UPDATE</code> clause. In this case, the session will wait for
* some <code>seconds</code>, before aborting the lock acquirement if the
* lock is not available.
* <p>
* This automatically sets the {@link #setForUpdate(boolean)} flag, and
* unsets the {@link #setForShare(boolean)} flag, if it was previously set.
* <p>
* This has been observed to be supported by any of these dialects:
* <ul>
* <li>Oracle</li>
* </ul>
*
* @param seconds The number of seconds to wait for a lock
*/
@Override
@Support(ORACLE)
void setForUpdateWait(int seconds);
/**
* {@inheritDoc}
* Some RDBMS allow for specifying the locking mode for the applied
* <code>FOR UPDATE</code> clause. In this case, the session will not wait
* before aborting the lock acquirement if the lock is not available.
* <p>
* This automatically sets the {@link #setForUpdate(boolean)} flag, and
* unsets the {@link #setForShare(boolean)} flag, if it was previously set.
* <p>
* This has been observed to be supported by any of these dialects:
* <ul>
* <li>Oracle</li>
* </ul>
*/
@Override
@Support(ORACLE)
void setForUpdateNoWait();
/**
* {@inheritDoc}
* Some RDBMS allow for specifying the locking mode for the applied
* <code>FOR UPDATE</code> clause. In this case, the session will skip all
* locked rows from the select statement, whose lock is not available.
* <p>
* This automatically sets the {@link #setForUpdate(boolean)} flag, and
* unsets the {@link #setForShare(boolean)} flag, if it was previously set.
* <p>
* This has been observed to be supported by any of these dialects:
* <ul>
* <li>Oracle</li>
* </ul>
*/
@Override
@Support(ORACLE)
void setForUpdateSkipLocked();
/**
* {@inheritDoc}
* Sets the "FOR SHARE" flag onto the query
* <p>
* This has been observed to be supported by any of these dialects:
* <ul>
* <li><a
* href="http://dev.mysql.com/doc/refman/5.5/en/innodb-locking-reads.html"
* >MySQL's InnoDB locking reads</a></li>
* <li><a href=
* "http://www.postgresql.org/docs/9.0/static/sql-select.html#SQL-FOR-UPDATE-SHARE"
* >Postgres FOR UPDATE / FOR SHARE</a></li>
* </ul>
* <p>
* If your dialect does not support this clause, jOOQ will still render it,
* if you apply it to your query. This might then cause syntax errors
* reported either by your database or your JDBC driver.
* <p>
* You shouldn't combine this with {@link #setForUpdate(boolean)}
*
* @param forShare The flag's value
*/
@Override
@Support({ MYSQL, POSTGRES })
void setForShare(boolean forShare);
}

View File

@ -47,7 +47,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.jooq.Attachable;
import org.jooq.AttachableInternal;
import org.jooq.Configuration;
import org.jooq.ExecuteContext;
@ -89,11 +88,6 @@ abstract class AbstractQuery extends AbstractQueryPart implements Query, Attacha
return configuration;
}
@Override
public final List<Attachable> getAttachables() {
return Collections.emptyList();
}
// -------------------------------------------------------------------------
// The Query API
// -------------------------------------------------------------------------

View File

@ -96,7 +96,7 @@ abstract class AbstractRecord extends AbstractStore implements Record {
// ------------------------------------------------------------------------
@Override
public final List<Attachable> getAttachables() {
final List<Attachable> getAttachables() {
List<Attachable> result = new ArrayList<Attachable>();
int size = getFields().size();

View File

@ -53,7 +53,6 @@ import java.util.Set;
import org.jooq.AggregateFunction;
import org.jooq.ArrayRecord;
import org.jooq.Attachable;
import org.jooq.AttachableInternal;
import org.jooq.BindContext;
import org.jooq.Configuration;
@ -184,11 +183,6 @@ public abstract class AbstractRoutine<T> extends AbstractQueryPart implements Ro
configuration = c;
}
@Override
public final List<Attachable> getAttachables() {
return Collections.emptyList();
}
@Override
public final Configuration getConfiguration() {
return configuration;

View File

@ -36,6 +36,7 @@
package org.jooq.impl;
import java.util.Arrays;
import java.util.List;
import org.jooq.ArrayRecord;
import org.jooq.Attachable;
@ -72,7 +73,8 @@ abstract class AbstractStore implements AttachableInternal {
// The Attachable API
// -------------------------------------------------------------------------
@SuppressWarnings("deprecation")
abstract List<Attachable> getAttachables();
@Override
public final void attach(Configuration c) {
configuration = c;

View File

@ -55,17 +55,15 @@ import java.util.List;
import org.jooq.BindContext;
import org.jooq.Condition;
import org.jooq.ConditionProvider;
import org.jooq.Configuration;
import org.jooq.Field;
import org.jooq.LockProvider;
import org.jooq.Operator;
import org.jooq.OrderProvider;
import org.jooq.Param;
import org.jooq.QueryPart;
import org.jooq.Record;
import org.jooq.RenderContext;
import org.jooq.SQLDialect;
import org.jooq.SimpleSelectQuery;
import org.jooq.SortField;
import org.jooq.Table;
import org.jooq.TableLike;
@ -78,13 +76,7 @@ import org.jooq.tools.StringUtils;
*
* @author Lukas Eder
*/
@SuppressWarnings("deprecation")
abstract class AbstractSubSelect<R extends Record>
extends AbstractSelect<R>
implements
ConditionProvider,
OrderProvider,
LockProvider {
abstract class AbstractSubSelect<R extends Record> extends AbstractSelect<R> implements SimpleSelectQuery<R> {
/**
* Generated UID

View File

@ -96,7 +96,7 @@ public class ArrayRecordImpl<T> extends AbstractStore implements ArrayRecord<T>
// -------------------------------------------------------------------------
@Override
public final List<Attachable> getAttachables() {
final List<Attachable> getAttachables() {
List<Attachable> result = new ArrayList<Attachable>();
if (Attachable.class.isAssignableFrom(type.getType())) {

View File

@ -59,7 +59,6 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.jooq.Attachable;
import org.jooq.AttachableInternal;
import org.jooq.Configuration;
import org.jooq.Converter;
@ -108,23 +107,11 @@ class ResultImpl<R extends Record> implements Result<R>, AttachableInternal {
public final void attach(Configuration c) {
this.configuration = c;
for (Attachable attachable : getAttachables()) {
attachable.attach(c);
}
}
@Override
@Deprecated
public final List<Attachable> getAttachables() {
List<Attachable> result = new ArrayList<Attachable>();
for (Attachable item : records) {
if (item != null) {
result.add(item);
for (R record : records) {
if (record != null) {
record.attach(c);
}
}
return result;
}
@Override

View File

@ -37,11 +37,12 @@ package org.jooq.impl;
import org.jooq.Configuration;
import org.jooq.Record;
import org.jooq.SimpleSelectQuery;
import org.jooq.TableLike;
class SimpleSelectQueryImpl<R extends Record> extends AbstractSubSelect<R> implements
SimpleSelectQuery<R> {
/**
* @author Lukas Eder
*/
class SimpleSelectQueryImpl<R extends Record> extends AbstractSubSelect<R> {
/**
* Generated UID