You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by mb...@apache.org on 2007/11/04 22:07:53 UTC
svn commit: r591836 - in /db/jdo/trunk:
api2-legacy/src/java/javax/jdo/Query.java api2/src/java/javax/jdo/Query.java
tck2-legacy/src/conf/jdo-2_1-signatures.txt
tck2/src/conf/jdo-2_1-signatures.txt
Author: mbo
Date: Sun Nov 4 13:07:52 2007
New Revision: 591836
URL: http://svn.apache.org/viewvc?rev=591836&view=rev
Log:
JDO-446: Add subqueries APIs (adding methods supporting subquery parameters)
Modified:
db/jdo/trunk/api2-legacy/src/java/javax/jdo/Query.java
db/jdo/trunk/api2/src/java/javax/jdo/Query.java
db/jdo/trunk/tck2-legacy/src/conf/jdo-2_1-signatures.txt
db/jdo/trunk/tck2/src/conf/jdo-2_1-signatures.txt
Modified: db/jdo/trunk/api2-legacy/src/java/javax/jdo/Query.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2-legacy/src/java/javax/jdo/Query.java?rev=591836&r1=591835&r2=591836&view=diff
==============================================================================
--- db/jdo/trunk/api2-legacy/src/java/javax/jdo/Query.java (original)
+++ db/jdo/trunk/api2-legacy/src/java/javax/jdo/Query.java Sun Nov 4 13:07:52 2007
@@ -586,30 +586,103 @@
/**
* Add a subquery to this query.
- * The query parameter instance is unmodified as a result of the
- * addSubquery or subsequent execution of the outer query.
- * Only some of the query parts are copied for use as the subquery.
- * The parts copied include the candidate class, filter, parameter
- * declarations, variable declarations, imports, ordering specification,
+ * @param sub the subquery to add to this Query
+ * @param variableDeclaration the name of the variable in the outer query
+ * to bind the results of the subquery
+ * @param candidateCollectionExpression the candidate collection
+ * of the subquery as an expression using terms of the outer query
+ * @see #addSubquery(Query sub, String variableDeclaration,
+ * String candidateCollectionExpression, String[] parameters)
+ * @since 2.1
+ */
+ void addSubquery
+ (Query sub, String variableDeclaration,
+ String candidateCollectionExpression);
+
+ /**
+ * Add a subquery to this query.
+ * The String version of the method binds the named expression
+ * to the parameter implictly or explicitly declared in the
+ * subquery.
+ * @param sub the subquery to add to this Query
+ * @param variableDeclaration the name of the variable
+ * to be used in this Query
+ * @param candidateCollectionExpression the candidate collection
+ * to apply to the subquery
+ * @param parameter the expression from the outer query to bind
+ * the parameter in the subquery
+ * @see #addSubquery(Query sub, String variableDeclaration,
+ * String candidateCollectionExpression, String[] parameters)
+ * @since 2.1
+ */
+ void addSubquery
+ (Query sub, String variableDeclaration,
+ String candidateCollectionExpression, String parameter);
+
+ /**
+ * Add a subquery to this query.
+ * A subquery is composed as a Query and subsequently attached
+ * to a different query (the outer query) by calling this method.
+ * The query parameter instance is unmodified as a result of the
+ * addSubquery or subsequent execution of the outer query.
+ * Only some of the query parts are copied for use as the subquery.
+ * The parts copied include the candidate class, filter, parameter
+ * declarations, variable declarations, imports, ordering specification,
* uniqueness, result specification, and grouping specification.
- * The association with a PersistenceManager, the candidate collection,
- * result class, limits on size, and number of skipped instances
- * are not used.
- * The variableDeclaration is the name of the variable containing
- * the results of the subquery execution. This variable may be used
- * in this query.
- * The candidateCollectionExpression is the expression using tokens
- * from this query that represent the candidates over which the
- * subquery is evaluated.
+ * The association with a PersistenceManager, the candidate collection
+ * or extent, result class, and range limits are not used.
+ * The String parameters are trimmed of white space.
+ * The variableDeclaration parameter is the name of the variable
+ * containing the results of the subquery execution. If the same value
+ * of variableDeclaration is used to add multiple subqueries, the
+ * subquery replaces the previous subquery for the same named variable.
+ * If the subquery parameter is null, the variable is unset,
+ * effectively making the variable named in the variableDeclaration
+ * unbound. If the trimmed value is the empty String, or the parameter
+ * is null, then JDOUserException is thrown.
+ * The candidateCollectionExpression is the expression from the
+ * outer query that represents the candidates over which the subquery
+ * is evaluated. If the trimmed value is the empty String, or the
+ * parameter is null, then the candidate collection is the extent
+ * of the candidate class.
+ * The String[] version of the method binds the named expressions in
+ * turn to parameters in the order in which they are declared in the
+ * subquery, or in the order they are found in the filter if not
+ * explicitly declared in the subquery.
+ * @param sub the subquery to add to this Query
+ * @param variableDeclaration the name of the variable in the outer query
+ * to bind the results of the subquery
+ * @param candidateCollectionExpression the candidate collection
+ * of the subquery as an expression using terms of the outer query
+ * @param parameters the expressions from the outer query to bind
+ * the parameters in the subquery
+ * @since 2.1
+ */
+ void addSubquery
+ (Query sub, String variableDeclaration,
+ String candidateCollectionExpression, String[] parameters);
+
+ /**
+ * Add a subquery to this query.
+ * The Map version of the method treats the key of each map entry as
+ * the name of the parameter in the subquery, with or without the
+ * leading ":", and the value as the name of the expression in the
+ * outer query. If the trimmed expression is the empty String for
+ * either the parameter or the value of the String[], or for any
+ * map key or value, that expression is ignored.
* @param sub the subquery to add to this Query
* @param variableDeclaration the name of the variable
* to be used in this Query
* @param candidateCollectionExpression the candidate collection
* to apply to the subquery
+ * @param parameters the expressions from the outer query to bind
+ * the parameter in the subquery
+ * @see #addSubquery(Query sub, String variableDeclaration,
+ * String candidateCollectionExpression, String[] parameters)
* @since 2.1
*/
void addSubquery
(Query sub, String variableDeclaration,
- String candidateCollectionExpression);
+ String candidateCollectionExpression, Map parameters);
}
Modified: db/jdo/trunk/api2/src/java/javax/jdo/Query.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/src/java/javax/jdo/Query.java?rev=591836&r1=591835&r2=591836&view=diff
==============================================================================
--- db/jdo/trunk/api2/src/java/javax/jdo/Query.java (original)
+++ db/jdo/trunk/api2/src/java/javax/jdo/Query.java Sun Nov 4 13:07:52 2007
@@ -586,6 +586,41 @@
/**
* Add a subquery to this query.
+ * @param sub the subquery to add to this Query
+ * @param variableDeclaration the name of the variable in the outer query
+ * to bind the results of the subquery
+ * @param candidateCollectionExpression the candidate collection
+ * of the subquery as an expression using terms of the outer query
+ * @see #addSubquery(Query sub, String variableDeclaration,
+ * String candidateCollectionExpression, String... parameters)
+ * @since 2.1
+ */
+ void addSubquery
+ (Query sub, String variableDeclaration,
+ String candidateCollectionExpression);
+
+ /**
+ * Add a subquery to this query.
+ * The String version of the method binds the named expression
+ * to the parameter implictly or explicitly declared in the
+ * subquery.
+ * @param sub the subquery to add to this Query
+ * @param variableDeclaration the name of the variable
+ * to be used in this Query
+ * @param candidateCollectionExpression the candidate collection
+ * to apply to the subquery
+ * @param parameter the expression from the outer query to bind
+ * the parameter in the subquery
+ * @see #addSubquery(Query sub, String variableDeclaration,
+ * String candidateCollectionExpression, String... parameters)
+ * @since 2.1
+ */
+ void addSubquery
+ (Query sub, String variableDeclaration,
+ String candidateCollectionExpression, String parameter);
+
+ /**
+ * Add a subquery to this query.
* A subquery is composed as a Query and subsequently attached
* to a different query (the outer query) by calling this method.
* The query parameter instance is unmodified as a result of the
@@ -609,16 +644,45 @@
* outer query that represents the candidates over which the subquery
* is evaluated. If the trimmed value is the empty String, or the
* parameter is null, then the candidate collection is the extent
- * of the candidate class.
+ * of the candidate class.
+ * The String... version of the method binds the named expressions in
+ * turn to parameters in the order in which they are declared in the
+ * subquery, or in the order they are found in the filter if not
+ * explicitly declared in the subquery.
* @param sub the subquery to add to this Query
* @param variableDeclaration the name of the variable in the outer query
* to bind the results of the subquery
* @param candidateCollectionExpression the candidate collection
* of the subquery as an expression using terms of the outer query
+ * @param parameters the expressions from the outer query to bind
+ * the parameters in the subquery
* @since 2.1
*/
void addSubquery
(Query sub, String variableDeclaration,
- String candidateCollectionExpression);
+ String candidateCollectionExpression, String... parameters);
+
+ /**
+ * Add a subquery to this query.
+ * The Map version of the method treats the key of each map entry as
+ * the name of the parameter in the subquery, with or without the
+ * leading ":", and the value as the name of the expression in the
+ * outer query. If the trimmed expression is the empty String for
+ * either the parameter or the value of the String[], or for any
+ * map key or value, that expression is ignored.
+ * @param sub the subquery to add to this Query
+ * @param variableDeclaration the name of the variable
+ * to be used in this Query
+ * @param candidateCollectionExpression the candidate collection
+ * to apply to the subquery
+ * @param parameters the expressions from the outer query to bind
+ * the parameter in the subquery
+ * @see #addSubquery(Query sub, String variableDeclaration,
+ * String candidateCollectionExpression, String... parameters)
+ * @since 2.1
+ */
+ void addSubquery
+ (Query sub, String variableDeclaration,
+ String candidateCollectionExpression, Map parameters);
}
Modified: db/jdo/trunk/tck2-legacy/src/conf/jdo-2_1-signatures.txt
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2-legacy/src/conf/jdo-2_1-signatures.txt?rev=591836&r1=591835&r2=591836&view=diff
==============================================================================
--- db/jdo/trunk/tck2-legacy/src/conf/jdo-2_1-signatures.txt (original)
+++ db/jdo/trunk/tck2-legacy/src/conf/jdo-2_1-signatures.txt Sun Nov 4 13:07:52 2007
@@ -765,6 +765,9 @@
public void setOrdering(String ordering);
public void setIgnoreCache(boolean ignoreCache);
public void addSubquery(javax.jdo.Query, java.lang.String, java.lang.String);
+ public void addSubquery(javax.jdo.Query, java.lang.String, java.lang.String, java.lang.String);
+ public void addSubquery(javax.jdo.Query, java.lang.String, java.lang.String, java.lang.String[]);
+ public void addSubquery(javax.jdo.Query, java.lang.String, java.lang.String, java.util.Map);
public boolean getIgnoreCache();
public void compile();
public Object execute();
Modified: db/jdo/trunk/tck2/src/conf/jdo-2_1-signatures.txt
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/conf/jdo-2_1-signatures.txt?rev=591836&r1=591835&r2=591836&view=diff
==============================================================================
--- db/jdo/trunk/tck2/src/conf/jdo-2_1-signatures.txt (original)
+++ db/jdo/trunk/tck2/src/conf/jdo-2_1-signatures.txt Sun Nov 4 13:07:52 2007
@@ -766,6 +766,9 @@
public void setOrdering(String ordering);
public void setIgnoreCache(boolean ignoreCache);
public void addSubquery(javax.jdo.Query, java.lang.String, java.lang.String);
+ public void addSubquery(javax.jdo.Query, java.lang.String, java.lang.String, java.lang.String);
+ public varargs void addSubquery(javax.jdo.Query, java.lang.String, java.lang.String, java.lang.String[]);
+ public void addSubquery(javax.jdo.Query, java.lang.String, java.lang.String, java.util.Map);
public boolean getIgnoreCache();
public void compile();
public Object execute();