[#1887] Remove all deprecated code
This commit is contained in:
parent
65e292f261
commit
cbfc408c10
@ -522,30 +522,6 @@ public interface FactoryOperations extends Configuration {
|
||||
@Support
|
||||
<R extends Record> InsertValuesStep<R> insertInto(Table<R> into, Collection<? extends Field<?>> fields);
|
||||
|
||||
/**
|
||||
* Create a new DSL insert statement.
|
||||
* <p>
|
||||
* Example: <code><pre>
|
||||
* Factory create = new Factory();
|
||||
*
|
||||
* create.insertInto(table, create.select(1))
|
||||
* .execute();
|
||||
* </pre></code>
|
||||
*
|
||||
* @deprecated - 2.0.3 - Use any of these methods instead:
|
||||
* <ul>
|
||||
* <li>{@link #insertInto(Table)} and
|
||||
* {@link InsertSetStep#select(Select)}</li> <li>
|
||||
* {@link #insertInto(Table, Field...)} and
|
||||
* {@link InsertValuesStep#select(Select)}</li> <li>
|
||||
* {@link #insertInto(Table, Collection)} and
|
||||
* {@link InsertValuesStep#select(Select)}</li>
|
||||
* </ul>
|
||||
*/
|
||||
@Deprecated
|
||||
@Support
|
||||
<R extends Record> Insert<R> insertInto(Table<R> into, Select<?> select);
|
||||
|
||||
/**
|
||||
* Create a new {@link UpdateQuery}
|
||||
*
|
||||
@ -1083,19 +1059,6 @@ public interface FactoryOperations extends Configuration {
|
||||
@Support
|
||||
<R extends Record> R fetchAny(Table<R> table) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Insert one record
|
||||
* <code><pre>INSERT INTO [table] ... VALUES [record] </pre></code>
|
||||
*
|
||||
* @return The number of inserted records
|
||||
* @throws DataAccessException if something went wrong executing the query
|
||||
* @deprecated - 2.5.0 [#1692] - Use {@link #executeInsert(TableRecord)}
|
||||
* instead
|
||||
*/
|
||||
@Deprecated
|
||||
@Support
|
||||
<R extends TableRecord<R>> int executeInsert(Table<R> table, R record) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Insert one record
|
||||
* <p>
|
||||
@ -1113,59 +1076,6 @@ public interface FactoryOperations extends Configuration {
|
||||
@Support
|
||||
<R extends TableRecord<R>> int executeInsert(R record) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Update a table
|
||||
* <code><pre>UPDATE [table] SET [modified values in record] </pre></code>
|
||||
*
|
||||
* @return The number of updated records
|
||||
* @throws DataAccessException if something went wrong executing the query
|
||||
* @deprecated - 2.5.0 [#1692] - This "mass" update is no longer supported
|
||||
*/
|
||||
@Deprecated
|
||||
@Support
|
||||
<R extends TableRecord<R>> int executeUpdate(Table<R> table, R record) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Update a table
|
||||
* <code><pre>UPDATE [table] SET [modified values in record] WHERE [condition]</pre></code>
|
||||
*
|
||||
* @return The number of updated records
|
||||
* @throws DataAccessException if something went wrong executing the query
|
||||
* @deprecated - 2.5.0 [#1692] - Use
|
||||
* {@link #executeUpdate(TableRecord, Condition)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@Support
|
||||
<R extends TableRecord<R>, T> int executeUpdate(Table<R> table, R record, Condition condition)
|
||||
throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Update one record in a table
|
||||
* <code><pre>UPDATE [table] SET [modified values in record]</pre></code>
|
||||
*
|
||||
* @return The number of updated records
|
||||
* @throws DataAccessException if something went wrong executing the query
|
||||
* @deprecated - 2.5.0 [#1692] - This "mass" update is no longer supported
|
||||
*/
|
||||
@Deprecated
|
||||
@Support
|
||||
<R extends TableRecord<R>> int executeUpdateOne(Table<R> table, R record) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Update one record in a table
|
||||
* <code><pre>UPDATE [table] SET [modified values in record] WHERE [condition]</pre></code>
|
||||
*
|
||||
* @return The number of updated records
|
||||
* @throws DataAccessException if something went wrong executing the query
|
||||
* @deprecated - 2.5.0 [#1692] - The semantics of
|
||||
* {@link #executeUpdate(TableRecord, Condition)} has changed.
|
||||
* This method here is no longer necessary.
|
||||
*/
|
||||
@Deprecated
|
||||
@Support
|
||||
<R extends TableRecord<R>, T> int executeUpdateOne(Table<R> table, R record, Condition condition)
|
||||
throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Update a table
|
||||
* <code><pre>UPDATE [table] SET [modified values in record] WHERE [record is supplied record] </pre></code>
|
||||
@ -1206,60 +1116,6 @@ public interface FactoryOperations extends Configuration {
|
||||
@Support
|
||||
<R extends TableRecord<R>, T> int executeDelete(R record, Condition condition) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Delete records from a table <code><pre>DELETE FROM [table]</pre></code>
|
||||
*
|
||||
* @return The number of deleted records
|
||||
* @throws DataAccessException if something went wrong executing the query
|
||||
* @deprecated - 2.5.0 [#1692] - The semantics of
|
||||
* {@link #executeDelete(TableRecord, Condition)} has changed.
|
||||
* This method here is no longer necessary.
|
||||
*/
|
||||
@Deprecated
|
||||
@Support
|
||||
<R extends TableRecord<R>> int executeDelete(Table<R> table) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Delete records from a table
|
||||
* <code><pre>DELETE FROM [table] WHERE [condition]</pre></code>
|
||||
*
|
||||
* @return The number of deleted records
|
||||
* @throws DataAccessException if something went wrong executing the query.
|
||||
* @deprecated - 2.5.0 [#1692] - The semantics of
|
||||
* {@link #executeDelete(TableRecord, Condition)} has changed.
|
||||
* This method here is no longer necessary.
|
||||
*/
|
||||
@Deprecated
|
||||
@Support
|
||||
<R extends TableRecord<R>, T> int executeDelete(Table<R> table, Condition condition) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Delete one record in a table <code><pre>DELETE FROM [table]</pre></code>
|
||||
*
|
||||
* @return The number of deleted records
|
||||
* @throws DataAccessException if something went wrong executing the query
|
||||
* @deprecated - 2.5.0 [#1692] - The semantics of
|
||||
* {@link #executeDelete(TableRecord, Condition)} has changed.
|
||||
* This method here is no longer necessary.
|
||||
*/
|
||||
@Deprecated
|
||||
@Support
|
||||
<R extends TableRecord<R>> int executeDeleteOne(Table<R> table) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Delete one record in a table
|
||||
* <code><pre>DELETE FROM [table] WHERE [condition]</pre></code>
|
||||
*
|
||||
* @return The number of deleted records
|
||||
* @throws DataAccessException if something went wrong executing the query
|
||||
* @deprecated - 2.5.0 [#1692] - The semantics of
|
||||
* {@link #executeDelete(TableRecord, Condition)} has changed.
|
||||
* This method here is no longer necessary.
|
||||
*/
|
||||
@Deprecated
|
||||
@Support
|
||||
<R extends TableRecord<R>, T> int executeDeleteOne(Table<R> table, Condition condition) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Execute a new query holding plain SQL.
|
||||
* <p>
|
||||
|
||||
@ -1,54 +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;
|
||||
|
||||
/**
|
||||
* A type holding master data.
|
||||
*
|
||||
* @author Lukas Eder
|
||||
* @deprecated - 2.5.0 [#1741] - This feature will be removed as of jOOQ 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
public interface MasterDataType<T> {
|
||||
|
||||
/**
|
||||
* Get the primary key value for this master data type
|
||||
*
|
||||
* @deprecated - 2.5.0 [#1741] - This feature will be removed as of jOOQ 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
T getPrimaryKey();
|
||||
}
|
||||
@ -35,9 +35,6 @@
|
||||
*/
|
||||
package org.jooq;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* UDT definition
|
||||
@ -66,21 +63,6 @@ public interface UDT<R extends UDTRecord<R>> extends org.jooq.Type<R> {
|
||||
@Override
|
||||
Class<? extends R> getRecordType();
|
||||
|
||||
/**
|
||||
* The complete type mapping for this UDT.
|
||||
* <p>
|
||||
* This method returns all types involved with this UDT, including nested
|
||||
* types. The result can be used in {@link ResultSet#getObject(int, Map)}
|
||||
* and similar methods.
|
||||
*
|
||||
* @see Schema#getTypeMapping() for the {@link Schema}'s complete type
|
||||
* mapping
|
||||
* @deprecated - 2.3.0 - Do not reuse this method. It will be moved to
|
||||
* jOOQ's internals, soon
|
||||
*/
|
||||
@Deprecated
|
||||
Map<String, Class<?>> getTypeMapping() throws SQLException;
|
||||
|
||||
/**
|
||||
* The UDT's data type as known to the database
|
||||
*/
|
||||
|
||||
@ -58,7 +58,6 @@ import org.jooq.Configuration;
|
||||
import org.jooq.Converter;
|
||||
import org.jooq.DataType;
|
||||
import org.jooq.EnumType;
|
||||
import org.jooq.MasterDataType;
|
||||
import org.jooq.Result;
|
||||
import org.jooq.SQLDialect;
|
||||
import org.jooq.UDTRecord;
|
||||
@ -263,9 +262,6 @@ public abstract class AbstractDataType<T> implements DataType<T> {
|
||||
else if (EnumType.class.isAssignableFrom(type)) {
|
||||
return Types.VARCHAR;
|
||||
}
|
||||
else if (MasterDataType.class.isAssignableFrom(type)) {
|
||||
return Types.BIGINT;
|
||||
}
|
||||
else if (UDTRecord.class.isAssignableFrom(type)) {
|
||||
return Types.STRUCT;
|
||||
}
|
||||
@ -450,7 +446,6 @@ public abstract class AbstractDataType<T> implements DataType<T> {
|
||||
// jOOQ data types are handled here
|
||||
if (EnumType.class.isAssignableFrom(type) ||
|
||||
UDTRecord.class.isAssignableFrom(type) ||
|
||||
MasterDataType.class.isAssignableFrom(type) ||
|
||||
ArrayRecord.class.isAssignableFrom(type)) {
|
||||
|
||||
for (SQLDialect d : SQLDialect.values()) {
|
||||
|
||||
@ -116,7 +116,7 @@ class DefaultBindContext extends AbstractBindContext {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "unchecked", "rawtypes", "deprecation" })
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
protected final BindContext bindValue0(Object value, Class<?> type) throws SQLException {
|
||||
SQLDialect dialect = configuration.getDialect();
|
||||
|
||||
@ -324,10 +324,6 @@ class DefaultBindContext extends AbstractBindContext {
|
||||
else if (EnumType.class.isAssignableFrom(type)) {
|
||||
stmt.setString(nextIndex(), ((EnumType) value).getLiteral());
|
||||
}
|
||||
else if (org.jooq.MasterDataType.class.isAssignableFrom(type)) {
|
||||
Object primaryKey = ((org.jooq.MasterDataType<?>) value).getPrimaryKey();
|
||||
bindValue(primaryKey, primaryKey.getClass());
|
||||
}
|
||||
else {
|
||||
try {
|
||||
// [#1544] Set the local configuration, in case an array needs
|
||||
|
||||
@ -98,7 +98,6 @@ import org.jooq.FactoryOperations;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.FieldProvider;
|
||||
import org.jooq.GroupConcatOrderByStep;
|
||||
import org.jooq.Insert;
|
||||
import org.jooq.InsertQuery;
|
||||
import org.jooq.InsertSetStep;
|
||||
import org.jooq.InsertValuesStep;
|
||||
@ -273,34 +272,6 @@ public class Factory implements FactoryOperations {
|
||||
this(null, null, dialect, null, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a factory with a connection, a dialect and a schema mapping
|
||||
* configured.
|
||||
* <p>
|
||||
* If you provide a JDBC connection to a jOOQ Factory, jOOQ will use that
|
||||
* connection for creating statements, but it will never call any of these
|
||||
* methods:
|
||||
* <ul>
|
||||
* <li> {@link Connection#commit()}</li>
|
||||
* <li> {@link Connection#rollback()}</li>
|
||||
* <li> {@link Connection#close()}</li>
|
||||
* </ul>
|
||||
* Use this constructor if you want to handle transactions directly on the
|
||||
* connection.
|
||||
*
|
||||
* @param connection The connection to use with objects created from this
|
||||
* factory
|
||||
* @param dialect The dialect to use with objects created from this factory
|
||||
* @param mapping The schema mapping to use with objects created from this
|
||||
* factory
|
||||
* @deprecated - 2.0.5 - Use
|
||||
* {@link #Factory(Connection, SQLDialect, Settings)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public Factory(Connection connection, SQLDialect dialect, org.jooq.SchemaMapping mapping) {
|
||||
this(null, connection, dialect, null, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a factory with a connection, a dialect and settings configured.
|
||||
* <p>
|
||||
@ -2004,15 +1975,6 @@ public class Factory implements FactoryOperations {
|
||||
return new InsertImpl<R>(this, into, fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public final <R extends Record> Insert<R> insertInto(Table<R> into, Select<?> select) {
|
||||
return new InsertSelectQueryImpl<R>(this, into, into.getFields(), select);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -6210,89 +6172,6 @@ public class Factory implements FactoryOperations {
|
||||
// XXX Literals
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get a typed <code>Field</code> for a literal.
|
||||
* <p>
|
||||
* This is similar as calling {@link #field(String)}. A field without bind
|
||||
* variables will be generated.
|
||||
* <p>
|
||||
* <b>NOTE</b>: When inserting plain SQL into jOOQ objects, you must
|
||||
* guarantee syntax integrity. You may also create the possibility of
|
||||
* malicious SQL injection. Be sure to properly use bind variables and/or
|
||||
* escape literals when concatenated into SQL clauses!
|
||||
*
|
||||
* @param <T> The generic field type
|
||||
* @param literal The literal
|
||||
* @return The literal as a field
|
||||
* @deprecated - 2.3.0 - Use {@link #field(String)}, or
|
||||
* {@link #inline(Object)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
@Support
|
||||
public static <T> Field<T> literal(T literal) {
|
||||
if (literal == null) {
|
||||
return (Field<T>) NULL();
|
||||
}
|
||||
else {
|
||||
return literal(literal, (Class<T>) literal.getClass());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a typed <code>Field</code> for a literal.
|
||||
* <p>
|
||||
* This is similar as calling {@link #field(String)}. A field without bind
|
||||
* variables will be generated.
|
||||
* <p>
|
||||
* <b>NOTE</b>: When inserting plain SQL into jOOQ objects, you must
|
||||
* guarantee syntax integrity. You may also create the possibility of
|
||||
* malicious SQL injection. Be sure to properly use bind variables and/or
|
||||
* escape literals when concatenated into SQL clauses!
|
||||
*
|
||||
* @param <T> The generic field type
|
||||
* @param literal The literal
|
||||
* @param type The literal's data type
|
||||
* @return The literal as a field
|
||||
* @deprecated - 2.3.0 - Use {@link #field(String, Class)}, or
|
||||
* {@link #inline(Object, Class)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@Support
|
||||
public static <T> Field<T> literal(Object literal, Class<T> type) {
|
||||
return literal(literal, getDataType(type));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a typed <code>Field</code> for a literal.
|
||||
* <p>
|
||||
* This is similar as calling {@link #field(String)}. A field without bind
|
||||
* variables will be generated.
|
||||
* <p>
|
||||
* <b>NOTE</b>: When inserting plain SQL into jOOQ objects, you must
|
||||
* guarantee syntax integrity. You may also create the possibility of
|
||||
* malicious SQL injection. Be sure to properly use bind variables and/or
|
||||
* escape literals when concatenated into SQL clauses!
|
||||
*
|
||||
* @param <T> The generic field type
|
||||
* @param literal The literal
|
||||
* @param type The literal's data type
|
||||
* @return The literal as a field
|
||||
* @deprecated - 2.3.0 - Use {@link #field(String, DataType)}, or
|
||||
* {@link #inline(Object, DataType)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
@Support
|
||||
public static <T> Field<T> literal(Object literal, DataType<T> type) {
|
||||
if (literal == null) {
|
||||
return (Field<T>) NULL();
|
||||
}
|
||||
else {
|
||||
return field(literal.toString(), type);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the null field
|
||||
*/
|
||||
@ -6457,17 +6336,6 @@ public class Factory implements FactoryOperations {
|
||||
return filterOne(selectFrom(table).limit(1).fetch());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public final <R extends TableRecord<R>> int executeInsert(Table<R> table, R record) {
|
||||
InsertQuery<R> insert = insertQuery(table);
|
||||
insert.setRecord(record);
|
||||
return insert.execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -6478,45 +6346,6 @@ public class Factory implements FactoryOperations {
|
||||
return insert.execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public final <R extends TableRecord<R>> int executeUpdate(Table<R> table, R record) {
|
||||
return executeUpdate(table, record, trueCondition());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public final <R extends TableRecord<R>, T> int executeUpdate(Table<R> table, R record, Condition condition) {
|
||||
UpdateQuery<R> update = updateQuery(table);
|
||||
update.addConditions(condition);
|
||||
update.setRecord(record);
|
||||
return update.execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public final <R extends TableRecord<R>> int executeUpdateOne(Table<R> table, R record) {
|
||||
return filterUpdateOne(executeUpdate(table, record));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public final <R extends TableRecord<R>, T> int executeUpdateOne(Table<R> table, R record, Condition condition) {
|
||||
return filterUpdateOne(executeUpdate(table, record, condition));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -6559,47 +6388,6 @@ public class Factory implements FactoryOperations {
|
||||
return delete.execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public final <R extends TableRecord<R>> int executeDelete(Table<R> table) {
|
||||
return executeDelete(table, trueCondition());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public final <R extends TableRecord<R>, T> int executeDelete(Table<R> table, Condition condition)
|
||||
throws DataAccessException{
|
||||
DeleteQuery<R> delete = deleteQuery(table);
|
||||
delete.addConditions(condition);
|
||||
return delete.execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public final <R extends TableRecord<R>> int executeDeleteOne(Table<R> table) {
|
||||
return executeDeleteOne(table, trueCondition());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public final <R extends TableRecord<R>, T> int executeDeleteOne(Table<R> table, Condition condition) {
|
||||
DeleteQuery<R> delete = deleteQuery(table);
|
||||
delete.addConditions(condition);
|
||||
return filterDeleteOne(delete.execute());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default data type for the {@link Factory}'s underlying
|
||||
* {@link SQLDialect} and a given Java type.
|
||||
@ -6634,14 +6422,6 @@ public class Factory implements FactoryOperations {
|
||||
// XXX Internals
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
private static int filterDeleteOne(int i) {
|
||||
return filterOne(i, "deleted");
|
||||
}
|
||||
|
||||
private static int filterUpdateOne(int i) {
|
||||
return filterOne(i, "updated");
|
||||
}
|
||||
|
||||
private static int filterOne(int i, String action) {
|
||||
if (i <= 1) {
|
||||
return i;
|
||||
|
||||
@ -1,714 +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.impl;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.math.BigInteger;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Savepoint;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.jooq.Attachable;
|
||||
import org.jooq.Batch;
|
||||
import org.jooq.BatchBindStep;
|
||||
import org.jooq.Condition;
|
||||
import org.jooq.Cursor;
|
||||
import org.jooq.DeleteQuery;
|
||||
import org.jooq.DeleteWhereStep;
|
||||
import org.jooq.FactoryOperations;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.Insert;
|
||||
import org.jooq.InsertQuery;
|
||||
import org.jooq.InsertSetStep;
|
||||
import org.jooq.InsertValuesStep;
|
||||
import org.jooq.LoaderOptionsStep;
|
||||
import org.jooq.MergeKeyStep;
|
||||
import org.jooq.MergeUsingStep;
|
||||
import org.jooq.Query;
|
||||
import org.jooq.QueryPart;
|
||||
import org.jooq.Record;
|
||||
import org.jooq.Result;
|
||||
import org.jooq.ResultQuery;
|
||||
import org.jooq.SQLDialect;
|
||||
import org.jooq.Schema;
|
||||
import org.jooq.Select;
|
||||
import org.jooq.SelectQuery;
|
||||
import org.jooq.SelectSelectStep;
|
||||
import org.jooq.Sequence;
|
||||
import org.jooq.SimpleSelectQuery;
|
||||
import org.jooq.SimpleSelectWhereStep;
|
||||
import org.jooq.Table;
|
||||
import org.jooq.TableLike;
|
||||
import org.jooq.TableRecord;
|
||||
import org.jooq.Truncate;
|
||||
import org.jooq.UDT;
|
||||
import org.jooq.UDTRecord;
|
||||
import org.jooq.UpdatableRecord;
|
||||
import org.jooq.UpdateQuery;
|
||||
import org.jooq.UpdateSetStep;
|
||||
import org.jooq.conf.Settings;
|
||||
import org.jooq.exception.DataAccessException;
|
||||
|
||||
/**
|
||||
* Thread safe proxy for {@link Factory}.
|
||||
* <p>
|
||||
* The <code>FactoryProxy</code> operates as a thread-safe proxy for jOOQ's
|
||||
* {@link Factory} objects. Instead of wrapping JDBC {@link Connection} objects,
|
||||
* the <code>FactoryProxy</code> wraps a transaction-aware {@link DataSource}
|
||||
* and creates a new <code>Factory</code> with a new <code>Connection</code>
|
||||
* every time you use any of the operations from {@link FactoryOperations}
|
||||
* <p>
|
||||
* Refer to the jOOQ manual to see possible operation modes for jOOQ with
|
||||
* Spring. Note that this implementation of a <code>FactoryProxy</code> might be
|
||||
* re-designed in jOOQ 3.0. Please consider this functionality as being
|
||||
* EXPERIMENTAL
|
||||
*
|
||||
* @author Sergey Epik
|
||||
* @author Lukas Eder
|
||||
* @deprecated - Use the newly {@link DataSource}-enabled {@link Factory}
|
||||
* constructors instead, e.g.
|
||||
* {@link Factory#Factory(DataSource, SQLDialect)} or
|
||||
* {@link Factory#Factory(DataSource, SQLDialect, Settings)}
|
||||
*/
|
||||
@Deprecated
|
||||
public final class FactoryProxy implements FactoryOperations {
|
||||
|
||||
/**
|
||||
* Generated UID
|
||||
*/
|
||||
private static final long serialVersionUID = -8475057043526340066L;
|
||||
|
||||
private transient DataSource dataSource;
|
||||
private SQLDialect dialect;
|
||||
private Settings settings;
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Injected configuration
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
public final void setDialect(SQLDialect dialect) {
|
||||
this.dialect = dialect;
|
||||
}
|
||||
|
||||
public final void setSettings(Settings settings) {
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setDataSource(DataSource dataSource) {
|
||||
this.dataSource = dataSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final DataSource getDataSource() {
|
||||
return this.dataSource;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Configuration API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final SQLDialect getDialect() {
|
||||
return dialect;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public final org.jooq.SchemaMapping getSchemaMapping() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Settings getSettings() {
|
||||
return settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Connection getConnection() {
|
||||
return getDelegate().getConnection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setConnection(Connection connection) {
|
||||
getDelegate().setConnection(connection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Map<String, Object> getData() {
|
||||
return getDelegate().getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Object getData(String key) {
|
||||
return getDelegate().getData(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Object setData(String key, Object value) {
|
||||
return getDelegate().setData(key, value);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX FactoryOperations API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final <R extends TableRecord<R>> LoaderOptionsStep<R> loadInto(Table<R> table) {
|
||||
return getDelegate().loadInto(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String render(QueryPart part) {
|
||||
return getDelegate().render(part);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String renderNamedParams(QueryPart part) {
|
||||
return getDelegate().renderNamedParams(part);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String renderInlined(QueryPart part) {
|
||||
return getDelegate().renderInlined(part);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void attach(Attachable... attachables) {
|
||||
getDelegate().attach(attachables);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void attach(Collection<Attachable> attachables) {
|
||||
getDelegate().attach(attachables);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Query query(String sql) {
|
||||
return getDelegate().query(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Query query(String sql, Object... bindings) {
|
||||
return getDelegate().query(sql, bindings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Query query(String sql, QueryPart... parts) {
|
||||
return getDelegate().query(sql, parts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends Record> SimpleSelectWhereStep<R> selectFrom(Table<R> table) {
|
||||
return getDelegate().selectFrom(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final SelectSelectStep select(Field<?>... fields) {
|
||||
return getDelegate().select(fields);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final SelectSelectStep selectZero() {
|
||||
return getDelegate().selectZero();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final SelectSelectStep selectOne() {
|
||||
return getDelegate().selectOne();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final SelectSelectStep selectCount() {
|
||||
return getDelegate().selectCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final SelectSelectStep selectDistinct(Field<?>... fields) {
|
||||
return getDelegate().selectDistinct(fields);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final SelectSelectStep select(Collection<? extends Field<?>> fields) {
|
||||
return getDelegate().select(fields);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final SelectSelectStep selectDistinct(Collection<? extends Field<?>> fields) {
|
||||
return getDelegate().selectDistinct(fields);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final SelectQuery selectQuery() {
|
||||
return getDelegate().selectQuery();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends Record> SimpleSelectQuery<R> selectQuery(TableLike<R> table) {
|
||||
return getDelegate().selectQuery(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends Record> InsertQuery<R> insertQuery(Table<R> into) {
|
||||
return getDelegate().insertQuery(into);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends Record> InsertSetStep<R> insertInto(Table<R> into) {
|
||||
return getDelegate().insertInto(into);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends Record> InsertValuesStep<R> insertInto(Table<R> into, Field<?>... fields) {
|
||||
return getDelegate().insertInto(into, fields);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends Record> InsertValuesStep<R> insertInto(Table<R> into, Collection<? extends Field<?>> fields) {
|
||||
return getDelegate().insertInto(into, fields);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public final <R extends Record> Insert<R> insertInto(Table<R> into, Select<?> select) {
|
||||
return getDelegate().insertInto(into, select);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends Record> UpdateQuery<R> updateQuery(Table<R> table) {
|
||||
return getDelegate().updateQuery(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends Record> UpdateSetStep<R> update(Table<R> table) {
|
||||
return getDelegate().update(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends Record> MergeUsingStep<R> mergeInto(Table<R> table) {
|
||||
return getDelegate().mergeInto(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends Record> MergeKeyStep<R> mergeInto(Table<R> table, Field<?>... fields) {
|
||||
return getDelegate().mergeInto(table, fields);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends Record> MergeKeyStep<R> mergeInto(Table<R> table, Collection<? extends Field<?>> fields) {
|
||||
return getDelegate().mergeInto(table, fields);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends Record> DeleteQuery<R> deleteQuery(Table<R> table) {
|
||||
return getDelegate().deleteQuery(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends Record> DeleteWhereStep<R> delete(Table<R> table) {
|
||||
return getDelegate().delete(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Batch batch(Query... queries) {
|
||||
return getDelegate().batch(queries);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Batch batch(Collection<? extends Query> queries) {
|
||||
return getDelegate().batch(queries);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final BatchBindStep batch(Query query) {
|
||||
return getDelegate().batch(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Batch batchStore(UpdatableRecord<?>... records) {
|
||||
return getDelegate().batchStore(records);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Batch batchStore(Collection<? extends UpdatableRecord<?>> records) {
|
||||
return getDelegate().batchStore(records);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends Record> Truncate<R> truncate(Table<R> table) {
|
||||
return getDelegate().truncate(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends UDTRecord<R>> R newRecord(UDT<R> type) {
|
||||
return getDelegate().newRecord(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends TableRecord<R>> R newRecord(Table<R> table) {
|
||||
return getDelegate().newRecord(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends TableRecord<R>> R newRecord(Table<R> table, Object source) {
|
||||
return getDelegate().newRecord(table, source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Result<Record> fetch(ResultSet rs) {
|
||||
return getDelegate().fetch(rs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Cursor<Record> fetchLazy(ResultSet rs) {
|
||||
return getDelegate().fetchLazy(rs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Result<Record> fetchFromCSV(String string) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Result<Record> fetchFromCSV(String string, char delimiter) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Result<Record> fetch(String sql) {
|
||||
return getDelegate().fetch(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Result<Record> fetch(String sql, Object... bindings) {
|
||||
return getDelegate().fetch(sql, bindings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Result<Record> fetch(String sql, QueryPart... parts) {
|
||||
return getDelegate().fetch(sql, parts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Cursor<Record> fetchLazy(String sql) {
|
||||
return getDelegate().fetchLazy(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Cursor<Record> fetchLazy(String sql, Object... bindings) {
|
||||
return getDelegate().fetchLazy(sql, bindings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Cursor<Record> fetchLazy(String sql, QueryPart... parts) {
|
||||
return getDelegate().fetchLazy(sql, parts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final List<Result<Record>> fetchMany(String sql) {
|
||||
return getDelegate().fetchMany(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final List<Result<Record>> fetchMany(String sql, Object... bindings) {
|
||||
return getDelegate().fetchMany(sql, bindings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final List<Result<Record>> fetchMany(String sql, QueryPart... parts) {
|
||||
return getDelegate().fetchMany(sql, parts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Record fetchOne(String sql) {
|
||||
return getDelegate().fetchOne(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Record fetchOne(String sql, Object... bindings) {
|
||||
return getDelegate().fetchOne(sql, bindings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Record fetchOne(String sql, QueryPart... parts) {
|
||||
return getDelegate().fetchOne(sql, parts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int execute(String sql) {
|
||||
return getDelegate().execute(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int execute(String sql, Object... bindings) {
|
||||
return getDelegate().execute(sql, bindings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int execute(String sql, QueryPart... parts) {
|
||||
return getDelegate().execute(sql, parts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final ResultQuery<Record> resultQuery(String sql) {
|
||||
return getDelegate().resultQuery(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final ResultQuery<Record> resultQuery(String sql, Object... bindings) {
|
||||
return getDelegate().resultQuery(sql, bindings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final ResultQuery<Record> resultQuery(String sql, QueryPart... parts) {
|
||||
return getDelegate().resultQuery(sql, parts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final BigInteger lastID() {
|
||||
return getDelegate().lastID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <T extends Number> T nextval(Sequence<T> sequence) {
|
||||
return getDelegate().nextval(sequence);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <T extends Number> T currval(Sequence<T> sequence) {
|
||||
return getDelegate().currval(sequence);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int use(Schema schema) {
|
||||
return getDelegate().use(schema);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int use(String schema) {
|
||||
return getDelegate().use(schema);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends Record> Result<R> fetch(Table<R> table) {
|
||||
return getDelegate().fetch(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends Record> Result<R> fetch(Table<R> table, Condition condition) {
|
||||
return getDelegate().fetch(table, condition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends Record> R fetchOne(Table<R> table) {
|
||||
return getDelegate().fetchOne(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends Record> R fetchOne(Table<R> table, Condition condition) {
|
||||
return getDelegate().fetchOne(table, condition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends Record> R fetchAny(Table<R> table) {
|
||||
return getDelegate().fetchAny(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public final <R extends TableRecord<R>> int executeInsert(Table<R> table, R record) {
|
||||
return getDelegate().executeInsert(table, record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends TableRecord<R>> int executeInsert(R record) {
|
||||
return getDelegate().executeInsert(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public final <R extends TableRecord<R>> int executeUpdate(Table<R> table, R record) {
|
||||
return getDelegate().executeUpdate(table, record);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public final <R extends TableRecord<R>, T> int executeUpdate(Table<R> table, R record, Condition condition) {
|
||||
return getDelegate().executeUpdate(table, record, condition);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public final <R extends TableRecord<R>> int executeUpdateOne(Table<R> table, R record) {
|
||||
return getDelegate().executeUpdateOne(table, record);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public final <R extends TableRecord<R>, T> int executeUpdateOne(Table<R> table, R record, Condition condition) {
|
||||
return getDelegate().executeUpdateOne(table, record, condition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends UpdatableRecord<R>> int executeUpdate(R record) {
|
||||
return getDelegate().executeUpdate(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends TableRecord<R>, T> int executeUpdate(R record, Condition condition) {
|
||||
return getDelegate().executeUpdate(record, condition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends UpdatableRecord<R>> int executeDelete(R record) {
|
||||
return getDelegate().executeDelete(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends TableRecord<R>, T> int executeDelete(R record, Condition condition) {
|
||||
return getDelegate().executeDelete(record, condition);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public final <R extends TableRecord<R>> int executeDelete(Table<R> table) {
|
||||
return getDelegate().executeDelete(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public final <R extends TableRecord<R>, T> int executeDelete(Table<R> table, Condition condition) {
|
||||
return getDelegate().executeDelete(table, condition);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public final <R extends TableRecord<R>> int executeDeleteOne(Table<R> table) {
|
||||
return getDelegate().executeDeleteOne(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public final <R extends TableRecord<R>, T> int executeDeleteOne(Table<R> table, Condition condition) {
|
||||
return getDelegate().executeDeleteOne(table, condition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getTransactionIsolation() {
|
||||
return getDelegate().getTransactionIsolation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setTransactionIsolation(int level) {
|
||||
getDelegate().setTransactionIsolation(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getHoldability() {
|
||||
return getDelegate().getHoldability();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setHoldability(int holdability) {
|
||||
getDelegate().setHoldability(holdability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean getAutoCommit() {
|
||||
return getDelegate().getAutoCommit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setAutoCommit(boolean autoCommit) {
|
||||
getDelegate().setAutoCommit(autoCommit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void releaseSavepoint(Savepoint savepoint) {
|
||||
getDelegate().releaseSavepoint(savepoint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Savepoint setSavepoint(String name) {
|
||||
return getDelegate().setSavepoint(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Savepoint setSavepoint() {
|
||||
return getDelegate().setSavepoint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void rollback(Savepoint savepoint) {
|
||||
getDelegate().rollback(savepoint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void rollback() {
|
||||
getDelegate().rollback();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void commit() {
|
||||
getDelegate().commit();
|
||||
}
|
||||
|
||||
private FactoryOperations getDelegate() {
|
||||
if (dataSource == null || dialect == null) {
|
||||
throw new DataAccessException("Both dataSource and dialect properties should be set");
|
||||
}
|
||||
try {
|
||||
Class<? extends Factory> clazz = getDialect().getFactory();
|
||||
Connection con = getDataSource().getConnection();
|
||||
|
||||
Constructor<? extends Factory> constructor;
|
||||
if (settings == null) {
|
||||
constructor = clazz.getConstructor(Connection.class);
|
||||
return constructor.newInstance(con);
|
||||
} else {
|
||||
constructor = clazz.getConstructor(Connection.class, Settings.class);
|
||||
return constructor.newInstance(con, settings);
|
||||
}
|
||||
} catch (Exception exc) {
|
||||
throw new DataAccessException("Failed to create jOOQ Factory", exc);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -62,7 +62,6 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.jooq.ArrayRecord;
|
||||
@ -72,7 +71,6 @@ import org.jooq.DataType;
|
||||
import org.jooq.EnumType;
|
||||
import org.jooq.ExecuteContext;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.MasterDataType;
|
||||
import org.jooq.Result;
|
||||
import org.jooq.SQLDialect;
|
||||
import org.jooq.UDTRecord;
|
||||
@ -108,7 +106,6 @@ import org.jooq.util.sybase.SybaseDataType;
|
||||
*
|
||||
* @author Lukas Eder
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public final class FieldTypeHelper {
|
||||
|
||||
private static final int LONG_PRECISION = String.valueOf(Long.MAX_VALUE).length();
|
||||
@ -223,9 +220,6 @@ public final class FieldTypeHelper {
|
||||
else if (EnumType.class.isAssignableFrom(type)) {
|
||||
return getEnumType(type, stream.readString());
|
||||
}
|
||||
else if (MasterDataType.class.isAssignableFrom(type)) {
|
||||
return (T) getMasterDataType(type, stream.readObject());
|
||||
}
|
||||
else if (UDTRecord.class.isAssignableFrom(type)) {
|
||||
return (T) stream.readObject();
|
||||
}
|
||||
@ -359,10 +353,6 @@ public final class FieldTypeHelper {
|
||||
else if (EnumType.class.isAssignableFrom(type)) {
|
||||
stream.writeString(((EnumType) value).getLiteral());
|
||||
}
|
||||
else if (MasterDataType.class.isAssignableFrom(type)) {
|
||||
Object key = ((MasterDataType<?>) value).getPrimaryKey();
|
||||
writeToSQLOutput(stream, key.getClass(), key);
|
||||
}
|
||||
else if (UDTRecord.class.isAssignableFrom(type)) {
|
||||
stream.writeObject((UDTRecord<?>) value);
|
||||
}
|
||||
@ -371,14 +361,6 @@ public final class FieldTypeHelper {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated - 2.3.0 - Do not reuse this method
|
||||
*/
|
||||
@Deprecated
|
||||
public static <T> void writeToSQLOutput(SQLOutput stream, Class<? extends T> type, T value) throws SQLException {
|
||||
writeToSQLOutput(stream, type, null, value);
|
||||
}
|
||||
|
||||
static <T, U> U getFromResultSet(ExecuteContext ctx, Field<U> field, int index)
|
||||
throws SQLException {
|
||||
|
||||
@ -516,9 +498,6 @@ public final class FieldTypeHelper {
|
||||
else if (EnumType.class.isAssignableFrom(type)) {
|
||||
return getEnumType(type, rs.getString(index));
|
||||
}
|
||||
else if (MasterDataType.class.isAssignableFrom(type)) {
|
||||
return (T) getMasterDataType(type, rs.getObject(index));
|
||||
}
|
||||
else if (UDTRecord.class.isAssignableFrom(type)) {
|
||||
switch (ctx.getDialect()) {
|
||||
case POSTGRES:
|
||||
@ -671,18 +650,6 @@ public final class FieldTypeHelper {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated - 2.3.0 - Do not reuse this method
|
||||
*/
|
||||
@Deprecated
|
||||
public static Map<String, Class<?>> getTypeMapping(Class<?> udtType) throws SQLException {
|
||||
try {
|
||||
return ((UDTRecord<?>) udtType.newInstance()).getUDT().getTypeMapping();
|
||||
} catch (Exception e) {
|
||||
throw new SQLException("Cannot retrieve type mapping for " + udtType, e);
|
||||
}
|
||||
}
|
||||
|
||||
private static <T> T checkWasNull(SQLInput stream, T value) throws SQLException {
|
||||
return stream.wasNull() ? null : value;
|
||||
}
|
||||
@ -715,26 +682,6 @@ public final class FieldTypeHelper {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
static MasterDataType<?> getMasterDataType(Class<?> type, Object primaryKey) throws SQLException {
|
||||
try {
|
||||
Object[] values = (Object[]) type.getMethod("values").invoke(type);
|
||||
|
||||
for (Object value : values) {
|
||||
MasterDataType<?> result = (MasterDataType<?>) value;
|
||||
|
||||
if (String.valueOf(primaryKey).equals(String.valueOf(result.getPrimaryKey()))) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new SQLException("Unknown enum literal found : " + primaryKey);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T getFromStatement(ExecuteContext ctx, Class<? extends T> type, int index) throws SQLException {
|
||||
CallableStatement stmt = (CallableStatement) ctx.statement();
|
||||
@ -835,9 +782,6 @@ public final class FieldTypeHelper {
|
||||
else if (EnumType.class.isAssignableFrom(type)) {
|
||||
return getEnumType(type, stmt.getString(index));
|
||||
}
|
||||
else if (MasterDataType.class.isAssignableFrom(type)) {
|
||||
return (T) getMasterDataType(type, stmt.getString(index));
|
||||
}
|
||||
else if (UDTRecord.class.isAssignableFrom(type)) {
|
||||
switch (ctx.getDialect()) {
|
||||
case POSTGRES:
|
||||
@ -1063,9 +1007,6 @@ public final class FieldTypeHelper {
|
||||
else if (EnumType.class.isAssignableFrom(type)) {
|
||||
return getEnumType(type, string);
|
||||
}
|
||||
else if (MasterDataType.class.isAssignableFrom(type)) {
|
||||
return (T) getMasterDataType(type, string);
|
||||
}
|
||||
else if (UDTRecord.class.isAssignableFrom(type)) {
|
||||
return (T) pgNewUDTRecord(type, string);
|
||||
}
|
||||
|
||||
@ -35,13 +35,10 @@
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jooq.BindContext;
|
||||
import org.jooq.DataType;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.QueryPart;
|
||||
import org.jooq.Record;
|
||||
import org.jooq.RenderContext;
|
||||
@ -86,24 +83,6 @@ public class UDTImpl<R extends UDTRecord<R>> extends AbstractFieldProviderQueryP
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public final synchronized Map<String, Class<?>> getTypeMapping() throws SQLException {
|
||||
if (typeMapping == null) {
|
||||
typeMapping = new HashMap<String, Class<?>>();
|
||||
typeMapping.put(getName(), getRecordType());
|
||||
|
||||
// Recursively add nested UDT types
|
||||
for (Field<?> field : getFieldList()) {
|
||||
if (UDTRecord.class.isAssignableFrom(field.getType())) {
|
||||
typeMapping.putAll(FieldTypeHelper.getTypeMapping(field.getType()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return typeMapping;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final DataType<R> getDataType() {
|
||||
if (type == null) {
|
||||
|
||||
@ -141,14 +141,13 @@ class Val<T> extends AbstractField<T> implements Param<T> {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private boolean shouldCast(RenderContext context) {
|
||||
|
||||
// In default mode, casting is only done when parameters are NOT inlined
|
||||
if (!isInline(context)) {
|
||||
|
||||
// Generated enums should not be cast...
|
||||
if (!(getValue() instanceof EnumType) && !(getValue() instanceof org.jooq.MasterDataType)) {
|
||||
if (!(getValue() instanceof EnumType)) {
|
||||
switch (context.getDialect()) {
|
||||
|
||||
// These dialects can hardly detect the type of a bound constant.
|
||||
@ -324,7 +323,7 @@ class Val<T> extends AbstractField<T> implements Param<T> {
|
||||
/**
|
||||
* Inlining abstraction
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked", "rawtypes", "deprecation" })
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
private void toSQL(RenderContext context, Object val, Class<?> type) {
|
||||
SQLDialect dialect = context.getDialect();
|
||||
|
||||
@ -486,9 +485,6 @@ class Val<T> extends AbstractField<T> implements Param<T> {
|
||||
else if (EnumType.class.isAssignableFrom(type)) {
|
||||
toSQL(context, ((EnumType) val).getLiteral());
|
||||
}
|
||||
else if (org.jooq.MasterDataType.class.isAssignableFrom(type)) {
|
||||
toSQL(context, ((org.jooq.MasterDataType<?>) val).getPrimaryKey());
|
||||
}
|
||||
else if (UDTRecord.class.isAssignableFrom(type)) {
|
||||
context.sql("[UDT]");
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user