[#1869] Deprecate org.jooq.NamedQueryPart

This commit is contained in:
Lukas Eder 2012-10-19 19:48:58 +02:00
parent ae6b547870
commit aa471b6285
17 changed files with 107 additions and 42 deletions

View File

@ -447,6 +447,7 @@ public abstract class AbstractDatabase implements Database {
String literals = enumType.getLiterals();
try {
@SuppressWarnings("resource")
CSVReader reader = new CSVReader(new StringReader(literals));
e.addLiterals(reader.readNext());
} catch (IOException ignore) {}

View File

@ -68,6 +68,7 @@ import org.joox.Match;
*
* @author Lukas Eder
*/
@SuppressWarnings("resource")
public class Transform {
private static final FopFactory fopFactory = FopFactory.newInstance();
private static final String version = "2.6";

View File

@ -42,7 +42,11 @@ package org.jooq;
* order.
*
* @author Lukas Eder
* @deprecated - 2.6.0 [#1869] - This marker interface does not have enough
* momentum to be exposed in the public API. It will be removed in
* the future.
*/
@Deprecated
public interface NamedQueryPart extends QueryPart, Comparable<NamedQueryPart> {
/**

View File

@ -51,4 +51,10 @@ public interface Package extends NamedQueryPart, org.jooq.SchemaProvider {
@Override
Schema getSchema();
/**
* The name of this package
*/
@Override
String getName();
}

View File

@ -47,6 +47,12 @@ import static org.jooq.SQLDialect.ORACLE;
@SuppressWarnings("deprecation")
public interface Parameter<T> extends NamedTypeProviderQueryPart<T> {
/**
* The name of this parameter
*/
@Override
String getName();
/**
* The Java type of the parameter.
*/

View File

@ -91,6 +91,12 @@ public interface Routine<T> extends NamedQueryPart, org.jooq.SchemaProvider {
@Override
Schema getSchema();
/**
* The name of this routine
*/
@Override
String getName();
/**
* The container package of this stored procedure or function.
* <p>

View File

@ -45,8 +45,15 @@ import java.util.Map;
*
* @author Lukas Eder
*/
@SuppressWarnings("deprecation")
public interface Schema extends NamedQueryPart {
/**
* The name of this schema
*/
@Override
String getName();
/**
* The complete type mapping for this schema.
* <p>

View File

@ -46,6 +46,12 @@ package org.jooq;
@SuppressWarnings("deprecation")
public interface SortField<T> extends NamedTypeProviderQueryPart<T> {
/**
* The name of this sort field
*/
@Override
String getName();
/**
* Get the underlying sort order of this sort field
*/

View File

@ -57,7 +57,7 @@ import org.jooq.impl.Factory;
/**
* A table to be used in queries
*
*
* @param <R> The record type associated with this table
* @author Lukas Eder
*/
@ -70,6 +70,12 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
@Override
Schema getSchema();
/**
* The name of this table
*/
@Override
String getName();
/**
* @return The record type produced by this table
*/
@ -78,7 +84,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
/**
* Create an alias for this table
*
*
* @param alias The alias name
* @return The table alias
*/
@ -101,7 +107,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* <p>
* Note: Unfortunately, this is not supported in the Oracle dialect, where
* identities simulated by triggers cannot be formally detected.
*
*
* @return The table's <code>IDENTITY</code> information, or
* <code>null</code>, if no such information is available.
*/
@ -109,7 +115,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
/**
* Get the list of <code>FOREIGN KEY</code>'s of this table
*
*
* @return This table's <code>FOREIGN KEY</code>'s. This is never
* <code>null</code>.
*/
@ -118,7 +124,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
/**
* Get a list of <code>FOREIGN KEY</code>'s of this table, referencing a
* specific table.
*
*
* @param <O> The other table's record type
* @param other The other table of the foreign key relationship
* @return This table's <code>FOREIGN KEY</code>'s towards an other table.
@ -137,7 +143,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* <li>Other dialects by using some means of simulation (not yet officially
* supported)</li>
* </ul>
*
*
* @param aggregateFunctions The aggregate functions used for pivoting.
* @return A DSL object to create the <code>PIVOT</code> expression
*/
@ -149,7 +155,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* into another form
* <p>
* For more details, see {@link #pivot(Field...)}
*
*
* @param aggregateFunctions The aggregate functions used for pivoting.
* @return A DSL object to create the <code>PIVOT</code> expression
* @see #pivot(Field...)
@ -166,7 +172,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* <code><pre>
* Assume the following cross join / cartesian product
* C = A × B
*
*
* Then it can be said that
* A = C ÷ B
* B = C ÷ A
@ -237,7 +243,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String)
*/
@Support
@ -250,7 +256,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String, Object...)
*/
@Support
@ -263,7 +269,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String, QueryPart...)
*/
@Support
@ -282,7 +288,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String)
*/
@Support
@ -295,7 +301,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String, Object...)
*/
@Support
@ -308,7 +314,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String, QueryPart...)
*/
@Support
@ -331,7 +337,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String)
*/
@Support({ ASE, CUBRID, DB2, DERBY, FIREBIRD, H2, HSQLDB, INGRES, MYSQL, ORACLE, POSTGRES, SQLSERVER, SYBASE })
@ -346,7 +352,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String, Object...)
*/
@Support({ ASE, CUBRID, DB2, DERBY, FIREBIRD, H2, HSQLDB, INGRES, MYSQL, ORACLE, POSTGRES, SQLSERVER, SYBASE })
@ -361,7 +367,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String, QueryPart...)
*/
@Support({ ASE, CUBRID, DB2, DERBY, FIREBIRD, H2, HSQLDB, INGRES, MYSQL, ORACLE, POSTGRES, SQLSERVER, SYBASE })
@ -384,7 +390,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String)
*/
@Support({ DB2, FIREBIRD, HSQLDB, INGRES, ORACLE, POSTGRES, SQLSERVER, SYBASE })
@ -399,7 +405,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String, Object...)
*/
@Support({ DB2, FIREBIRD, HSQLDB, INGRES, ORACLE, POSTGRES, SQLSERVER, SYBASE })
@ -414,7 +420,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String, QueryPart...)
*/
@Support({ DB2, FIREBIRD, HSQLDB, INGRES, ORACLE, POSTGRES, SQLSERVER, SYBASE })
@ -447,7 +453,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String)
*/
@Support
@ -467,7 +473,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String, Object...)
*/
@Support
@ -487,7 +493,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String, QueryPart...)
*/
@Support
@ -512,7 +518,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String)
*/
@Support
@ -528,7 +534,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String, Object...)
*/
@Support
@ -544,7 +550,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String, QueryPart...)
*/
@Support
@ -569,7 +575,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String)
*/
@Support
@ -585,7 +591,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String, Object...)
*/
@Support
@ -601,7 +607,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String, QueryPart...)
*/
@Support
@ -626,7 +632,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String)
*/
@Support({ ASE, CUBRID, DB2, DERBY, FIREBIRD, H2, HSQLDB, INGRES, MYSQL, ORACLE, POSTGRES, SQLSERVER, SYBASE })
@ -642,7 +648,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String, Object...)
*/
@Support({ ASE, CUBRID, DB2, DERBY, FIREBIRD, H2, HSQLDB, INGRES, MYSQL, ORACLE, POSTGRES, SQLSERVER, SYBASE })
@ -658,7 +664,7 @@ public interface Table<R extends Record> extends org.jooq.Type<R>, AliasProvider
* 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!
*
*
* @see Factory#table(String, QueryPart...)
*/
@Support({ ASE, CUBRID, DB2, DERBY, FIREBIRD, H2, HSQLDB, INGRES, MYSQL, ORACLE, POSTGRES, SQLSERVER, SYBASE })

View File

@ -54,6 +54,12 @@ public interface UDT<R extends UDTRecord<R>> extends org.jooq.Type<R> {
@Override
Schema getSchema();
/**
* The name of this UDT
*/
@Override
String getName();
/**
* @return The record type produced by this table
*/

View File

@ -61,6 +61,7 @@ public final class SettingsTools {
if (property != null) {
// Check classpath first
@SuppressWarnings("resource")
InputStream in = SettingsTools.class.getResourceAsStream(property);
if (in != null) {
settings = JAXB.unmarshal(in, Settings.class);
@ -71,6 +72,7 @@ public final class SettingsTools {
}
if (settings == null) {
@SuppressWarnings("resource")
InputStream in = SettingsTools.class.getResourceAsStream("/jooq-settings.xml");
if (in != null) {

View File

@ -41,6 +41,7 @@ import org.jooq.NamedQueryPart;
/**
* @author Lukas Eder
*/
@SuppressWarnings("deprecation")
abstract class AbstractNamedQueryPart extends AbstractQueryPart implements NamedQueryPart {
private static final long serialVersionUID = -4496974591205380167L;

View File

@ -254,7 +254,7 @@ implements
if (!forUpdateOf.isEmpty()) {
context.keyword(" of ");
Util.toSQLNames(context, forUpdateOf);
Util.fieldNames(context, forUpdateOf);
}
else if (!forUpdateOfTables.isEmpty()) {
context.keyword(" of ");
@ -273,7 +273,7 @@ implements
// Render the OF [table-names] clause
default:
Util.toSQLNames(context, forUpdateOfTables);
Util.tableNames(context, forUpdateOfTables);
break;
}
}

View File

@ -113,7 +113,7 @@ class AliasProviderImpl<T extends AliasProvider<T>> extends AbstractNamedQueryPa
ArrayTable table = (ArrayTable) o;
context.sql("(");
Util.toSQLNames(context, table.getFields());
Util.fieldNames(context, table.getFields());
context.sql(")");
}

View File

@ -211,7 +211,7 @@ class JoinTable extends AbstractTable<Record> implements TableOptionalOnStep, Ta
// Native supporters of JOIN .. USING
else {
context.keyword(" using (");
Util.toSQLNames(context, using);
Util.fieldNames(context, using);
context.sql(")");
}
}

View File

@ -548,12 +548,12 @@ implements
.formatSeparator();
context.sql("(");
Util.toSQLNames(context, getH2Fields());
Util.fieldNames(context, getH2Fields());
context.sql(")");
if (!getH2Keys().isEmpty()) {
context.keyword(" key (");
Util.toSQLNames(context, getH2Keys());
Util.fieldNames(context, getH2Keys());
context.sql(")");
}

View File

@ -72,7 +72,6 @@ import org.jooq.ExecuteContext;
import org.jooq.ExecuteListener;
import org.jooq.Field;
import org.jooq.FieldProvider;
import org.jooq.NamedQueryPart;
import org.jooq.Param;
import org.jooq.QueryPart;
import org.jooq.Record;
@ -553,11 +552,25 @@ final class Util {
* Render a list of names of the <code>NamedQueryParts</code> contained in
* this list.
*/
static final void toSQLNames(RenderContext context, Collection<? extends NamedQueryPart> list) {
static final void fieldNames(RenderContext context, Collection<? extends Field<?>> list) {
String separator = "";
for (NamedQueryPart part : list) {
context.sql(separator).literal(part.getName());
for (Field<?> field : list) {
context.sql(separator).literal(field.getName());
separator = ", ";
}
}
/**
* Render a list of names of the <code>NamedQueryParts</code> contained in
* this list.
*/
static final void tableNames(RenderContext context, Collection<? extends Table<?>> list) {
String separator = "";
for (Table<?> table : list) {
context.sql(separator).literal(table.getName());
separator = ", ";
}